9

The following code gives me some space above the chapter title, that I'd like to avoid:

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\titleformat{\chapter}[frame]
  {}
  {\thechapter}
  {0pt}
  {}
\titlespacing*{\chapter}{0cm}{0pt}{0pt}[0pt]


\begin{document}
\chapter{Chapter Title}

Fancy text.

\end{document}

See this image:

enter image description here

The ellipse (added afterwards) is above the chapter title, but within the text area.

When I do the same with section instead of chapter, everything is fine:

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\titleformat{\section}[hang]
  {}
  {\thesection}
  {0pt}
  {}
\titlespacing*{\section}{0cm}{0pt}{0pt}[0pt]

\begin{document}
\section{Section Title}

Fancy text.

\end{document}

section with titlesec

What makes \chapter so special in this respect? Is there a way to avoid the space above the chapter title with the package titlesec?

  • I remember having seen a similar question before and I think that egreg answered it; let me see if I can find it. – Gonzalo Medina Sep 4 '12 at 20:08
  • 3
    @GonzaloMedina We just have to look through all of egreg's answers :-)) – topskip Sep 4 '12 at 20:10
  • tex.stackexchange.com/a/63393/4427 – egreg Sep 4 '12 at 20:13
  • The given (linked question) solution does not work for me. – topskip Sep 5 '12 at 8:33
4

When I go back the amount of \topskip, everything is fine:

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage{titlesec}

% \topskip 50pt

\titleformat{\chapter}[frame]{}{\thechapter}{0pt}{}
\titlespacing*{\chapter}{0cm}{-\topskip}{0pt}[0pt]

\begin{document}
\chapter{Chapter Title}

Fancy text.

\end{document}

The {-50pt}{40pt} in the linked answer ( https://tex.stackexchange.com/a/63393 ) are not the correct values for the question above.

enter image description here

  • Your question uses style frame, while the answer has hang. – egreg Sep 5 '12 at 10:39
  • @egreg fixed, thanks. Results are the same. – topskip Sep 5 '12 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.