Vertical spacing between sections

1,047

The solution depends on the document class. Usually \section is defined \@startsection that is defined in the LaTeX kernel. The article class defines \section the following way:

\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}

source2e documents the options for the 4th and 5th argument of \@startsection that controls the spaces before and after the section title:

\@startsection{⟨name⟩}{⟨level⟩}{⟨indent⟩}{⟨beforeskip⟩}{⟨afterskip⟩}{⟨style⟩}*[⟨altheading⟩]{⟨heading⟩}

beforeskip: Absolute value = skip to leave above the heading. If negative, then paragraph indent of text following heading is suppressed.

afterskip: if positive, then skip to leave below heading, else negative of skip to leave to right of run-in heading.

Example that redefines \section with doubled spaces:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\section{Section A}
\lipsum[2]
\section{Section B}
\lipsum[2]

\makeatletter
\renewcommand*{\section}{%
\@startsection {section}{1}{\z@}%
  {-7ex \@plus -3ex \@minus -.4ex}%
  {4.6ex \@plus.4ex}%
  {\normalfont\Large\bfseries}%
}
\makeatother
\section{New Section C}
\lipsum[2]
\section{New Section D}
\lipsum[2]
\end{document}

Result

Share:
1,047

Related videos on Youtube

user47812
Author by

user47812

Updated on March 19, 2020

Comments

  • user47812
    user47812 over 3 years

    I would like to know how I can define the vertical space between:

    • a previous section and the new section title;
    • the new section title and the following text.

    Now it looks like both space measure the same.

  • Yigit Alparslan
    Yigit Alparslan almost 3 years
    How do you make the section header single-spaced if it spans multiple lines?
  • Heiko Oberdiek
    Heiko Oberdiek almost 3 years
    @YigitAlparslan This is a different topic for a new question (with example, since the answer will probably depend on the class).