[Tex/LaTex] Spacing after KOMA-Script \section in multicol environment

koma-scriptsectioningspacing

I'm writing a two column paper using the KOMA-Script scrartcl class and the multicol package. However, I start with a one column header, title and nomenclature section which take up most of my first page. In my MWE, this space is taken by the \rule:

\documentclass[parskip=half]{scrartcl}

\usepackage{lipsum}
\usepackage{multicol}
\usepackage{bera}
\usepackage[charter]{mathdesign}

\RedeclareSectionCommand[
  afterskip=1ex]{section}

\begin{document}

\rule{\textwidth}{15cm}
\begin{multicols}{2}
\section*{Section 1}
\lipsum[1-2]

\end{multicols}
\end{document}

As you can see, the paragraph is divided in a very unfortunate way, only the last line is pushed to the next page. At the same time, the white space after "Section 1" is very large, even though I have defined the value of afterskip to only 1ex, which according to KOMA-Script documentation is the "official" way to deal with white space after section titles. The actually applied space is clearly larger than 1ex.

If I reduce the value even further (say to <0.1ex), at some point the first line of the paragraph "jumps" up and I get the desired behavior. But this is dependent on the fonts used and does not work for my preferred fonts.

I assume it is all just LaTeX' algorithm adjusting the white spaces to its criteria, but in this case it seems to make no sense.

UPDATE:
I have updated my MWE to include my fonts (Bera sans for sans, Charter for text body) since the problem seems to be font dependent.
In this updated case, even setting afterskip=1sp and \raggedcolumn doesn't help. I also feel a little bad about just setting afterskip to the smallest possible number, since I don't want to effect all of my section titles. Is it really all just latex fumbling with the vertical spaces, or is there another parameter involved?

Best Answer

The parskip=half option results in additional space after a section heading. So you have to use afterskip=1sp together with parskip=half.

\documentclass[
  parskip=half% inserts additional space after \section
]{scrartcl}

\usepackage{lipsum}
\usepackage{multicol}

\RedeclareSectionCommand[
  afterskip=1sp]{section}

\begin{document}

\rule{\textwidth}{15cm}
\begin{multicols}{2}
\section*{Section 1}
\lipsum[1-2]
\end{multicols}
\end{document}

enter image description here


In addition the \flushcolumns command (used by the multicolumns environment) may also insert additional white space. Thats why there is still a distance when I remove the parskip=half option:

enter image description here


To avoid this you can use \raggedcolumns.

enter image description here

Code:

\documentclass[
  %parskip=half% inserts additional space after \section
]{scrartcl}

\usepackage{lipsum}
\usepackage{multicol}

\RedeclareSectionCommand[
  afterskip=1sp]{section}

\begin{document}

\noindent%< added
\rule{\textwidth}{15cm}
\begin{multicols}{2}
\raggedcolumns% <- added
\section*{Section 1}
\lipsum[1-2]
\end{multicols}
\end{document}

Update: You can change the afterskip for sections only inside the multicols Environment. And maybe you can use there a parindent instead the parskip.

\documentclass[parskip=half]{scrartcl}

\usepackage{lipsum}
\usepackage{multicol}
\usepackage{bera}
\usepackage[charter]{mathdesign}

%\RedeclareSectionCommand[afterskip=1ex]{section}

\usepackage{etoolbox}
\AtBeginEnvironment{multicols}{%
  \raggedcolumns%
  \RedeclareSectionCommand[afterskip=1sp]{section}%
  \KOMAoptions{parskip=false}%
}

\begin{document}
\rule{\textwidth}{15cm}
\begin{multicols}{2}
\section*{Section 1}
\lipsum[1-2]
\end{multicols}
\section*{Section 2}
\lipsum
\end{document}

enter image description here

Or you can use parskip=full inside multicols

\AtBeginEnvironment{multicols}{%
  \raggedcolumns%
  \RedeclareSectionCommand[afterskip=1sp]{section}%
  \KOMAoptions{parskip=full}%
}

enter image description here