[Tex/LaTex] Vertical spacing between sections

sectioningsections-paragraphsspacing

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.

Best Answer

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