tcolorbox beamer 中的帧中断

tcolorbox beamer 中的帧中断

我有一个自定义的定义样式,并尝试在此颜色框中设置和创建框架中断(对于我的自定义定义样式)。而且我的定义非常大,所以我需要为这个框设置框架中断,但遇到了麻烦:我的定义,如果在放置文本之前,块从下一张幻灯片(框架)开始,如果我使用\framebreak,中断空间非常大。

我之前已经回答过类似的问题,但是这里的问题不同。

使用时,是否可以从第 1 张幻灯片开始\framebreak

在此处输入图片描述

\documentclass[aspectratio=169, 11pt]{beamer}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\usepackage[most,many,breakable]{tcolorbox}
\usepackage{varwidth}
\usepackage{bookmark}
\usepackage{ragged2e}
\usepackage{etoolbox}
\usepackage{tikz-cd}
\usepackage{lipsum}
\usepackage{caption}

\expandafter\def\expandafter\normalsize\expandafter{%
    \normalsize
    \setlength\abovedisplayskip{4pt}
    \setlength\belowdisplayskip{4pt}
    \setlength\abovedisplayshortskip{4pt}
    \setlength\belowdisplayshortskip{4pt}
}

\makeatletter
\long\def\beamer@@frametitle[#1]#2{%
  \ifblank{#2}{}{%
    \ifnum\beamer@autobreakcount<2
    \gdef\insertframetitle{{%
      #2%
    }}%
    \gdef\beamer@frametitle{#2}%
    \gdef\beamer@shortframetitle{#1}%
    \fi%
  }%
}

\setbeamertemplate{frametitle}[default][center]

\setbeamersize{text margin left=2em,text margin right=2em}

\setbeamerfont{title}{size=\LARGE}
\setbeamerfont{subtitle}{size=\Large}
\setbeamerfont{frametitle}{size=\Large}
\setbeamerfont{block title}{size=\normalsize}
\setbeamerfont{footline}{size=\normalsize}

\usebeamercolor{structure}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{structure}{bg=black!20,fg=black}

% \addtobeamertemplate{frametitle}{}{\vspace*{-1ex}\rule{\textwidth}{1pt}}

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{section in toc}[sections numbered]

\setbeamertemplate{subsection in toc}[subsections numbered]

\setbeamertemplate{subsection in toc}{\leavevmode\leftskip=3.2em\rlap{\hskip-2em\inserttocsectionnumber.\inserttocsubsectionnumber}\inserttocsubsection\par}

\makeatletter

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

\define@key{beamerframe}{s}[true]{% stretch
  \beamer@frametopskip=4pt\relax%
  \beamer@framebottomskip=3pt 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 -3pt
   \usebeamerfont{footline}%
   \usebeamercolor{footline}%
   % \hfill\insertpagenumber/\inserttotalframenumber
   \hfill\insertpagenumber
   \hfill%
   \llap{\insertframenavigationsymbol\insertbackfindforwardnavigationsymbol}\par
   \end{minipage}\vskip4pt
}

\makeatother

\newcommand\setItemnumber[1]{\setcounter{enumi}{\numexpr#1-1\relax}}

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

\tcbuselibrary{theorems,skins,hooks}
\newtcbtheorem[number within=section]{myDefinition}{Definition}{enhanced,breakable,
    before skip=2mm, after skip=2mm, colback=black!7, colframe=black!65!white, boxrule=0.3mm,
    attach boxed title to top left={xshift=1cm, yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
    boxed title style={
        frame code={
            \path[fill=tcbcolback]
            ([yshift=-1mm,xshift=-1mm]frame.north west)
            arc[start angle=0, end angle=180, radius=1mm]
            ([yshift=-1mm,xshift=1mm]frame.north east)
            arc[start angle=180, end angle=0, radius=1mm];
            \path[left color=tcbcolback!45!white, right color=tcbcolback!45!white,
            middle color=tcbcolback!45!white]
            ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
            [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
            -- (frame.south east) -- (frame.south west)
            -- ([xshift=-1mm,yshift=-1mm]frame.north west)
            [sharp corners]-- cycle;
        },
        interior engine=empty,
    },
    fonttitle= \itshape \bfseries \color{black},
    title={#2} #1
}{def}


\apptocmd{\frame}{}{\justifying}{}

\begin{document}

\begin{frame}[s, allowframebreaks,allowdisplaybreaks]

\lipsum[1]

\begin{myDefinition*}{MyTest}
\lipsum[1]

\framebreak
\vspace{-1cm}
\lipsum[2]
\end{myDefinition*}
\end{frame}

\end{document}


相关内容