3

Using the \part command for the first time with the \documentclass book, I realized that the title of the part was not centered vertically and was higher on the page than it "should" be. With this MWE, I have a vertical space of about 60 mm at the top of the page and 113 mm at the bottom, i.e. almost double.

enter image description here

\documentclass{book}

\usepackage[showframe]{geometry}
\setlength\topskip{0pt}

\begin{document}

\part{My first part}

\end{document}

After looking at their definition, the \part and \@endpart commands can be mimicked (as far as vertical alignment is concerned) with this simple MWE below.

enter image description here

\documentclass{book}

\usepackage[showframe]{geometry}
\setlength\topskip{0pt}

\begin{document}

\null\vfil
A\par
\vskip 20pt
A\par
\vfil

\end{document}

Why isn't the part title vertically centered? What elements "push" the title to the top of the page?

I realised that if I replaced the \vfil with \vfill, which is "stronger" than \vfil, I got a title that was vertically centered on the page (image and MWE below). Why isn't this the default behaviour?

enter image description here

\documentclass{book}

\usepackage[showframe]{geometry}
\setlength\topskip{0pt}

\begin{document}

\null\vfill
A\par
\vskip 20pt
A\par
\vfill

\end{document}
4
  • 1
    Why questions are always hard to answer for anybody but the author of the code, but from a composition point of view, elements look often more interesting and harmonic if they are not in the centre. For a written document, you will have the additional effect, that your readers start from the top of the page. Having to go all the way down to the centre of the page, will feel like a very long way. Feb 11 at 20:56
  • 1
  • @samcarter_is_at_topanswers.xyz I apologise if my question wasn't very clear, but it was more about why \null\vfil ... some text ... \vfil doesn't centre the content vertically as you'd intuitively expect by default. But something is "pushing" the title up the page.
    – B Legrand
    Feb 11 at 21:31
  • 1
    Ah, I thought you had asked about the design :) Feb 11 at 21:46

1 Answer 1

6

The part page is forced with a forced pagebreak, in your example by \end{document} which does \clearpage which does \newpage.

newpage is

\def \newpage {%
  \if@noskipsec
    \ifx \@nodocument\relax
      \leavevmode
      \global \@noskipsecfalse
    \fi
  \fi
  \if@inlabel
    \leavevmode
    \global \@inlabelfalse
  \fi
  \if@nobreak \@nobreakfalse \everypar{}\fi
  \par
  \ifdim\prevdepth>\z@
     \vskip -%
       \ifdim\prevdepth>\maxdepth
         \maxdepth
       \else
         \prevdepth
       \fi
  \fi
  \vfil
  \penalty -\@M}

so it adds \vfil to allow the forced page to be short.

Thus your example has one \vfil above the text and two below it, so is placed a third of the way down the page.

This isn't explicitly documented in the standard classes (most design decisions in those classes are not) but it appears to be by design.

1
  • 1
    Should we ask Leslie? ;)
    – Joseph Wright
    Feb 11 at 21:52

You must log in to answer this question.

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