我们怎样才能在 tcolorbox 中断后设置相同风格的盒装标题?
\documentclass{article}
\usepackage{lipsum}%
\usepackage[all]{tcolorbox}%
\begin{document}
\def\TheTitle{Boxed title}
\begin{tcolorbox}[enhanced,breakable,attach boxed title to top center={yshift=-2mm},coltitle=black,boxed title style={boxrule=0.4pt,colback=black!2!white},
title=\TheTitle,title after break={continued \TheTitle}]
\lipsum
\end{tcolorbox}
\end{document}
答案1
这使用了一种“棘手的”覆盖方法,明确设置另一个tcolorbox
作为盒子破损部分的盒子标题。
该extras middle and last=
选项旨在为“中间”和“最后”盒子部分添加功能,即打破盒子之后的功能。
\documentclass{article}
\usepackage{lipsum}%
\usepackage[all]{tcolorbox}%
\begin{document}
\def\TheTitle{Boxed title}
\tcbset{boxtitlestuff/.style={boxrule=0.4pt,colback=black!2!white,coltitle=black,fonttitle={\bfseries},size=normal},
brokentitle/.style={geometry nodes=true,skin=freelancemiddle,
extras middle and last={overlay={\node[above,inner sep=-4pt] (A) at (interior.north) {\tcbox[boxtitlestuff]{continued \TheTitle}};}
}
}
}
\begin{tcolorbox}[skin=enhanced jigsaw,
breakable,
attach boxed title to top center={yshift=-2mm},
coltitle=black,
boxed title style={boxrule=0.4pt,colback=black!2!white},
title=\TheTitle,
% title after break={continued \TheTitle},
brokentitle
]
\lipsum
\lipsum
\lipsum
\lipsum
\end{tcolorbox}
\end{document}