0

In my book, I have quite long chapter titles. When using the fancy heads package, this leads to an inconsistent lay out where sometimes the head takes two lines and sometimes only one. I am looking for a way to only use one line tops. This inconsistent behaviour also leads to the following warning.

Package Fancyhdr Warning: \headheight is too small (12.0pt): Make it at least 20.38336pt.

Ideally I would be looking for a solution where a text that is too long is cut off and/or the cut-off words are replaced with ellipsis .... So the goals is to have a single line occupied irrespective of the actual text. Unfortunately, my tex knowledge is extremely limited. I tried changing font size but that just ended up in a cacophony. I am grateful for any suggestions.

Here is a MWE.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{lipsum} 
\usepackage{fancyhdr}

\pagestyle{fancy}

\fancyhead{} \fancyhead[RO]{\slshape \rightmark} %%% R: right; O: odd pages \fancyhead[LE]{\slshape \leftmark} %%% L: left; E: even pages

\renewcommand{\chaptermark}[1]{\markboth{{\scriptsize {\sc Chapter \thechapter\ : #1}}}{#1}} \renewcommand{\sectionmark}[1]{\markright{{\scriptsize {\sc \thesection\ #1}}}}

\begin{document}

\chapter{On the Forgivingness of Hedgehogs during Hunger Winter in 1628 of Our Lord HedgePogger} \lipsum[1-4]

\newpage

\section{For He was a jolly good Hedgehog and His Belly was Full with Glee}

\lipsum[5-8] \end{document}

  • You could manually supply a shortened version of your chapter headers, which will then be used in the page headers. See also: https://tex.stackexchange.com/a/6866/134144 if you don't want this shortened header to appear in the table of contents. – leandriis Jan 17 '21 at 10:17
  • @leandriis That helps, thanks. I'll leave this open because the linked answer does not exactly answer the question itself (automatically shortening). So others can chime in if someone has some inspiration. – Bram Vanroy Jan 17 '21 at 18:20
  • 1
    BTW, if you do want the shortened version in both the TOC and headers, use the optional argument for \chapter etc. – John Kormylo Jan 17 '21 at 21:20
  • You can find some suggestions in the fancyhdr documentation, section 33 in the V4.0 documentation (called Large chapter/section titles). – Pieter van Oostrum Jan 19 '21 at 16:17

0 Answers0