Page LayoutUnsightly vertical spacing in multicols environment

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Telofy
Posts: 8
Joined: Sat Jul 17, 2010 11:46 pm

Unsightly vertical spacing in multicols environment

Post by Telofy »

Hecko everyone,

The multicols environment sets \parskip to “0.0pt plus 1.0pt” (not sure what that means), which looks ugly when used in combination with paragraph indention. Unfortunately, when I set it back to zero points, the lines in the two columns are no longer—necessarily—level. (Usually, I use \raggedbottom to assure this, but in this case it has no effect; neither has \raggedcolumns.) Whenever there is a section heading, or something of the sort, in one column, it disturbs the balance between the lines on both sides.

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{multicol}
\frenchspacing % ignore this line
\setlength{\parskip}{0pt}
\title{Fnords}
\author{Telofy}
\date{\today}
\begin{document}
\maketitle
\begin{multicols}{2}
\lipsum[1]
\section*{Foobar}
\lipsum[2-8]
\end{multicols}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
You can see what I mean on the first page below the height of “Foobar”.

Thanks in advance,
Telofy

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Unsightly vertical spacing in multicols environment

Post by localghost »

Telofy wrote:[...] The multicols environment sets \parskip to “0.0pt plus 1.0pt” (not sure what that means), which looks ugly when used in combination with paragraph indention. [...]
Who told you so? This is the default value.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\begin{document}
\the\parskip
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And your setting only relocates the problem.

At the moment I'm not aware of a method to correct that.


Thorsten
Telofy
Posts: 8
Joined: Sat Jul 17, 2010 11:46 pm

Re: Unsightly vertical spacing in multicols environment

Post by Telofy »

Thanks for your response. Quite true, it is the default value. The space between paragraphs, however, is luckily not the default. Perhaps I’ve compensated another vertical space by setting \parskip to zero. I guess it’s time to start reading the source.

Update:
If I leave \parskip as it is, \raggedcolumns fixes the space between paragraphs, but the lines are still not level. Is it perhaps a problem with the \section? Perhaps the space it consumes is not an exact multiple of the line height. If so, is there a way to fix that?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Unsightly vertical spacing in multicols environment

Post by localghost »

Telofy wrote:[...] Is it perhaps a problem with the \section? Perhaps the space it consumes is not an exact multiple of the line height. If so, is there a way to fix that?
That is a probable cause. You can try to adjust that by means of the titlesec package. It allows to customize the space around headings.
Telofy
Posts: 8
Joined: Sat Jul 17, 2010 11:46 pm

Unsightly vertical spacing in multicols environment

Post by Telofy »

I have experimented a little with that package, but I have trouble calculating the right heights. Assuming that the \section title is \Large, I wanted to leave one normal \baselineskip of room below the heading and three such \baselineskips minus the \baselineskip of the \Large line above.

After some research I’ve gotten thus far:

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{multicol}
\makeatletter
\newdimen\dimLargebls
\newdimen\dimLargesize
{\Large\dimLargebls=\f@baselineskip}
{\Large\dimLargesize=\f@size pt}
\newlength\lenLargebls
\newlength\lenLargesize
{\Large\setlength{\lenLargebls}{\f@baselineskip}}
{\Large\setlength{\dimLargesize}{\f@size pt}}
\makeatother
\frenchspacing % ignore this line
\setlength{\parskip}{0pt}
\raggedcolumns
\title{Fnords}
\author{Telofy}
\date{\today}
\begin{document}
\maketitle
\begin{multicols}{2}
\the\dimLargebls,
\the\dimLargesize
\the\lenLargebls,
\the\lenLargesize
\lipsum[1]
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Unfortunately, whatever I try, the saved value remains zero—or 0.0pt. :-(

I’m unable to find any documentation on these commands (\newdimen and the likes), but somehow thousands of people just magically know how to use them and create terrific styles and packages with them. Hmm.
Telofy
Posts: 8
Joined: Sat Jul 17, 2010 11:46 pm

Unsightly vertical spacing in multicols environment

Post by Telofy »

The main issue in the last post was only a namespace problem. This is my current version:

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{multicol}
\usepackage{titlesec}
\newlength\sectionBLS
\usekomafont{section}
\setlength{\sectionBLS}{\baselineskip}
\normalfont\normalsize
\newlength\spaceBelow
\spaceBelow=2\baselineskip
\advance\spaceBelow-\sectionBLS
\titlespacing*{\section}{0pt}{2\baselineskip}{\spaceBelow}
\frenchspacing % ignore this line
\setlength{\parskip}{0pt}
\raggedcolumns
\title{Fnords}
\author{Telofy}
\date{\today}
\begin{document}
\maketitle
\begin{multicols}{2}
\lipsum[1]
\section{Foobar}
\lipsum[2-8]
\end{multicols}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Unfortunately, it only works (i.e., happens to work) for 11 pt, and I have no idea why. Interestingly, even if I scrap all the titlesec manipulation and use \setkomafont{section}{\normalfont\normalsize}, it still only fits for 11 pt, as if there were some other length involved that I don’t know about and that just incidentally is zero with an 11 pt font.

I’m also open for any radically different approaches. Until then I’ll have to break the columns for every heading and probably rewrite shorter sections.

Thanks,
Telofy
Post Reply