Text Formattingcolumn balancing with multicol, enumerate, and sections

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

column balancing with multicol, enumerate, and sections

Post by johnjamessmith0 »

The latest object of my frustration. Consider the following code (I hope it's minimal enough):

Code: Select all

\documentclass{article}

\usepackage{enumitem}
	\setlist{nolistsep}
\usepackage{lipsum}
\usepackage{multicol}

\begin{document}

\begin{multicols}{2}
\lipsum[2]
%% A %% \section*{hahaha}
\lipsum[4]
%% B %%\begin{enumerate}
%% B %%	\item
 		\lipsum[2]
%% B %%	\item
 		\lipsum[4]
%% B %%\end{enumerate}
\end{multicols}

\end{document}
Compile...

As is: the output has two perfectly balanced columns, the bottoms of which are impeccably aligned.

Uncommenting comment group A only: perfect alignment again.

Uncommenting comment group B only: perfect.

Uncommenting all comments: the columns are not aligned at the bottom. It is only a very slight bit off, and you probably have to zoom in to see. (In the actual document I'm working on, the difference is rather larger.)

Why doesn't the rubber length in the section header fill the space when there happens to be an enumerate environment later on? I thought it might just be a coincidence that there's no perfect way to align the columns in the last case. But change the section to a subsection. Or add two section headings. In the cases I've tested, the columns consistently align except when there is both a section heading and a list.

Thanks in advance.

EDIT: Tossing out nolistsep makes the alignment work. But I don't think that's a satisfactory solution. Is there a way with enumitem to make the vertical list spacing rubber, perhaps? I apologize if there's something in the packages I missed.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

column balancing with multicol, enumerate, and sections

Post by localghost »

johnjamessmith0 wrote:[…] Tossing out nolistsep makes the alignment work. But I don't think that's a satisfactory solution. Is there a way with enumitem to make the vertical list spacing rubber, perhaps? I apologize if there's something in the packages I missed.
You could set all vertical spaces in a list (\itemsep, \parsep) globally to rubber lengths (e. g. 0pt plus 2pt). The additive part may need some adjustment. The enumitem package allows this global settings in the preamble. Its manual shows you how to do that.

Thorsten
Post Reply