1

I ran into a problem while writing a math-cheatsheet template. The template should feature a multicolumn setup with very small margins and a few simple theorem environments using the tcolorbox package. I am using the starred multicols environment multicols* with 4 columns in addition to the \raggedcolumns command so that the columns are not forced to equal height.

My problem is, that I get some large (seemingly) random chunks of whitespace. I don't get what could cause something like that. Here is an example:

enter image description here enter image description here

As you can see, there is a large whitespace after the fourth section which I don't want. Additionally, if you look at the second (or fifth) definition, you can see that I have enabled the breakable property for my definition tcbtheorem. There is quite some space after the fourth section header so most of the definition environment should fit.

Here is the code to the screenshot (along with some more blindtext that produces other whitespace chunks):

\documentclass[a4paper,8pt]{extarticle}

\usepackage[landscape,margin=5mm]{geometry}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage[most]{tcolorbox}

\tcbset{
  enhanced,
  breakable,
  frame hidden,
  boxrule=0pt,
  sharp corners,
  detach title,
  fonttitle=\bfseries\sffamily,
  before upper*={\tcbtitle},
  terminator sign colon,
  top=1mm,
  left=0mm,
  right=0mm,
  bottom=1mm,
  coltitle=black,
  colback=gray!10,
  borderline north={0.5pt}{0pt}{black},
  borderline south={0.5pt}{0pt}{black},
}

\newtcbtheorem[]{definition}{Definition}{}{def}

\setlength\parindent{0mm}
\raggedcolumns

\begin{document}  
\begin{multicols*}{4}
  
\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
\end{definition}

\end{multicols*}
\end{document}
2
  • "...there is no automatic breakability for a tcolorbox inside a multicols environment.". See tex.stackexchange.com/a/223398/161015 Jan 24, 2022 at 21:50
  • Thank you! Manually breaking every tcbtheorem environment doesn't seem like a very pleasant experience. Seems like the mdframed package doesn't work as well. Are there any alternatives?
    – gyha4
    Jan 25, 2022 at 9:55

1 Answer 1

2

Just an idea. tcolorbox doesn't break boxes inside a multicolumn environment, but you can construct a narrow document (where tcolorbox can work) and organize resulting pages over another document with pdfpages package.

\documentclass[a4paper,8pt]{extarticle}

\usepackage[paperwidth=74.25mm, paperheight=210mm, margin=5mm]{geometry}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage[most]{tcolorbox}

\tcbset{
  enhanced,
  breakable,
  frame hidden,
  boxrule=0pt,
  sharp corners,
  detach title,
  fonttitle=\bfseries\sffamily,
  before upper*={\tcbtitle},
  terminator sign colon,
  top=1mm,
  left=0mm,
  right=0mm,
  bottom=1mm,
  coltitle=black,
  colback=gray!10,
  borderline north={0.5pt}{0pt}{black},
  borderline south={0.5pt}{0pt}{black},
}

\newtcbtheorem[]{definition}{Definition}{}{def}

\setlength\parindent{0mm}
\raggedcolumns

\begin{document}  
%\begin{multicols*}{4}
  
\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}
\blindtext

\begin{definition}{}{}
  \blindtext
\end{definition}

\blindtext
\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
  \blindtext
\end{definition}

\section{Section}

\blindtext
\blindtext
\blindtext

\section{Section}

\begin{definition}{}{}
  \blindtext
  \blindtext
\end{definition}

%\end{multicols*}
\end{document}

This document produces one column narrow page

enter image description here

If this document is called, let's say 631320.pdf, it's possible to arrange these pages like a multicolum page with

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{pdfpages}

\begin{document}
\includepdf[pages=-,nup=1x4,landscape]{631320}
\end{document}

The result looks like

enter image description here

3
  • Nice! But please add the meaning of 631320. Jan 25, 2022 at 13:10
  • @Simon Dispa. You're right. Now it's explained.
    – Ignasi
    Jan 25, 2022 at 14:33
  • Very interesting and creative idea, thank you very much!
    – gyha4
    Jan 25, 2022 at 22:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .