How we give a vertical gap of 25 mm between the Chapter number (#) and chapter
title lines and between chapter title line and the first paragraph.
[Tex/LaTex] Vertical space between Chapter # and Chapter title
spacing
Related Solutions
The titlesec
package provides
\titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}[<right>]
that allows for the spacing around any sectional <command>
(like \part
, \chapter
, \section
, etc.). The former two sectional commands require the additional \titleformat
to be used (see the package documentation). Consequently, altering <after-sep>
should suit your needs.
The following minimal example, altered for <after-sep>
equal to \parskip
, 5\baselineskip
and 150pt
illustrates the changes (from left to right):
\documentclass{scrreprt}
\usepackage{titlesec}% http://ctan.org/pkg/titlesec
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\titleformat{\chapter}{\Huge\bfseries}{\chaptername\ \thechapter}{0pt}{\vskip 20pt\raggedright}%
% Alter <after-sep> in the macro below to vary the separation after the \chapter title.
\titlespacing{\chapter}{0pt}{50pt}{<after-sep>}% \titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}[<right>]
\begin{document}
\chapter{First chapter}
\lipsum[1-5]
\end{document}
The lipsum
package merely provides some dummy text, Lorem Ipsum style.
book
(like report
) sets the ToC entry for a chapter using \l@chapter
. This is what it looks like:
\newcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
The specific thing to note here is the value of \@tempdima
, set to 1.5em
. The first argument of \l@chapter
(or #1
) uses \numberline
, which is defined in the kernel latex.ltx
as:
\def\numberline#1{\hb@xt@\@tempdima{#1\hfil}}
creating a box of width \@tempdima
and left-aligning its contents. Note that this 1.5em
is based on the prevailing font at the time of setting (\normalsize\bfseries
by default).
The (numbered) chapter head in book
(and report
) is set via the macro \@makechapterhead
. Here's a take on that:
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
The space between the word Chapter
(or \@chapapp
in the definition above) and the number (\thechapter
in the definition above) is a regular \space
or \
.
In both instances, if you want to change these defaults, you have at least 3 options:
Use a package that allows you to modify this content (like
titlesec
ortocloft
or the like);Copy the entire definition and change it to your liking (making
\newcommand
->\renewcommand
);Use
etoolbox
to patch the command. For example,\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox \makeatletter \patchcmd{\l@chapter}% <cmd> {1.5em}% <search> {5.5em}% <replace> {}{}% <success><failure> \makeatother
would use a
5.5em
wide box for setting the chapter number in the ToC, increasing the gap between the number and title. Also\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox \makeatletter \patchcmd{\@makechapterhead}% <cmd> {\space}% <search> {\hspace*{100pt}\ignorespaces}% <replace> {}{}% <success><failure> \makeatother
would insert a
100pt
gap between the wordChapter
(or whatever\@chapapp
is) and the number.\ignorespaces
would just remove any trailing spaces left inside the original definition of\@makechapterhead
.
Best Answer
Building on Space length between the chapter number and the chapter title, the spaces you're after are given in
\@makechapterhead
for\chapter
(and\@makeschapterhead
for\chapter*
). The following definition(s) are taken fromreport.cls
:These values can be patched/altered using
etoolbox
: