josephwright / beamer

A LaTeX class for producing presentations and slides
Other
1.43k stars 145 forks source link

\defbeamertemplatealias does not work with parent templates #796

Open SFr682k opened 2 years ago

SFr682k commented 2 years ago

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

samcarter commented 2 years ago

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}
SFr682k commented 2 years ago

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}