# Vertical spacing discrepancy with \usepackage{titleps} vs \usepackage[pagestyles]{titlesec}

Edit (context added) In a personal class which makes use of titleps, I'd like to switch to titlesec for its \ifthesection feature. For backward compatibility, there shouldn't be any visual difference. But, as shown by the following MCEs, there is a vertical spacing discrepancy with \usepackage{titleps} vs \usepackage[pagestyles]{titlesec}. The tiny difference in the header is not a big deal but more important is the vertical shift of the text. How to get rid of it?

## MCEs

\documentclass{book}
\usepackage{titleps}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}

\documentclass{book}
\usepackage[pagestyles]{titlesec}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}


## Diff (thanks to diffpdf)

I made a few experiment. Instead of blindtext I used lipsum.

## First file

\documentclass{book}
\usepackage{titleps}
\showoutput
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}


## Second file

\documentclass{book}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\showoutput
\begin{document}
\chapter{Heding on level 0 (chapter)}
\lipsum
\end{document}


## Third file

\documentclass{book}
\usepackage{lipsum}
\showoutput
\begin{document}
\chapter{Heding on level 0 (chapter)}
\lipsum
\end{document}


## Results

There is no difference in output between second and third. There is difference between first and second and the same differences appear between first and third.

## What's happening?

If loaded alone, titleps patches \chapter and the other sectional titles. This is not needed if it is loaded along titlesec. This leads to small differences in how the chapter header is typeset.

• The differences in how the chapter header is typeset are indeed small. But more annoying is the vertical shift of the following text. – Denis Bitouzé Jun 10 '20 at 16:00
• @DenisBitouzé I guess some “whatsit” enters the scene when the title has more than one line. – egreg Jun 10 '20 at 16:14