4

Good day.

I'd like to add some space after each section. I'm using article class and I've looked in the titlesec package to customize this parameter. I've studied couple of questions and mostly people suggest using this command:

\titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}

In this case I need to modify each parameter which I don't want to do. How do I increase the after-sep proportionally without dealing with other parameters?

Example:

\documentclass[12pt]{article}
\usepackage{lipsum}
\begin{document}

\section{Header}
\lipsum[1]


\subsection{Subheader}
\lipsum[1]

\end{document}

I want to increase the space between title and the paragraph shown in this picture:

latex.jpg

t-my
  • 137

2 Answers2

4

You can directly modify the setting using \@startsection; the relevant lines in article.cls are

% article.cls, line 312:
\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}

The arguments to \@startsection are

  1. name
  2. level
  3. indent
  4. beforeskip (if negative, suppress indentation on the next paragraph)
  5. afterskip (if negative, the title is run in)
  6. setup (commands for typesetting the title)

So you need to modify the afterskip, say

\makeatletter
\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {6ex \@plus 1ex}%
                                   {\normalfont\Large\bfseries}}
\makeatother
egreg
  • 1,121,712
  • So to answer my bottom line question: there isn't a way to proportionally increase only the after-sep. You need to have the original values and hard code them again. – t-my Mar 28 '14 at 08:38
  • 1
    @t-my If the \section command is defined as in the standard classes, one can extract the value of beforeskip and accordingly set the afterskip. But it's really easier looking at the definition. – egreg Mar 28 '14 at 09:36
2

You can substitute the default values for indent and beforeskip (from article.cls as presented by egreg). To suppress indentation on the next paragraph, use starred version of \titlespacing.

\documentclass{article}
\usepackage{titlesec}
\titlespacing{\section}{0pt}{3.5ex plus 1ex minus -.2ex}{6ex plus 1ex}
\begin{document}
  Some text
  \section{First section}
  some text
  \section{Second section}
  some text
\end{document}

enter image description here