如何更明显地表明 tcolorbox 已损坏?

如何更明显地表明 tcolorbox 已损坏?

我有一个围绕 AMS 定理的 tcolorboxenvironment,我希望它是可打破的。问题是,我希望有一个比默认设置提供的更明显的中断指示器。我发现最好的方法是设置选项title after break,但我的其他 tcolorboxenvironments 没有标题,所以这看起来很奇怪。

我尝试过将第一个的边界线设置为南,将最后一个的边界线设置为北,但都没有效果。我还尝试过将第一个的边界线设置在上部之后,将最后一个的边界线设置在下部之前,同样没有效果(我更喜欢这种结果)。我认为应该可以通过皮肤引擎实现边界效果,但我很难理解那么多文档。

我如何才能更好地表明 tcolorbox 正在继续进入下一页?

\documentclass{article}

\usepackage{amsthm}
\usepackage[breakable,skins]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{lipsum}

\newtheorem{mytheorem}{Theorem}

\tcolorboxenvironment{mytheorem}{
  enhanced,
  colframe=blue,
  interior style={top color=blue!20, bottom color=blue!10},
  breakable=true,
  title after break={Theorem \themytheorem\ Continued}, % works, but not great
  extras first={
    after upper={continued \ldots}, % doesn't work
    borderline south={0.25mm}{0.5mm}{red,decoration={zigzag,amplitude=0.5mm},decorate} % doesn't work
  },
  extras last={
    before lower={\ldots\ continued\par}, % doesn't work
    borderline north={0.25mm}{0.5mm}{red,decoration={zigzag,amplitude=0.5mm},decorate} % doesn't work
  }
}

\begin{document}

\lipsum[1-3]

\begin{mytheorem}[My Theorem]
 \lipsum[4-6]
\end{mytheorem}

\end{document}

答案1

这非常类似于这个答案。我只是添加了一些覆盖。

\documentclass{article}

\usepackage{amsthm}
\usepackage[breakable,skins]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{lipsum}

\newtheorem{mytheorem}{Theorem}

\tcolorboxenvironment{mytheorem}{
  enhanced,
  colframe=blue,
  interior style={top color=blue!20, bottom color=blue!10},
  breakable=true,
  %title after break={Theorem \themytheorem\ Continued}, % works, but not great
  overlay first={%
      \path[font=\small\itshape] (frame.south) node (cont) {(continued)};
      \draw[thick,red,decoration={zigzag,amplitude=0.5mm},decorate]
       (frame.south west) -- (cont.west)
       (frame.south east) -- (cont.east);
  },
  overlay middle={%
      \path[font=\small\itshape] (frame.south) node {(continued)};
      \draw[thick,red,decoration={zigzag,amplitude=0.5mm},decorate]
       (frame.south west) -- (cont.west)
       (frame.south east) -- (cont.east);
  },
  overlay last={%
      \path[font=\small\itshape] (frame.north) node (cont) {Theorem \themytheorem\ Continued};
      \draw[thick,red,decoration={zigzag,amplitude=0.5mm},decorate]
       (frame.north west) -- (cont.west)
       (frame.north east) -- (cont.east);
  },
}

\begin{document}

\lipsum[1-3]

\begin{mytheorem}[My Theorem]
 \lipsum[4-6]
\end{mytheorem}
\end{document}

在此处输入图片描述

在此处输入图片描述

有人可能想补充完整的锯齿形基于杰克的完整正弦,并使填充在装饰处停止。

\documentclass{article}

\usepackage{amsthm}
\usepackage[breakable,skins]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\pgfdeclaredecoration{complete zigzag}{initial}{
\state{initial}[
        width=+0pt,
        next state=half up,
        persistent precomputation={\pgfmathsetmacro\matchinglength{
            \pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
            \setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
        }] {}
  \state{half up}[
        width=+.25\pgfdecorationsegmentlength,
        next state=big down]
        {\pgfpathlineto{\pgfqpoint{.25\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}}
    }
  \state{big down}[switch if less than=+.5\pgfdecorationsegmentlength to center finish,
                   width=+.5\pgfdecorationsegmentlength,
                   next state=big up]
  {
    \pgfpathlineto{\pgfqpoint{.5\pgfdecorationsegmentlength}{-\pgfdecorationsegmentamplitude}}
  }
  \state{big up}[switch if less than=+.5\pgfdecorationsegmentlength to center finish,
                 width=+.5\pgfdecorationsegmentlength,
                 next state=big down]
  {
    \pgfpathlineto{\pgfqpoint{.5\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}}
  }
  \state{center finish}[width=0pt, next state=final]{
  }
  \state{final}
  {
    \pgfpathlineto{\pgfpointdecoratedpathlast}
  }
}

\usepackage{lipsum}

\newtheorem{mytheorem}{Theorem}

\tcolorboxenvironment{mytheorem}{
  enhanced,
  colframe=blue,
  interior style={top color=blue!20, bottom color=blue!10},
  breakable=true,
  %title after break={Theorem \themytheorem\ Continued}, % works, but not great
  overlay first={%
      \path[font=\small\itshape] (frame.south) node (cont) {(continued)};
      \begin{scope}[decoration={complete zigzag,amplitude=0.5mm}]
       \path[fill=blue!10]  decorate {([xshift=1.2pt]frame.south west) -- (cont.west)} --++
        (0,0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.south east) -- (cont.east)} --++
        (0,0.5ex) -| cycle;
       \path[fill=white]
        decorate {([xshift=1.2pt]frame.south west) -- (cont.west)} --++
        (0,-0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.south east) -- (cont.east)} --++
        (0,-0.5ex) -| cycle;
       \draw[thick,red,decorate] ([xshift=1.2pt]frame.south west) -- (cont.west);
       \draw[thick,red,decorate] ([xshift=-1.2pt]frame.south east) -- (cont.east);
      \end{scope} 
  },
  overlay middle={%
      \path[font=\small\itshape] (frame.south) node (cont) {(continued)};
      \begin{scope}[decoration={complete zigzag,amplitude=0.5mm}]
       \path[fill=blue!10]  decorate {([xshift=1.2pt]frame.south west) -- (cont.west)} --++
        (0,0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.south east) -- (cont.east)} --++
        (0,0.5ex) -| cycle;
       \path[fill=white]
        decorate {([xshift=1.2pt]frame.south west) -- (cont.west)} --++
        (0,-0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.south east) -- (cont.east)} --++
        (0,-0.5ex) -| cycle;
       \draw[thick,red,decorate] ([xshift=1.2pt]frame.south west) -- (cont.west);
       \draw[thick,red,decorate] ([xshift=-1.2pt]frame.south east) -- (cont.east);
      \end{scope} 
      \path[font=\small\itshape] (frame.north) node (thm) {Theorem \themytheorem\ continued};
      \begin{scope}[decoration={complete zigzag,amplitude=0.5mm}]
       \path[fill=blue!20]  decorate {([xshift=1.2pt]frame.north west) -- (thm.west)} --++
        (0,-0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.north east) -- (thm.east)} --++
        (0,-0.5ex) -| cycle;
       \path[fill=white]
        decorate {([xshift=1.2pt]frame.north west) -- (thm.west)} --++
        (0,0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.north east) -- (thm.east)} --++
        (0,0.5ex) -| cycle;
       \draw[thick,red,decorate] ([xshift=1.2pt]frame.north west) -- (thm.west);
       \draw[thick,red,decorate] ([xshift=-1.2pt]frame.north east) -- (thm.east);
      \end{scope} 
  },
  overlay last={%
      \path[font=\small\itshape] (frame.north) node (thm) {Theorem \themytheorem\ continued};
      \begin{scope}[decoration={complete zigzag,amplitude=0.5mm}]
       \path[fill=blue!20]  decorate {([xshift=1.2pt]frame.north west) -- (thm.west)} --++
        (0,-0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.north east) -- (thm.east)} --++
        (0,-0.5ex) -| cycle;
       \path[fill=white]
        decorate {([xshift=1.2pt]frame.north west) -- (thm.west)} --++
        (0,0.5ex) -| cycle
        decorate {([xshift=-1.2pt]frame.north east) -- (thm.east)} --++
        (0,0.5ex) -| cycle;
       \draw[thick,red,decorate] ([xshift=1.2pt]frame.north west) -- (thm.west);
       \draw[thick,red,decorate] ([xshift=-1.2pt]frame.north east) -- (thm.east);
      \end{scope} 
  },
}

\begin{document}

\lipsum[1-3]

\begin{mytheorem}[My Theorem]
 \lipsum[4-6]
\end{mytheorem}
\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容