1

I am trying to create two distinct styles of blocks for my beamer theme, one has outlines and the other is inverted. I already implemented them, but this is about the proper selection method. So here is my MWE:

\documentclass{beamer}

\usepackage{ifthen}

\defbeamertemplate*{block alerted begin}{mytest}[1][outline]{%
\ifthenelse{\equal{#1}{outline}}%
    {%
        Beginn Outline%
    }%
    {%
        \ifthenelse{\equal{#1}{inverted}}
        {%
            Beginn Inverted%
        }%
        {%
        }%
    }%
}

\defbeamertemplate*{block alerted end}{mytest}[1][outline]{%
    \ifthenelse{\equal{#1}{outline}}%
    {%
        Beginn Outline%
    }%
    {%
        \ifthenelse{\equal{#1}{inverted}}
        {%
            Beginn Inverted%
        }%
        {%
        }%
    }%
}

\begin{document}
\begin{frame}[label=myframe]
\begin{alertblock}{}
    Test
\end{alertblock}
\end{frame}
\setbeamertemplate{blocks}[mytest][inverted]
\againframe{myframe}

\setbeamertemplate{blocks}[mytest][outline]
\againframe{myframe}

\setbeamertemplate{block alerted begin}[mytest][inverted]
\setbeamertemplate{block alerted end}[mytest][inverted]
\againframe{myframe}
\end{document}

As you can see, I am defining two options of the block alerted template and then call it for different frames. However this is what I get:

enter image description here

So I have the [inverted] or [outline] printed on the first slide that comes after I tried to set the parent template, but it didn't set it. However the call to each individual template worked. And as far as I understand the manual, it should work:

Parent Beamer-Template Changing this parent template changes the templates of normal blocks, alerted blocks, and example blocks.
Example:\setbeamertemplate{blocks}[default]
Example:\setbeamertemplate{blocks}[rounded][shadow=true]

So it seems for a reason unknown to me, I can call my template through itself, but not through the parent template and I don't get the reason why this is the case. Can anyone explain it?

1 Answer 1

1

You'll also have to define the parent template for the mytest style:

\documentclass{beamer}

\usepackage{ifthen}

\defbeamertemplateparent{blocks}[mytest]{block alerted begin,block alerted end}[1][outline]{[#1]}

\defbeamertemplate{block alerted begin}{mytest}[1][outline]{%
\ifthenelse{\equal{#1}{outline}}%
    {%
        Beginn Outline%
    }%
    {%
        \ifthenelse{\equal{#1}{inverted}}
        {%
            Beginn Inverted%
        }%
        {%
        }%
    }%
}

\defbeamertemplate{block alerted end}{mytest}[1][outline]{%
    \ifthenelse{\equal{#1}{outline}}%
    {%
        Beginn Outline%
    }%
    {%
        \ifthenelse{\equal{#1}{inverted}}
        {%
            Beginn Inverted%
        }%
        {%
        }%
    }%
}

\setbeamertemplate{blocks}[mytest][outline]

\begin{document}
\begin{frame}[label=myframe]
\begin{alertblock}{}
    Test
\end{alertblock}
\end{frame}
\setbeamertemplate{blocks}[mytest][inverted]
\againframe{myframe}

\setbeamertemplate{blocks}[mytest][outline]
\againframe{myframe}

\setbeamertemplate{block alerted begin}[mytest][inverted]
\setbeamertemplate{block alerted end}[mytest][inverted]
\againframe{myframe}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .