0

Until now I was not successful while trying to redefine a beamer template. In texwelt.de I found the hint to just use \setbeamertemplate, but this does not work.

\documentclass{beamer}
\usetheme{default}
\AtBeginDocument{%
\setbeamertemplate*{block example begin}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title example}
    \usebeamerfont*{block title example}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title example}
  {}
  {\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body example}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
    \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
}

\begin{document}
A
\end{document}
  • try to remove the \AtBeginDocument stuff – user36296 Dec 10 '15 at 10:46
  • Welcome to TX.SX, but in your code last \begin{beamercolorbox} doesn't have corresponding \end{beamercolorbox}, your main text doesn't contain any frame and you don't explain what you want to obtain with this redefinition. How can we help you? – Ignasi Dec 10 '15 at 10:46
  • The \end{beamercolorbox} remains unchanged, so I does not have to repeat it. Frame is also not required as the error message shows yet. \AtBeginDocument is also required. – Jürgen Dec 10 '15 at 11:02
  • Addendum: I like to play with some graphical elements, but this is not relevant at the Moment. – Jürgen Dec 10 '15 at 11:12
  • @Jürgen Does it work without \AtBeginDocument? – user36296 Dec 10 '15 at 11:59
1

\AtBeginDocument is not necessary and the command to set a beamer template is \setbeamertemplate not \setbeamertemplate*. The following code works fine for me:

\documentclass{beamer}

\setbeamertemplate{block example begin}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title example}
    \usebeamerfont*{block title example}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title example}
  {}
  {\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body example}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
    \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\begin{document}
\begin{frame}
\begin{exampleblock}{Example}
    Block content.
\end{exampleblock}
\end{frame}
\end{document}
  • OMG, the asterisk caused the problem! Small cause, large effect. I will carry on and implement my changes in this template and perhaps come back again. Many thanks for your help! – Jürgen Dec 11 '15 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.