After reading section 12.4 Theorem Environments from beameruserguide
I understand that all theorem like environments (theorem, lemma, corollary, …) except example use same beamertemplate
which means same block colors. Is it true?
If the answer is yes, is there any beamer (not using tcolorbox
or mdframed
theorems) way to customizing colors for each environment?
If the answer is no, could you show me an example?
Nex there's a little code to start with:
\documentclass{beamer}
\usetheme{Warsaw}
\begin{document}
\begin{frame}
\begin{theorem}[A]
Theorem body
\end{theorem}
\begin{example}[B]
Example body
\end{example}
\begin{proof}[C]
Proof body
\end{proof}
\begin{lemma}[D]
Lemma body
\end{lemma}
\end{frame}
\end{document}
Best Answer
To start the answer small: as you will have found in the docs, the actual environment inserted depends on the value of
\inserttheoremblockenv
. Unfortunately, the docs only do what the docs say:and not what they might seem to suggest (i.e. something along the lines of "if the style is X, and environment
Xblock
exists, I'll useXblock
, otherwiseblock
). The way this is done is simplistic (beamerbasetheorems.sty):\th@example
is the macro that stores the look and layout of theorem styleexample
. So for a different style, you can change the environment.Defining an environment for the color combinations you want seems to be done best in a brute-force way by adapting the definition of, e.g.
exampleblock
(beamerbaselocalstructure.tex
):On first thought, though, this won't help you with the pre-defined theorem names, so you might want to give the class option
notheorems
to disable the predefinedtheorem
etc. and define them yourself.