1

I have encountered several problems when using a breakable tcolorbox with beamer class. For some of them, although workarounds are found, I still wonder if there exist more automatic and elegant solutions.

For the following questions, assume document class beamer is used and option allowframebreaks is added to frame environment.

Question 1. How to let breakable tcolorbox break automatically?

Workaround 1: Set break at=<length1> manually.

Question 2. How to vertically center middle parts (if any) of break sequence? (The first and last parts is vertically centered as expected.}

Workaround: Set enlarge top at break by=<length2> and break at=<length1>/<length1 + length2> to enlarge the topsep of middle and last parts and keep the height of text content of those parts unchanged. But this also adds topsep of last, which results to un-satisfied positioning.

It fails to pass any rubber length to key enlarge top at break by so I have to use something like "80pt" to simulate a vertical centering. How can I add something like \vfill before and after middle parts? There is a key named vfill before first=<bool> for first part, but not any similar keys for middle parts.

Question 3. How to add reminding text like "continued" before break?

Workaround: Use bottomsep at break=<length> for making some space, and finish first and middle=<graphical code> for adding reminding text.

Question 4. In general, how can I insert codes before and after breaks for first, middle, and last parts separately, to change their geometry, text contents and others?

The doc of extras={<options>} key family says

Geometry and break settings should not be used here, ...

Hence extras key family is not suitable here. The <code> passed to keys before and after

are used only before the first and after the last part of the break sequence.

Hence these two keys are not suitable as well.


A MWE to produce pages under all circumstances:

\documentclass{beamer}
\usepackage{lipsum}
\usepackage{tcolorbox}
\tcbuselibrary{breakable, skins}

\tcbset{breakable}

\newcommand{\frameDemo}{
  \begin{frame}[allowframebreaks]
    \begin{tcolorbox} \lipsum[2-3] \end{tcolorbox}
  \end{frame}
}

\begin{document}
% without any workarounds
\frameDemo

\tcbset{
  % workaround for question 1
  break at=100pt,
}
\frameDemo

\tcbset{
  % workaround for question 1 & 2
  break at=100pt/180pt,
  enlarge top at break by=80pt,
}
\frameDemo

\tcbset{
  % workaround for question 1, 2 & 3
  finish first and middle={
    \node[anchor=south east] 
        at ([xshift=-2pt]interior.south east) 
        {\itshape continued};
  },
  bottomsep at break=.7\baselineskip
}
\frameDemo

\begin{frame}[allowframebreaks]
  \fontsize{120}{120}\selectfont empty page
\end{frame}
\end{document}

A helper to assemble these beamer pages:

\documentclass[landscape, a4paper]{article}
\usepackage{pdfpages}

\begin{document}
\includepdf[pages={1-2,16,16,16,3-6,16,7-10,16,11-15}, nup=5x5, frame, delta=5 5]{breakable-in-beamer-texsx.pdf}
\end{document}

Screenshoot of assembled beamer pages: screenshoot

  • 2
    You are misusing beamer. Presentations shouldn't contain long continous text parts. Design your slides one by one. allowframebreak can be used for exceptions like a bibliography. – Ulrike Fischer Jan 14 at 9:17

Your Answer

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

Browse other questions tagged or ask your own question.