1

I am using beamerarticle and want to put a box around the content between frames and only when there is really content. Is that possible? I tried it with mdframes package quite symmetric to Framing \frame using mdframed with beamerarticle but did not succeed as I got errors on compilation.

\documentclass[a4paper,12pt]{article}
\usepackage{beamerarticle}
\usepackage{mdframed}

\mode<article>{
\setbeamertemplate{frame begin}{\end{mdframed}}
\setbeamertemplate{frame end}{\begin{mdframed}}
}

\begin{document}

\begin{frame}
    \frametitle{testframe}
    content for testframe
\end{frame}

lalala interframetext

\begin{frame}
    \frametitle{testframe}
    content for testframe
\end{frame}

\end{document}

1 Answer 1

1

Two problems:

  • the timing of your templates is wrong. The frame begin and frame end templates are executed when the frame environment has already began/is still going. This will create kind of a chain link between your mdframe and beamer's frame environments. You have to open and close your mdframe before or after the beamer frame.

  • you also have to consider the edge cases, e.g. the first \begin{frame} which tries to close an environment which was never opened and the last \end{frame} which also creates an mdframe which is never closed.


%\documentclass{beamer}

\documentclass[a4paper,12pt]{article}
\usepackage{beamerarticle}
\usepackage{mdframed}

\mode<article>{
\AfterEndEnvironment{frame}{\begin{mdframed}}
\BeforeBeginEnvironment{frame}{\end{mdframed}}
}

\begin{document}

\mode<article>{\begin{mdframed}}
\begin{frame}
    \frametitle{testframe}
    content for testframe
\end{frame}

lalala interframetext

\begin{frame}
    \frametitle{testframe}
    content for testframe
\end{frame}
\mode<article>{\end{mdframed}}

\end{document}
1
  • Okay, agreed, I did use the timing in a wrong way. Yet, I was wondering if you can in some way automatically detect, whether there is content in between? But probably it is the best way, as you suggested at tex.stackexchange.com/questions/659402/…, to use just explicit mdframed whenever I have text there...
    – Arne
    Commented Sep 25, 2022 at 11:41

You must log in to answer this question.

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