4

I am using breakable tcolorboxes, with different colours for upper and lower part (bicolor). However, when box breaks exactly between upper and lower part, the part of the box after the brake starts with the upper part color and only then continues with the lower part color. Is there any way to fix this?

MWE:

\documentclass[11pt]{scrbook}

\usepackage{lipsum}

\usepackage[many]{tcolorbox}

\newtcolorbox{example}{breakable,bicolor,colback=black!10!white,colbacklower=black!5!white,title={Example}}


\begin{document}

\begin{example}

\lipsum[3-7]

\tcblower

\lipsum[8]

\end{example}

\end{document}

EDIT: I have realised that option "pad after break=0mm" is helful, but it should be applied only in the situation when tcolorbox is broken between upper and lower part.

3

Update: For tcolorbox version 4.03 or higher, this feature is / will be implemented as option segmentation at break=false.

First, the behaviour is not a bug. If a break occurs at the segmentation between upper and lower part, then the segmentation line and the lower part go to the next page. There, the segmentation is displayed to signal that the lower part starts.

For bicolor, the color change also signals the begin of the lower part. So, it may be preferable to have no explicit segmentation line here. I take it as a feature request that the segmentation is optionally not drawn on page breaks :-)

For 'faked' segmentations with \tcbline, there already is the option to use \tcbline* instead to get this feature.

For 'real' segmentations, this option is currently not available. But, I think we can do it with the following new option:

\tcbset{
  experimental split/.code={\let\tcb@split@SL=\tcb@split@L},
}

With it, the segmentation line is not drawn at the begin of the splitted box. I have to investigate, if this causes some unwanted side-effects. Also, a good name for the feature has to be found (suggestions are welcome).

The full example code is:

\documentclass[11pt]{scrbook}

\usepackage{lipsum}
\usepackage[many]{tcolorbox}

\makeatletter
\tcbset{
  experimental split/.code={\let\tcb@split@SL=\tcb@split@L},
}
\makeatother


\newtcolorbox{example}{breakable,
  experimental split,
  bicolor,
  colback=red!10!white,
  colbacklower=blue!5!white,
  title={Example}}


\begin{document}

\begin{example}
\lipsum[3-7]
\tcblower
\lipsum[8]
\end{example}

\end{document}

enter image description here

  • What about the command \tcblower*? – Pygmalion Mar 13 '17 at 17:15
  • @Pygmalion That would not be bad, but difficult to implement. I tend to something like segmentation at break=true/false, but I have to do it when I have some more time :-) – Thomas F. Sturm Mar 14 '17 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.