beamer icon indicating copy to clipboard operation
beamer copied to clipboard

\defbeamertemplatealias does not work with parent templates

Open SFr682k opened this issue 3 years ago • 2 comments

MWE

\documentclass{beamer}

% should behave the same as \setbeamertemplate{items}[square]
\defbeamertemplatealias{items}{custom}{square}
\setbeamertemplate{items}[custom]

\begin{document}
    \begin{frame}
        \begin{itemize}
            \item Hello World!
        \end{itemize}
    \end{frame}
\end{document}

Expected Result

Itemize items are rendered as small squares

Observed Result

Itemize items are rendered as triangles (the default)

Environment

TeXLive 2022 with beamer v3.67

SFr682k avatar Sep 02 '22 22:09 SFr682k

It seems to work with the actual beamer template instead of the template parent:

\documentclass{beamer}

\defbeamertemplatealias{itemize item}{custom}{square}
\setbeamertemplate{itemize item}[custom]

\begin{document}
    \begin{frame}
        \begin{itemize}
            \item Hello World!
        \end{itemize}
    \end{frame}
\end{document}

samcarter avatar Sep 02 '22 22:09 samcarter

It seems to work with the actual beamer template instead of the template parent

You're right: it does work when used with actual beamer templates instead of parent templates. I'm going to update the issue title accordingly.

One possible workaround would be defining aliases for every child template which is not a parent template itself. The following code does work:

\documentclass{beamer}

% \defbeamertemplatealias{itemize items}{custom}{square}  % don't uncomment -- or it will break
\defbeamertemplatealias{itemize item}{custom}{square}
\defbeamertemplatealias{itemize subitem}{custom}{square}
\defbeamertemplatealias{itemize subsubitem}{custom}{square}

% ... also define aliases for enumerate [sub[sub]]item ...

\setbeamertemplate{items}[custom]

\begin{document}
    \begin{frame}
        \begin{itemize}
            \item Hello World!
            \begin{itemize}
                \item Hello World!
                \begin{itemize}
                    \item Hello World!
                \end{itemize}
            \end{itemize}
        \end{itemize}
    \end{frame}
\end{document}

SFr682k avatar Sep 02 '22 23:09 SFr682k