I try to write a document using the report document class. I used fancypagestyle
to redefine the plain page style to have custom header and footers.
Now I try to fill the document with its content, using \chapter
, \section
, and \subsection
. The effect, that I see and which I do not expect is, that when I have enough text, that a page that started with a \chapter
overflows to the next page, the page style changes to a style without header and footer. To me, it seems that the original plain
page style is used again (I can see a page number at the bottom of the page).
I can workaround that, by adding \thispagestyle{plain}
after \section
or \subsection
.
Is there some kind of mechanic involved, that switches to a different page style? What else could cause this change in the page style?
Edit: Here is a very reduced document, that shows the problem. The first page is using the plain
page style, but on page 2 and the following pages, an other page style seems to be used (I think that might be the old plain
style).
\documentclass[a4paper]{report}
\usepackage{titling}
\title{Test}
\author{Me}
\date{\today}
\let\documenttitle\thetitle
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{blindtext}
\setlength{\voffset}{-2.540cm}
\setlength{\hoffset}{-2.540cm}
\setlength{\topmargin}{2.0cm}
\setlength{\headsep}{1cm}
\setlength{\headheight}{0.5cm}
\setlength{\oddsidemargin}{2.5cm}
\setlength{\footskip}{2.9cm}
\setlength{\textheight}{23.5cm}
\setlength{\textwidth}{16.0cm}
\setlength{\marginparwidth}{0cm}
\setlength{\marginparpush}{0cm}
\setlength{\marginparsep}{0cm}
\fancypagestyle{plain}{%
\fancyhf{}%
\rhead{\fontsize{8.5pt}{11.5pt}\fontseries{m}\selectfont\thepage/X}%
\lhead{\fontsize{8.5pt}{11.5pt}\fontseries{m}\selectfont\MakeUppercase{%
\documenttitle%
}}%
}
\begin{document}
\blinddocument
\end{document}
This is the command line, that I used to generate a pdf file:
% xelatex --shell-escape rep.tex && open rep.pdf
\documentclass...
to\end{document}
) that we can compile that shows what you have done and what the problem is.\pagestyle{plain}
instead of\thispagestyle{plain}
you may sometimes get this effect (depending on the actual structure of the code).