# reducing space before and after sub-headings

How can I reduce the space between \subsection and its following text, and also with \subsubsection. Currently it has a 2-line space above, and a 3-line space before and after the two headers. I am using \documentclass{scrreprt} and \usepackage{savetrees}.

\documentclass{scrreprt}
\usepackage{savetrees}
\usepackage{lipsum}

\begin{document}

\subsection{Indications}

\subsubsection{Prices}

\end{document}


The scrreport document class defines the macros \subsection and \subsubsection by invoking the LaTeX kernel command \@startsection with the following settings:

\newcommand\subsection{%
\@startsection{subsection}{\subsectionnumdepth}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
\setlength{\parfillskip}{\z@ plus 1fil}\fi
\raggedsection\normalfont\sectfont\nobreak\size@subsection
}%
}
\newcommand\subsubsection{%
\@startsection{subsubsection}{\subsubsectionnumdepth}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
\setlength{\parfillskip}{\z@ plus 1fil}\fi
\raggedsection\normalfont\sectfont\nobreak\size@subsubsection
}%
}


The fifth argument of \@startsection -- in both cases, {1.5ex \@plus .2ex} -- controls the amount of vertical space below the sectioning header. To reduce this amount by a half, i.e., to {0.75ex \@plus .1ex}, you could load the etoolbox package and use its \patchcmd macro as follows (insert the code in the preamble):

\usepackage{etoolbox}
\makeatletter
\patchcmd{\subsection}{1.5ex \@plus .2ex}{0.75ex \@plus 0.1ex}{}{}
\patchcmd{\subsubsection}{1.5ex \@plus .2ex}{0.75ex \@plus 0.1ex}{}{}
\makeatother


If you also need to reduce the space above subsection and subsection headers, you can do so by using \patchcmd to alter the fourth argument of the respective \@startsection commands.

A final observation: Since you're also using the savetrees package, you need to load that package with option sections=normal in order to let the code above have an effect. (Without this option, the savetrees package invokes the titlesec package to modify the spacing around sectioning headers, leading the code above to do nothing.)

• Thanks @Mico. With your code in place I am consistently getting errors for each and every \subsection and \subsubsection like this - [12] ! Illegal unit of measure (pt inserted). <to be read again> ! l.250 \subsection*{Adverse Reactions} ? Sep 8, 2014 at 8:21
• Sorry for the noise, uncommented left-over code was stopping it from running properly. It is now running with zero problems at all. Thanks. Sep 8, 2014 at 11:07