Depending on the class you are using there are different more or less easy ways.
If you use* KOMA-Script (which is recommended especially for german texts) you can change the disposition
font element:
\documentclass{scrbook}% analogus to book class
\setkomafont{disposition}{\mdseries\rmfamily}
\begin{document}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\end{document}
Otherwise the titlesec
package may helps
\documentclass{book}
\usepackage[md]{titlesec}
\begin{document}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\end{document}
The titlesec
package would work with KOMA-Script too …
* A full working minimal working example (MWE) would have showed the class so I don’t have to guess ;-)
In scrbook
/scrreport
, the skip before/at the end of a chapter is given by
\renewcommand*{\chapterheadstartvskip}{%
\vspace*{2.3\baselineskip}%
}%
\renewcommand*{\chapterheadendvskip}{%
\vspace{1.725\baselineskip
\@plus .115\baselineskip \@minus .192\baselineskip}%
}%
Adjust them to your liking. In terms of \section
s, the KOMA-script bundle still uses \@startsection
(see Where can I find help files or documentation for commands like \@startsection
for LaTeX?). Here's the definition for \section
:
\newcommand\section{%
\@startsection{section}{\sectionnumdepth}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
\setlength{\parfillskip}{\z@ plus 1fil}\fi
\raggedsection\normalfont\sectfont\nobreak\size@section}%
}
Adjust the two rubber lengths (arguments #4
and #5
to \@startsection
) to suit your needs.
Here is a minimal example where the mentioned lengths have been adjusted:
\documentclass[11pt,a4paper,BCOR10mm,DIV11,toc=listof,parskip=full,twocolumn]{scrbook}
\usepackage{etoolbox}
\makeatletter
\renewcommand{\chapterheadstartvskip}{\vspace{0pt}}
\renewcommand{\chapterheadendvskip}{\vspace{\baselineskip}}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\section}{-3.5ex \@plus -1ex \@minus -.2ex}{-\baselineskip}{}{}
\patchcmd{\section}{2.3ex \@plus .2ex}{.5\baselineskip}{}{}
\makeatother
\begin{document}
\raggedright
\chapter{chap1}
\section{sec1}
blaahblah
\section{sec2}
Blah
\chapter{chap2}
BlahBlah
\chapter{chap3}
Blah
\end{document}
Of course the above only references changes to \chapter
and \section
. You'd have to adjust lower-level sectional units in an analogous way. For example, here's an option to remove even more spacing around the sectional units, this time including that of \subsection
:
\usepackage{etoolbox}
\makeatletter
\renewcommand{\chapterheadstartvskip}{\vspace{0pt}}
\renewcommand{\chapterheadendvskip}{\vspace{\baselineskip}}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\section}{-3.5ex \@plus -1ex \@minus -.2ex}{-\z@}{}{}
\patchcmd{\section}{2.3ex \@plus .2ex}{1sp}{}{}
\patchcmd{\subsection}{-3.25ex\@plus -1ex \@minus -.2ex}{-\z@}{}{}
\patchcmd{\subsection}{1.5ex \@plus .2ex}{1sp}{}{}
\patchcmd{\@xsect}{\ignorespaces}{\vspace*{-.5\baselineskip}\ignorespaces}{}{}
\makeatother
Best Answer
Your definition will work for sections and subsections, but not for chapters and has a potential drawback in that you loose control over the optional argument for the sectional units; with your definitions, the optional argument will always be equal to the mandatory argument and that might not be desirable.
Here's one option using the
sectsty
package:And here's now an option using the
titlesec
package:These solution horizontally centers the headings for all sectional units; the packages provides commands to modify the formatting on a per-level basis. Here's the code (using
sectsty
) to apply the change only to chapters, sections and subsections:\end{document}