GeneralRunning head at the last page is that of next chapter!

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Lehrer
Posts: 2
Joined: Thu Sep 18, 2008 7:45 am

Running head at the last page is that of next chapter!

Post by Lehrer »

Hello,
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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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!

Post by localghost »

Change from \input to \include. There are better ways to declare headers and footers. Take a look at fancyhdr or titlesec.


Best regards
Thorsten¹
Post Reply