This is not a really elegant solution (yet?) but shows that this can be done in principle. The key ingredient is Martin Scharrer's solution of a closely related problem. The strategy is to save the tcolorbox
in a \savebox
and then to decompose it into bits that fit. Ironically, for this we do not need breakable
. I also added some analog of the \textheight
, called \Textheight
, by hand simply because I do not know what the corresponding length really is.
\documentclass{beamer}
\usetheme{default}
%
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
%
\newcounter{myexpl}[section]
\def\themyexpl{\thesection.\arabic{myexpl}}
\usepackage{adjustbox}
\newsavebox{\mysavebox}
\newlength{\myrest}
\newlength{\Textheight}
\Textheight=7.9cm
\newif\iffirstframe
\firstframetrue
\tcbmaketheorem{texample}{Example}{
fonttitle={\bfseries\upshape\hypersetup{linkcolor=blue!10!white}},
fontupper=\slshape, arc=0mm, colback=red!50!yellow!5!white,
colframe=red!50!yellow!50!black, separator sign dash}
{myexpl}{exp}
%
\title{Beamer Template}
\author{Test}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\begin{lrbox}{\mysavebox}%
\begin{texample}{test}{tt}
\lipsum[1-3]
\end{texample}
\end{lrbox}%
\begin{frame}[fragile,t,allowframebreaks]{Example Breakable Test}
\ifdim\ht\mysavebox>\Textheight
\setlength{\myrest}{\ht\mysavebox}%
\loop\ifdim\myrest>\Textheight
\iffirstframe
\firstframefalse
\else
\newpage\par\noindent
\fi
\clipbox{0 {\myrest-\Textheight} 0 {\ht\mysavebox-\myrest}}{\usebox{\mysavebox}}%
\addtolength{\myrest}{-\Textheight}%
\repeat
\newpage\par\noindent
\clipbox{0 0 0 {\ht\mysavebox-\myrest}}{\usebox{\mysavebox}}%
\else
\usebox{\mysavebox}%
\fi
\end{frame}
\end{document}

I believe that this will work for mdframed, too, cf. this question.