0

In this case I need a breakable for custom example that I could break part of contents and move to next frame.

\documentclass{beamer}
\usetheme{default}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[most,many,breakable]{tcolorbox}
\usepackage{varwidth}
\usepackage{ragged2e}
\usepackage{etoolbox}
\usepackage{mdframed} % default settin
\mdfsetup{
skipabove =4pt, skipbelow =4pt,
innerlinewidth=4pt,outerlinewidth=4pt,
middlelinewidth=4pt,
leftline = false, topline = false,
rightline=false,bottomline=false}

\setbeamertemplate{navigation symbols}{}

\definecolor{mytheoremfr}{HTML}{00007B}

\tcbuselibrary{theorems,skins,hooks}

\makeatletter

\define@key{beamerframe}{s}[true]{% stretch
  \beamer@frametopskip=4pt\relax%
  \beamer@framebottomskip=4pt plus 0.001fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}


\setbeamertemplate{footline}{%
   \centering
   \begin{minipage}{\dimexpr\paperwidth-\beamer@leftmargin-\beamer@rightmargin\relax}
    % \vspace{-4ex}
   \centering
   \rule{\linewidth}{1pt} \vskip -2pt
   \usebeamerfont{footline}%
   \usebeamercolor{footline}%
   % \hfill\insertpagenumber/\inserttotalframenumber
   \hfill\insertpagenumber
   \hfill%
   \llap{\insertframenavigationsymbol\insertbackfindforwardnavigationsymbol}\par
   \end{minipage}\vskip4pt
}
\makeatother

\newtcbtheorem[number within=section]{myExample}{Ex}
{%
         colback= black!7
        ,enhanced
        ,breakable
    ,colframe = black!65
    ,coltitle = black!100
    ,boxrule = 1pt
    % ,sharp corners 
    ,detach title
    ,before upper=\tcbtitle\par\smallskip
    ,fonttitle = \bfseries
    ,description font = \mdseries
    ,separator sign none
    ,description delimiters parenthesis
}{ex}


\begin{document}

\begin{frame}
\titlepage
\end{frame}

     
    % FIRST CASE
    \begin{frame}[s]
        \begin{myExample}{Example}{}
        \lipsum[1-2]
        \end{myExample}
    \end{frame}

    % SECOND CASE
    \begin{frame}[s]
        \begin{mdframed}
        \begin{myExample}{Example}{}
        \lipsum[1-2]
        \end{myExample}
    \end{mdframed}
    \end{frame}


\end{document}

First case:

I use this construction, so I have the required margins for me, as well as the ability to manage text on one slide, insert pictures and before the selected custom environment, no empty slides appear, however, the content does not correctly transfer to the next frame

enter image description here

Second case: In this case I have no required margins for me, before the selected custom environment, I have empty slides appear, but the content does correctly transfer to the next frame except that, for example, for frame 5 there is no top padding, and for frame 6, the top padding is not equal to the bottom padding of frame 5.

enter image description here

My trouble: Is it possible to keep the margins and alignment as for the first case, but it would work to transfer the content to the tcolorbox, and at the same time, the top indent for the next frame would be equal to the bottom indent for the previous one, when using mdframed ?

7
  • You could split the tcolorbox across multiple page with a) the allowframebreaks option and b) using \framebreak at a suitable place inside the box (see tex.stackexchange.com/a/692584/36296 for an example). For an automatic approach, see tex.stackexchange.com/a/509263/36296 . A frame with fixed top and bottom margin really needs some stretchable material inside it. Commented Sep 3, 2023 at 21:35
  • @samcarter_is_at_topanswers.xyz If I use \framebreak with allowframebreaks I get empty previous frame, before my custom enviroment. tex.stackexchange.com/a/509263/36296 -- automatic approach move fragments in such a way that some of the letters, for example, in a line are split in such a way that half is related to the previous slide, the rest to the next ... I see this post on stack, but it is not correct work with setted custom styles block...
    – Alex
    Commented Sep 3, 2023 at 21:44
  • If you get an empty page before the tcolorbox, than your first part of the box is too tall to fit on the frame. Try to use \framebreak earlier Commented Sep 3, 2023 at 21:53
  • pastebin.com/ZVsWwW5v seems to break fine without extra page i.sstatic.net/gUAhB.png Commented Sep 3, 2023 at 21:58
  • It really is preferable to just make separate boxes for Beamer. Certainly \allowframebreaks should be avoided in this kind of case. (I use it for bibliographies, but that's about it.) But what I'd do is put it on one slide in a single frame and use either overprint or whatever-the-other-one-is-called, so it doesn't jump at the transition. (This is pretty much equivalent to keeping the padding the same, I think, but the whole box will stay the same size, regardless of the size of content.) Even if you need all of it in handout mode, this works well. You just have to force it a bit.
    – cfr
    Commented Sep 3, 2023 at 22:04

1 Answer 1

1

You can manually split the tcolorbox using \framebreak:

\documentclass{beamer}
\usetheme{default}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[most,many,breakable]{tcolorbox}
\usepackage{varwidth}
\usepackage{ragged2e}
\usepackage{etoolbox}
\usepackage{mdframed} % default settin
\mdfsetup{
skipabove =4pt, skipbelow =4pt,
innerlinewidth=4pt,outerlinewidth=4pt,
middlelinewidth=4pt,
leftline = false, topline = false,
rightline=false,bottomline=false}

\setbeamertemplate{navigation symbols}{}

\definecolor{mytheoremfr}{HTML}{00007B}

\tcbuselibrary{theorems,skins,hooks}

\makeatletter

\define@key{beamerframe}{s}[true]{% stretch
  \beamer@frametopskip=4pt\relax%
  \beamer@framebottomskip=4pt plus 0.001fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}


\setbeamertemplate{footline}{%
   \centering
   \begin{minipage}{\dimexpr\paperwidth-\beamer@leftmargin-\beamer@rightmargin\relax}
    % \vspace{-4ex}
   \centering
   \rule{\linewidth}{1pt} \vskip -2pt
   \usebeamerfont{footline}%
   \usebeamercolor{footline}%
   % \hfill\insertpagenumber/\inserttotalframenumber
   \hfill\insertpagenumber
   \hfill%
   \llap{\insertframenavigationsymbol\insertbackfindforwardnavigationsymbol}\par
   \end{minipage}\vskip4pt
}
\makeatother

\newtcbtheorem[number within=section]{myExample}{Ex}
{%
         colback= black!7
        ,enhanced
        ,breakable
    ,colframe = black!65
    ,coltitle = black!100
    ,boxrule = 1pt
    % ,sharp corners 
    ,detach title
    ,before upper=\tcbtitle\par\smallskip
    ,fonttitle = \bfseries
    ,description font = \mdseries
    ,separator sign none
    ,description delimiters parenthesis,
    enlarge top at break by=0.5cm
}{ex}


\begin{document}

    % FIRST CASE
    \begin{frame}[t,allowframebreaks]
        \begin{myExample}{Example}{}
        \lipsum[2]
        \framebreak
        \lipsum[2]
        \end{myExample}
    \end{frame}

\end{document}

enter image description here

You must log in to answer this question.

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