我有一些嵌套的 tcolorbox,我想打破它们。为了实现这一点,我尝试重现 tcolorbox 手册第 424 页上的“伪造怪胎”,但没有成功。这是一个带有简单框的 MWE:
\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{mybox}[2][]{%
enhanced,
title = Title,
boxsep = 3mm,
frame hidden,
interior hidden,
attach boxed title to top left = {yshift=-\tcboxedtitleheight/2},
frame code = {\draw (frame.north west) -- (frame.north east) --(frame.south east) -- (frame.south west) -- cycle;},
skin first is subskin of = {emptyfirst}{frame code = {%
\draw (frame.south west) -- (frame.north west) --(frame.north east) -- (frame.south east);}},
skin middle is subskin of = {emptymiddle}{frame code={%
\draw (frame.north west) -- (frame.south west)
(frame.north east) -- (frame.south east);}},
skin last is subskin of = {emptylast}{frame code={%
\draw (frame.north west) -- (frame.south west) -- (frame.south east) -- (frame.north east);}},
width = #2,
#1}
\begin{document}
%with tcolorbox breakable library: works (but won't with nested boxes)
\begin{mybox}[breakable]{\linewidth}
\lipsum[1]
\tcbbreak
\lipsum[1]
\end{mybox}
\pagebreak
%with 'faked break':
%draws no frame
\begin{mybox}[skin = enhancedfirst]{\linewidth}
\lipsum[1]
\end{mybox}
\pagebreak
%draws title again and no frame
\begin{mybox}[skin = enhancedlast, breakable]{\linewidth}
\lipsum[1]
\end{mybox}
\end{document}
如果我不定义新皮肤,‘伪造中断’将按预期工作。为什么它在上面的代码中不起作用?