2

My question

How do I wrap the frame environment in beamer to have it in a tcolorbox in \mode<article> ? (and not just the title as below)

enter image description here

Context

I use beamer and beamarticle.

I'd like to highlight the frames in a tcolorbox when I use \mode<article>. It enables me to see what is in the notes vs the shorter version that should be in the frames.

I understand I need to change the \setbeamertemplate with the right key for the frame environment. I'd like what's in the frame to be a wrapped in a tcolorbox in \mode<article> (not just the title as in MWE with an error).

I'd like also to have the Title(+Subtitle) as the title of the tcolorbox.

MWE

\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage[envcountsect]{beamerarticle}
\usepackage{tcolorbox}

\mode<article> { \setbeamertemplate{frame begin}{% \begin{tcolorbox}[ colback=red!20, colframe=red!60, arc=4mm, title={\insertframetitle \emph{\insertframesubtitle}}, coltitle=red!50!black, fonttitle=\bfseries\scshape, detach title, before upper={\tcbtitle\par} ] }% \setbeamertemplate{frame end}{\end{tcolorbox}} }

\begin{document}

\begin{frame} {Title of the frame} {Subtitle of the frame}

\begin{itemize}
    \item first
    \item Second
    \item third
\end{itemize}

\end{frame}

\end{document}

muzimuzhi Z
  • 26,474
JeT
  • 3,020
  • 2
    Here is a way to add boxes around the frames. To add a tcolorbox environment seems to be more tricky. –  May 31 '20 at 18:15
  • 2
    @Schrödinger'scat merci for the link. I start playing with it and it already does not compile :/ – JeT May 31 '20 at 18:36
  • 1
    Indeed. Sorry, I did not test it. Since it most likely did compile when it was written, an update must have broken it. (I only know one user who will most likely immediately know what is going on. You can find her here.) –  May 31 '20 at 18:50
  • 1
    @Schrödinger'scat Merci for the check, just as if you've just given me the name of the doorman of a bar I can't get in :) – JeT May 31 '20 at 18:59
  • 1
    What do you mean you can't get in? You can certainly access that site, can't you? (Let me mention that there is in principle a way to turn all frames in tcolorboxes: here. You can make it work for the above scenario. However, there will always be scenarios in which it fails.) –  May 31 '20 at 19:04
  • 1
    @Schrödinger'scat I got in a just post my question. but your "(I only know one user who will most likely immediately..." made me think you gave me like a secret door for an exclusive thing. SamCarter seems to be the one :) – JeT May 31 '20 at 19:08
  • 2
    Bingo. ;-) ;-) ;-) –  May 31 '20 at 19:10
  • I did some tests on my side, but with your style modifications, you use \insertframtitle/\insertframetitle before the actual start of the frame so \frametitle/subtitle are not defined yet, leading to and empty \tcbtitle. Moreover, it seems the tcolorbox has trouble with the \begin{frame}{<frametitle>}{<framesubtitle>} format see the below (not really an answer) proposal. – BambOo Jun 01 '20 at 13:17
  • @BambOo Hi, take a look @ https://topanswers.xyz/tex?q=1089. – JeT Jun 01 '20 at 13:20
  • @Schrödinger'scat do you want to post an answer from XYZ ? – JeT Jun 01 '20 at 13:20
  • 1
    @JeT There are folks like us, then there are some wizards .... – BambOo Jun 01 '20 at 13:24
  • @BambOo I think you're the next one in the wizard's club.... – JeT Jun 01 '20 at 13:26
  • 2
    I think "my" answer is mainly samcarter's work. –  Jun 01 '20 at 13:28

1 Answers1

2

Here is a modified code which shows the colorbox, but not the subtitle.

\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage[envcountsect]{beamerarticle}
\usepackage{tcolorbox}

\mode<article>
{
\setbeamertemplate{frame begin}{%
    \begin{tcolorbox}[
            colback=red!20,
            colframe=red!60,
            arc=4mm,
            title={\insertframetitle \emph{\insertframesubtitle}},
            coltitle=red!50!black, 
            fonttitle=\bfseries\scshape,
            detach title,
            %before upper={aaa \tcbtitle\par}
            ]
            }%
\setbeamertemplate{frame end}{\end{tcolorbox}}
}

\begin{document}

\begin{frame}
    \frametitle{Title of the frame}
    \framesubtitle{Subtitle of the frame}
    \begin{itemize}
        \item first
        \item Second
        \item third
    \end{itemize}

\end{frame}

\end{document}

enter image description here

BambOo
  • 8,801
  • 2
  • 20
  • 47