Consider the following mwe:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
\usetikzlibrary{calc}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[enhanced,breakable,segmentation code={\draw[red]($(segmentation.west)+(1,0)$)--($(segmentation.east)+(-1,0)$);}]
test
\tcblower
Works as expected
\end{tcolorbox}
\begin{tcolorbox}[enhanced,breakable,segmentation code={\draw[red]($(segmentation.west)+(1,0)$)--($(segmentation.east)+(-1,0)$);}]
\lipsum
\tcblower
Does not work as expected
\end{tcolorbox}
\end{document}
Unbroken box result:
Broken box result:
The goal is to have a tcolorbox with the given segmentation style, e.g. a red line a bit shorter than the box width.
The code works fine if the box does not break, but it seems to be ignored when the box breaks. What am I doing wrong?
Edit: I just discovered than I can force the segmentation code after the break putting it inside a extend freelance last
, but this is not a viable solution since it also changes the appearance of the frame in an undesired way.
segmentation code
changes the code of the current skin. That's theunbroken
one in your case. For the three broken casesfirst
,middle
,last
there would be own code definitions.segmentation style
changes the style of the whole break sequence.last
ormiddle
part of an enhanced broken box? I know how to do it forfreelance
, but not for enhanced.skin first is subskin of={enhancedfirst}{segmentation code={...}}
. The same formiddle
andlast
.enhancedfirst
can be replaced by any skin, e.g.enhanced
if the box should stay closed. A full example is given on page 170 (v3.02).