General ⇒ Running head at the last page is that of next chapter!
Running head at the last page is that of next chapter!
I have a large document broken down into separate chapters. In each chapter, I have the following line as running head at top margin:
\markboth{Chapter k}{Abc 123}
where k = 1, 2, 3, etc is the chapter number.
Then I combine all chapters as follows:
\begin{document}
\input chapter1.tex
\input chapter2.tex
etc.
\end{document}
The problem is that in the last page of each chapter, I get the running head of the next chapter. For example, if the first chapter ends on an odd page (say 25), it's running head at top is "Chapter 2". But if the first chapter ends on an even page, its running head is "Abc 123", because it is the same for all the chapters. I feel that the problem is due to some counter not resetting when a new chapter is read in. This happens not only with chapters, but with the preamble as well. In the last page of "List of tables", I get the running head of chapter 1. Is there anyone who have come across this strange behaviour of MikTex? How can I tell MikTex to keep the running head till the last (odd) page of each chapter?
Thanks in advance.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Running head at the last page is that of next chapter!
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10