0

After finishing my thesis in one sided book, I switched it to double sided and latex added extra pages such that chapters always start on even pages. See code below; However with contents for example, the first two pages show the correct header which is 'Contents' then the next and extra page which Latex adds shows the heading 'List of Figures' of the next chapter (see image below).

enter image description here

\addcontentsline{toc}{chapter}{Contents}
\lhead{\emph{Contents}}
\tableofcontents

% list of figures
\addcontentsline{toc}{chapter}{List of Figures}
\lhead{\emph{List of Figures}}
\listoffigures

% list of tables
\addcontentsline{toc}{chapter}{List of Tables}
\lhead{\emph{List of Tables}}
\listoftables

This is part of my preamble \documentclass[12pt,a4paper,twoside]{book} \usepackage{fancyhdr}

  • Without a full example document that shows which document class you use and what header settings you have (an MWE), I won't dare posting this as an answer, but I guess something like \markboth{<left>}{<right>} or \markright{<right>} would be much more appropriate than \lhead. Maybe you are lucky and your document class has a fully automatic way to add the LoF and friends to the ToC and have the expected text appear in the header. – moewe Jul 28 '19 at 13:51
  • @moewe, should I post the document preamble or just the document class? Thanks! – Luke Galea Jul 28 '19 at 13:52
  • Ideally you would post a fully compilable example that shows as little of your preamble and document text as possible, while still reproducing the undesirable output. Coming up with a fully minimal example document is an art, but https://tex.meta.stackexchange.com/q/228/35864 should give you a hint to get started. – moewe Jul 28 '19 at 13:54
  • Related: https://tex.stackexchange.com/q/35433/35864, https://tex.stackexchange.com/q/15918/35864, https://tex.stackexchange.com/q/89914/35864 – moewe Jul 28 '19 at 13:56
  • This is part of my preamble \documentclass[12pt,a4paper,twoside]{book} \usepackage{fancyhdr} – Luke Galea Jul 28 '19 at 13:57
  • See also https://tex.stackexchange.com/q/48509/35864, https://tex.stackexchange.com/q/148013/35864, https://tex.stackexchange.com/q/41897/35864 – moewe Jul 28 '19 at 13:57
  • \lhead and marks take effect on the page where they occur. This might be corrected by adding \clearpage before the \addcontentsline for the list of figures. – barbara beeton Jul 28 '19 at 13:58
  • Thanks for sharing your document class. Please edit your question directly to include that piece of information. (Having to go through the comments to find all relevant info is tedious.) It would still be great if you could put together a small example document that reproduces what you are getting with as little code as possible. That makes it much easier for people to help you. – moewe Jul 28 '19 at 14:03
  • I understand @moewe, sorry if I am new to this - moreover are there alternatives to lhead such that the heading will appear left or right based on whether the page is odd or even. – Luke Galea Jul 28 '19 at 14:06
  • Hey guys! adding \cleardoublepage before \addcontentsline for figures and table did the trick :) It would still be cool if I could have headers changing left/right side based on whether pages are even or odd – Luke Galea Jul 28 '19 at 14:08
  • In the book class by default chapters start on odd pages. You say that in your case chapters start on even pages. What have you done? – Peter Wilson Jul 28 '19 at 16:30

1 Answers1

0

You need to use the openany option in your documentclass, e.g. \documentclass[12pt,a4paper,twoside,openany]{book} to prevent the insertion of extra pages.