How do I change the amount of whitespace between sections in Latex?
Asked Answered
G

2

6

How do I modify the distance between the end of a section and the header of the next section in a Latex document?

Glabella answered 24/8, 2009 at 11:1 Comment(0)
S
8

You can configure the style of section headings, including spacing, using the titlesec package. There's a 'compact' option for simple reduction of space, or you can specify specific values using the more advanced options (see the documentation on the linked page for the gory details).

Squier answered 24/8, 2009 at 11:27 Comment(1)
titlesec looks like a fantastic package.Ullman
M
6

An alternative to titlesec is to redefine the section command, as in the following snippet. Note that beforeskip and afterskip are the variables you're interested in. The code itself is just the first few lines. It's followed by a lengthy comment to remind me of the definitions when I cut and paste the whole thing from one document to another. The code, by the way, is more or less from the indispensable book, The LaTeX Companion, Second Edition.

\makeatletter
 \renewcommand\section{\@startsection {section}{1}{\z@}%
     {-2.5ex \@plus -1ex \@minus -.2ex}%
     {1.3ex \@plus.2ex}%
    {\centering\bfseries}}
% \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE} 
%            optional * [ALTHEADING]{HEADING}
%    Generic command to start a section.  
%    NAME       : e.g., 'subsection'
%    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
%                 section = 2, etc.  A section number will be printed if
%                 and only if LEVEL gt or eq the value of the secnumdepth
%                 counter.
%    INDENT     : Indentation of heading from left margin
%    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 - skip to leave to right of run-in heading.
%    STYLE      : commands to set style
%  If '*' missing, then increments the counter.  If it is present, then
%  there should be no [ALTHEADING] argument.  A sectioning command
%  is normally defined to \@startsection + its first six arguments.
\makeatother
Magalimagallanes answered 30/8, 2009 at 19:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.