Beamer 定制易碎盒

Beamer 定制易碎盒

在这种情况下,我需要一个可破坏的自定义示例,以便我可以破坏部分内容并移动到下一帧。

\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}

第一种情况:

我使用这种结构,因此我有所需的边距,以及在一张幻灯片上管理文本、插入图片的能力,并且在选定的自定义环境之前,不会出现空白幻灯片,但是内容无法正确传输到下一帧

在此处输入图片描述

第二种情况: 在这种情况下,我没有所需的边距,在选定的自定义环境之前,我出现了空的幻灯片,但内容确实正确地传输到下一帧,除了例如,对于帧 5 没有顶部填充,对于帧 6,顶部填充不等于帧 5 的底部填充。

在此处输入图片描述

我的烦恼: 是否可以像第一种情况一样保持边距和对齐方式,但它可以将内容传输到 tcolorbox,同时,使用时下一帧的顶部缩进将等于前一帧的底部缩进mdframed

答案1

您可以使用以下方法手动拆分 tcolorbox \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}

在此处输入图片描述

相关内容