First, it is important to emphasize that there is no automatic breakability for a tcolorbox
inside a multicols
environment. There is only the possibility to insert manual break points using the break at
option. This also means that these break points have to be manually readjusted if new material is inserted before such a box. I intended this feature for short multicols
environments. If many pages of material are used as your screenshots show, you will have a lot of manual adjustment.
To insert these manual break points, one has to use the break at
option. Here is there relevant passage from the manual:
Now, your MWE uses:
break at=5cm/0cm
This results in a first break point at 5cm
. All following break points are set to \textheight
. This gives the expected output:
For this MWE, one would try to balance the columns manually by testing appropriate length values. Here, the following looks not bad:
break at=8cm
This sets all break points at 8cm
. The complete source is:
\documentclass[a4paper,twoside,openany,12pt]{book}
\usepackage[left=1cm,right=1cm,top=2.5cm,bottom=2.5cm,marginparwidth=0cm,marginparsep=0cm,outer=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage[listings,skins,breakable]{tcolorbox}
\usepackage{empheq}
\newcommand\B{Correct answer is \textbf{B} choice.}
\definecolor{formulzemin}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formulzemin}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\equat}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\newcommand{\kutu}[2]{\begin{tcolorbox}[enhanced jigsaw,breakable,
title after break=,
left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,
%enforce breakable,% <-- never use this
break at=8cm,
pad at break=1mm,
]\textit{{#1}
\begin{flushright}
{#2}
\end{flushright}}
\end{tcolorbox}}
\begin{document}
\begin{multicols}{2}
\kutu{A circuit element whose electrical characteristic is primarily resistive
is called a resistor and is represented by the symbol shown in Fig. 2.1a. A
resistor is a physical device that can be purchased in certain standard values
in an electronic parts store. These resistors, which find use in a variety of
electrical applications, are normally carbon composition or wire- wound. In
addition, resistors can be fabricated using thick oxide or thin metal films for
use in hybrid circuits, or they can be diffused in semiconductor integrated
circuits. Some typical discrete resistors are shown in Fig. 2.1b. 5$:$1As the
resistance is decreased and becomes smaller and smaller, we finally reach a
point where the resistance is zero and the circuit is reduced to that shown in
Fig. 2.3b; that is, the resistance can be replaced by a short circuit. On the
other hand, if the resistance is increased and becomes larger and arger, we
finally reach a point where it is essentially infinite and the resistance can be
replaced by an open circuit, as shown in Fig.~2.3c. Note that n the case of a
short circuit where \equat{V_{C}=V_G \cdot
\frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{C} \cdot
\sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}
\end{multicols}
\end{document}
The output is:
Finally, we can do some polishment by adding
height fixed for=all
This will set the height values of both box parts to the target value of 8cm
. The complete code is:
\documentclass[a4paper,twoside,openany,12pt]{book}
\usepackage[left=1cm,right=1cm,top=2.5cm,bottom=2.5cm,marginparwidth=0cm,marginparsep=0cm,outer=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[turkish]{babel}
\usepackage{multicol}
\usepackage[listings,skins,breakable]{tcolorbox}
\usepackage{empheq}
\newcommand\B{Correct answer is \textbf{B} choice.}
\definecolor{formulzemin}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{formulzemin}{\hspace{1em}#1\hspace{1em}}}
\newcommand{\equat}[1]{\begin{empheq}[box=\mybox]{align}{#1}\end{empheq}}
\newcommand{\kutu}[2]{\begin{tcolorbox}[enhanced jigsaw,breakable,
title after break=,
left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,
%enforce breakable,% <-- never use this
break at=8cm,
height fixed for=all,
pad at break=1mm,
]\textit{{#1}
\begin{flushright}
{#2}
\end{flushright}}
\end{tcolorbox}}
\begin{document}
\begin{multicols}{2}
\kutu{A circuit element whose electrical characteristic is primarily resistive
is called a resistor and is represented by the symbol shown in Fig. 2.1a. A
resistor is a physical device that can be purchased in certain standard values
in an electronic parts store. These resistors, which find use in a variety of
electrical applications, are normally carbon composition or wire- wound. In
addition, resistors can be fabricated using thick oxide or thin metal films for
use in hybrid circuits, or they can be diffused in semiconductor integrated
circuits. Some typical discrete resistors are shown in Fig. 2.1b. 5$:$1As the
resistance is decreased and becomes smaller and smaller, we finally reach a
point where the resistance is zero and the circuit is reduced to that shown in
Fig. 2.3b; that is, the resistance can be replaced by a short circuit. On the
other hand, if the resistance is increased and becomes larger and arger, we
finally reach a point where it is essentially infinite and the resistance can be
replaced by an open circuit, as shown in Fig.~2.3c. Note that n the case of a
short circuit where \equat{V_{C}=V_G \cdot
\frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{C} \cdot
\sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}
\end{multicols}
\end{document}
And the output is:
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}
Best Answer
The choice
breakatwhitespace=true
allows line breaks only at white space, while that your line code does not contain white space, just remove your choicebreakatwhitespace=true
Code