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}
Instead of \usepackage[listings]{tcolorbox}, you'd better \usepackage[most]{tcolorbox} to avoid all errors.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
\usepackage[most]{tcolorbox}
\usepackage{empheq}
\tcbuselibrary{theorems}
\newtcbox{\Goldonebox}[1][]{nobeforeafter,math upper,tcbox raise base, enhanced,frame hidden,boxrule=0pt,interior style={top color=Gold1!10!white,
bottom color=Gold1!10!white,middle color=Gold1!50!yellow},
fuzzy halo=1pt with Gold1,#1}
\newtcbox{\greenbox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}
\title{XCOLOR}
\author{MATTIA ONOFRI}
\date{August 2021}
\begin{document}
\maketitle
\Huge
\section{Introduction}
\begin{empheq}[box=\Goldonebox]{align}
a&=b+c\\
E&=mc^2
\end{empheq}
\begin{empheq}[box=\greenbox]{align}
a&=b+c\\
E&=mc^2
\end{empheq}
\textcolor{Gold1}{GOLDEN}.
\end{document}
Best Answer
You can use
underlay
options combined withremember
andframe hidden
.remember
allows to make reference to other frame pictures or usecurrent page
node inoverlay|underlay
additions.frame hidden
avoid spurious lines behind your filled rectangles.Update: How to preserve header?
I don't know how to solve this problem. To my understanding you want that something which is drawn later (colored box) doesn't cover something which is already printed on your page (header). It's possible that
tcolorbox
leaves some information about a broken box which could be used to know that some background must be added to next page before the header is printed. But I don't know how to use it. May be follow up question attracts interest of more smart brains than mine.The best I can do, which looks horrible, is making a hole for header area with
tikzpagenodes
package help.