I want to use multiple fancyheader styles in my document. I've run into a problem that seems to be a bug to me. The code below doesn't compile with latex
; it seems stuck in an infinite loop.
\documentclass{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[C]{fancy \thepage}
\fancyfoot{}
}
\fancypagestyle{tocstyle}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\footnotesize{TOC \thepage}}
}
\begin{document}
\frontmatter
\pagestyle{tocstyle}
\tableofcontents
\mainmatter
\pagestyle{fancy}
\chapter{Intro}
\lipsum
\end{document}
If I replace the fancyheader style fancy
by anything else, e.g. fancy1
, then everything does work as expected.