in my article template a part of the text is set in twocolumn mode. I'm using multicol package with the starred environment (to fill up one column after antoher).
The twocolumn article part consists of different sections of which some can be very short. E.g. the \listoffigues and the author names and adresses shall be printed there.
Since most of the content is predefined in the praeambel or within the structure of the article, be it through the number of figures used or the number of authors of an article, I want to automate the typesetting process.
Therefore, i need following behaviour:
- If the content of the first section (let say the list of figures) is only a few lines, maximum up to the middle of the page, the following section should be placed directly afterwards in the same column. (first page of image below)
- But if the content of the first section stretches over the middle of the page, the following section should start at the next column. (second page of image below)
Of course, if I typeset any article individual I can get this result in inserting a \newcolumn after the each short section manually.
But I would like to automise this step. Is there a possibility to create, for example, an if-condition which says something like:
if "previous section" starts at topline and is shorter than \textheight; then
insert \newcolumn
I would prefer an expl3 solution and have already skimmed over the interface3 manual, but, so far, couldn't find a fitting solution. This may be due to my lack of experience with Latex if-conditions and expl3. But I'm very willing to learn.
Here my MWE:
\documentclass[%
twoside,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{noto}
\usepackage{geometry}
\geometry{%
inner=20mm,
outer=60mm,
top=15mm,
bottom=20mm,
marginparwidth=40.5mm,
marginparsep=4.5mm,
showframe % to show the margins
}
\usepackage{multicol}
% Put a line in the middle of text height for testing
\usepackage{atbegshi,picture}
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\put(0,\dimexpr-\topmargin-1in %
-\headheight-\headsep
-.5\textheight\relax){%
\line(1,0){\paperwidth}%
}%
}%
}
\usepackage{blindtext}
\begin{document}
\section{Section}
\blindtext[5]
\newpage
\begin{multicols*}{2}
\section{Section}
\blindtext[2]
\section{Section}
\blindtext[3]
\newpage
\section{Section}
\blindtext[1]
\section{Section}
\blindtext[2]
\newpage
\section{Section}
\blindtext[2]
\newcolumn
\section{Section}
\blindtext[2]
\end{multicols*}
\end{document}
Thanks
