[Tex/LaTex] Multicols inside Tcolorbox breaks page before long Multicols (and doesn’t listen to pageheight)


As can be shown when compiling the following MWE, the page-height (2inch) allows for 11 lines of text per page (cf. page 1), since Twelfth line and Thirteenth line are sent to page 2.

After those thirteen lines, I introduce another thirteen lines of text, but which are inside a Multicols environment.

  1. Explanation of title: Multicols inside Tcolorbox breaks page before long Multicols

The annoying thing is that the Multicol-lines are not added immediately after the previous lines (i.e. First line (inside multicols) doesn't start after Thirteenth line, but instead is sent to the next page because the Multicol is "too long" to fit on the same page).

  1. Explanation of title: Multicols inside Tcolorbox doesn't listen to pageheight

Then, one can notice that the lines inside the Tcolorbox actually don't break after 11 lines, but go well beyond that (cf. the lines overflowing on page 3).

Note: I suppose that these behavior are not specifically related to the Tcolorbox (but are instead endemic to Multicols). Anyway, the MWE shows how I figured out the issue, and at the same time the Tcolorbox can clarify some things visually (e.g. page-height).


\usepackage[a4paper, total={7in, 2in}]{geometry}


First line\\
Second line\\
Third line\\
Fourth line\\ 
Fifth line\\
Sixth line\\
Seventh line\\
Eighth line\\
Tenth line\\
Eleventh line\\
Twelfth line\\
Thirteenth line\\


First line (inside multicol)\\
Second line (inside multicol)\\
Third line (inside multicol)\\
Fourth line (inside multicol)\\
Fifth line (inside multicol)\\
Sixth line (inside multicol)\\
Seventh line (inside multicol)\\
Eighth line (inside multicol)\\
Tenth line (inside multicol)\\
Eleventh line (inside multicol)\\
Twelfth line (inside multicol)\\
Thirteenth line (inside multicol)\\ \columnbreak

Next to first line (inside multicol)\\
Next to second line (inside multicol)\\
Next to third line (inside multicol)\\
Next to fourth line (inside multicol)\\
Next to fifth line (inside multicol)\\
Next to sixth line (inside multicol)\\
Next to seventh line (inside multicol)\\
Next to eighth line (inside multicol)\\
Next to tenth line (inside multicol)\\
Next to eleventh line (inside multicol)\\
Next to  twelfth line (inside multicol)\\
Next to thirteenth line (inside multicol)\\ 




Best Answer

since you want manual control over the lines anyway, I'd just do


\usepackage[a4paper, total={7in, 2in}]{geometry}


First line (inside multicol)}{%
Next to first line (inside multicol)}

Second line (inside multicol)}{%
Next to second line (inside multicol)}

Third line (inside multicol)}{%
Next to third line (inside multicol)}

Fourth line (inside multicol)}{%
Next to fourth line (inside multicol)}

Fifth line (inside multicol)}{%
Next to fifth line (inside multicol)}

Sixth line (inside multicol)}{%
Next to sixth line (inside multicol)}

Seventh line (inside multicol)}{%
Next to seventh line (inside multicol)}

Eighth line (inside multicol)}{%
Next to eighth line (inside multicol)}

Tenth line (inside multicol)}{%
Next to tenth line (inside multicol)}

Eleventh line (inside multicol)}{%
Next to eleventh line (inside multicol)}

Twelfth line (inside multicol)}{%
Next to  twelfth line (inside multicol)}

Thirteenth line (inside multicol)}{%
Next to thirteenth line (inside multicol)}