2

I have formatted the titles of chapters, sections etc but I can't get the spacing between their elements equal to each other because as I have seen the command \setlength{\parskip}{10pt} adds to those spaces. Why parskip plays a role in the spacing of the titles? How can I prevent that?

MWE

\documentclass{book}

\usepackage{titlesec}

\titleformat{\chapter}[display]%
{%
    \Huge \centering \bfseries%
}%
{%
    Chapter\\
    \vspace{10pt}
    \thechapter%
}%
{10pt}{}%
[%
    \vspace{20pt}\rule{\textwidth}{1pt}%
]

\setlength{\parskip}{10pt}

\usepackage{fontspec}

\usepackage[english]{babel}

\begin{document}

\chapter{Title}

Text here

\end{document}

1 Answer 1

2

Under the scope of \centering, \\ issues \par, so the \parskip enters in the way. Just say \setlength{\parskip}{0pt}\centering\bfseries. Since the chapter titles are typeset inside a group, the value of \parskip will be restored for normal text.

Or, better, don't change the standard value of \parskip.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .