12

There are already several questions dealing with the extra vertical space after section headings that result from setting \parskip to a non-zero value.

Here, I just want to understand why extra space is added before normal paragraphs but not before lists. (I think this is a legitimate question and not a duplicate.)

As it can be seen in the picture below, there is extra space when the section starts with some text:

No parskip (left) vs parskip (right), paragraph

Yet no extra space when the section starts with an itemize:

No parskip (left) vs parskip (right), itemize

Here is the code I used:

\documentclass[11pt]{article}

\parskip=\smallskipamount

\usepackage{enumitem}

\newlist{compactlist}{itemize}{3}
\setlist[compactlist]{%
  label=\enskip\textbullet,
  partopsep=0pt,
  topsep=0pt,
  parsep=0pt,
}

\usepackage{blindtext}

\begin{document}
\section{Parskip}
%% \blindtext
\begin{compactlist}
  \item \blindtext
\end{compactlist}

\end{document}
  • 1
    The solution is simple: never set a nonzero parskip. ;-) – egreg Sep 8 '13 at 12:30
11

\parskip is a TeX primitive which gets set to various values in LaTeX constructs, so setting it directly at the start of the document has a defined effect but possibly not as expected. In particular LaTeX lists manipulate \parskip to control the spacing before the list and between items, in particular before a list it is reset to values depending on \partopsep and \topsep.

5

At last I figured out what is going on by looking at LaTeX's source code.

When a regular paragraph follows a section heading, the vertical space between the heading and the first line of the paragraph is AFTERSKIP + \parskip, where AFTERSKIP is a skip hard-coded in the document classes. It can be changed by re-defining the sectioning macros \section, \subsection, and so on.

However, when a list construct (including environments such as center, flushleft, flushright) is the first thing after a section heading, the vertical spacing is different. The sectioning commands add AFTERSKIP as usual, and then the first \item command in the list adds \parskip - \parsep, but it does so with \addvspace, which may have puzzling results.

For the actual space added by \addvspace also depends on the value of \lastskip (in this case AFTERSKIP). For instance, if \parskip - \parsep is less than or equal to AFTERSKIP, then \addvspace will add nothing. If \parskip - \parsep is greater than AFTERSKIP, then \addvspace will add the space, but it will remove AFTERSKIP! In conlusion, the vertical space that is inserted between a section heading and a list construct depends on these 3 parameters - AFTERSKIP, \parskip and \parsep - and the rules of \addvspace for adding vertical space.

  • 1
    The ! above appears to indicate surprise, but the description you give is the intended behaviour: \advspace adds the maximum value of the specified skip and the previous skip so that if two display constructs follow each other you do not get both the below-skip of the first and the above-skip of the second, you just get the maximum of those values. – David Carlisle Sep 16 '13 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.