Page Layoutfancyhdr | Page Styles in ToC larger than one Page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ozzythewise
Posts: 2
Joined: Mon Jul 30, 2012 3:48 pm

fancyhdr | Page Styles in ToC larger than one Page

Post by ozzythewise »

Hello all,

I've been up and down the forum trying to find the solution for this one. I want to have customized headers on my List pages (ie. ToC, LoF, LoT). I am using the fancyhdr package for custom headings. For each of these pages however the headings only appear on the final page, not on all the preceding ones. Here is an example code of the problem

Code: Select all

\documentclass[pdftex,11pt,a4paper,twoside,openright]{report}

%%% PREAMBLE %%%

%%% PACKAGES TO INCLUDE %%%%

\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}

%%%% SET DEFAULT PAGE LAYOUTS %%%%
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter: \ #1}{}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage
  {\pagestyle{empty}\origdoublepage}%
}
\let\cleardoublepage\clearemptydoublepage
\setlength{\parskip}{10pt plus 2pt minus 2pt}

\begin{document}

\input{./titlePage.tex} %Custom title page

\newpage
\thispagestyle{empty}
\mbox{}
%%% BEGIN THE ABSTRACT %%%
\begin{abstract}
\pagenumbering{roman}
\fancyhf{}
\thispagestyle{fancy}
\lhead[Abstract]{Report Title}
\rhead[Report Title]{Abstract}
\lfoot[\thepage]{University Name}
\rfoot[University Name]{\thepage}
\end{abstract}

\tableofcontents

\fancyhf{}
\thispagestyle{fancy}
\lhead[Table of Contents]{Report Title}
\rhead[Report Title]{Table of Contents}
\lfoot[\thepage]{University Name}
\rfoot[University Name]{\thepage}

\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\chapter{Chapter 5}
\chapter{Chapter 6}
\chapter{Chapter 7}
\chapter{Chapter 8}
\chapter{Chapter 9}
\chapter{Chapter 10}
\chapter{Chapter 11}
\chapter{Chapter 12}
\chapter{Chapter 13}
\chapter{Chapter 14}

\end{document}
As you can see, the headings only appear on the 2nd page of the table of contents. Browsing another forum I see that people tried using \addtocontents{toc}{\protect\thispagestyle{fancy}} in order to force the heading, but when I do this it just gives me the headings from the previous section. So in the example above, that would just be the headings from the "Abstract" section.

Please, if someone has any advice for me I would really appreciate it!

Thanks!

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

ozzythewise
Posts: 2
Joined: Mon Jul 30, 2012 3:48 pm

Re: fancyhdr | Page Styles in ToC larger than one Page

Post by ozzythewise »

Don't anyone have any thoughts for this? I'm desperate for a solution.

Thanks
Post Reply