9

My MWE,

\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=,height fixed for=none,left=0mm,right=0mm,bottom=0mm,top=0mm,colback=red!5!white,colframe=red!75!black,enforce breakable,pad at break=1mm,break at=5cm/0cm]
\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_{Ç}=V_G \cdot \frac{1}{5}=\frac{250}{5}=50\;V\!olt\nonumber}\\ \equat{V_D=V_{Ç} \cdot \sqrt{2}=50\sqrt{2}=70{,}71\;V\!olt\nonumber}}{\B}

\end{multicols}
\end{document}

And some outputs

enter image description here -> big space in left


enter image description here and enter image description here-> It can a little up


It's problem seems to break at=5cm/0cm. But I couldn't solve.

Sorry for my not good English.


@Thomas F. Sturm, your code is displaying at my computer,

enter image description hereenter image description hereenter image description here

  • You know the name of the drill: Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jan 16 '15 at 1:33
  • You either use a twocolumn or a multicol setup? – user31729 Jan 16 '15 at 1:34
  • I will attempt to add MWE. – Özgür Jan 16 '15 at 1:39
  • I added MWE.... – Özgür Jan 16 '15 at 2:03
  • Try height fixed for=all – user11232 Jan 16 '15 at 3:02
5

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:

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

  • @Thomas_F._Sturm, I added new picture. – Özgür Jan 16 '15 at 7:46
  • @Özgür I have to stress out again that manual break points and (maybe) visual polishments have to be made individual for every box since there is no automatic breakability. You cannot the parameters of this single example for your whole text - sorry, there is no automatism inside a multicols environment. – Thomas F. Sturm Jan 16 '15 at 8:00
  • 1
    @Thomas_F._Sturm, Thanks for your help, I want to host you if you arrived İzmir in Turkey. – Özgür Jan 16 '15 at 8:02
  • 1
    @Özgür That's very kind of you to say :-) – Thomas F. Sturm Jan 16 '15 at 8:46
1

I found answer that I want; twocolumn.

\documentclass[a4paper,twocolumn,12pt]{book}
...

It is perfect working for me (tcolorbox and mdframed). Indeed, it is not working inside multicols environment. Thanks for guiding @Thomas F. Sturm and @Christian Hupfer.

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.