# mdframed theorems within beamerarticle script

I need to use framed theorem environments the way they are made in Make an Example and shaded box like in the book.
The realization with \usepackage[framemethod=TikZ]{mdframed} is working fine. But now, I have to implement this in a ready written script being made with \documentclass{article} and \usepackage{beamerarticle}.
The predefined theorem environments in german language Satz, Beispiel and so on are used. I already tried using \setbeamertemplate{theorem begin}{...} and \setbeamertemplate{theorem end}{...} for inserting those boxing commands for example with

\setbeamertemplate{theorem begin}{\begin{mdframed}%
[linecolor=yellow,outerlinewidth=3pt,backgroundcolor=red!10,roundcorner=15pt,%
skipabove=\baselineskip,skipbelow=\baselineskip]}%
\setbeamertemplate{theorem end}{\end{mdframed}}


but it is not working.
Are there other ways, as I do not want to rename all used environment and make new ones?

I found a solution

\usepackage{etoolbox}
\BeforeBeginEnvironment{Satz}{\begin{mdframed}[linecolor=yellow,outerlinewidth=3pt,backgroundcolor=red!10,roundcorner=15pt,%
skipabove=\baselineskip,skipbelow=\baselineskip]\vspace{-0.5cm}}
\AfterEndEnvironment{Satz}{\end{mdframed}}


but others are still welcome.

-
You know me (HSU) - I am the author of mdframed. –  Marco Daniel Dec 20 '11 at 7:35
@MarcoDaniel - Yes, indeed - I know you... Do you have a solution? I'll edit the question next minute, as I found one way - but I'm looking for others, too. Best wishes. –  Bastian Ebeling Dec 20 '11 at 7:41
At the moment I can't test you know my job. At the evening I will have a look. –  Marco Daniel Dec 20 '11 at 9:55
If all else fails, you can use the notheorems option to beamerarticle and define the environments Satz,... entirely yourself. Not nice, but at least you won't have to go though the entire source. –  Ulrich Schwarz Dec 20 '11 at 11:43
@UlrichSchwarz, of course this might be done - but I prefer the etoolbox-way.. or another better one - which might come soon here, hopefully. Thanks. –  Bastian Ebeling Dec 20 '11 at 19:48

The solution with \setbeamertemplate{begin theorem} doesn't work because it isn't defined. The file beamerbasetheorems.sty loaded by beamerarticle provides the definition of the theorem environments.

\mode
<article>
{
\ifbeamer@ams
\RequirePackage{amsmath}
\RequirePackage{amsthm}

\renewenvironment<>{proof}[1][\proofname]
{\begin{actionenv}#2\begin{originalproof}[{#1}]}{\end{originalproof}\end{actionenv}}

% Make new theorem overlay-specification-aware
\let\beamer@origthm=\@thm
\def\beamer@storeaction{\begin{actionenv}}
\expandafter\beamer@origthm\beamer@store[{#1}]}

\let\beamer@origbegintheorem=\@begintheorem
\def\@begintheorem{\beamer@storeaction\beamer@origbegintheorem}

\let\beamer@origendtheorem=\@endtheorem
\def\@endtheorem{\beamer@origendtheorem\end{actionenv}}
\fi

\def\th@example{\th@remark}

\newcommand{\ExampleInline}[1]{\translate{Example}: \ignorespaces#1}

% Compatiblity:
\newcommand{\BeispielInline}[1]{Beispiel: \ignorespaces#1}
}


You see there are no definition. The environments lemma etc. are also defined in the quoted file.

Based on this information I prefer the solution with etoolbox (loaded by mdframed). To modify every theorem environment you can also use \BeforeBeginEnvironment{\@begintheorem}{...}.

To verify my answer you can test the simple example:

\documentclass[ngerman]{book}
\usepackage{babel}
\usepackage{beamerarticle}
\setbeamertemplate{theorem begin}{\undefined \fooo}
\begin{document}
Text
\begin{theorem}
foo bar
\end{theorem}
Text
\begin{lemma}
foo bar
\end{lemma}
\end{document}


The setting \setbeamertemplate{theorem begin}{\undefined \fooo} has no influence.

-
I hope it helps. –  Marco Daniel Dec 20 '11 at 20:21
yes it does and the idea with \BeforeBeginEnvironment{\@begintheorem}{...} is great. THX: Merry Xmas and have a happy new year! –  Bastian Ebeling Dec 22 '11 at 7:55