Page Layoutfancyhdr | Customized Header for ToC Pages

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Tompoesje
Posts: 3
Joined: Thu Apr 30, 2009 4:51 pm

fancyhdr | Customized Header for ToC Pages

Post by Tompoesje »

Hello,

When using the fancydr package to create a header (on the left the chaptertitle and the page number on the right) I have to use '\thispagestyle{fancy}' on a page where a new chapter starts cause otherwise the pagestyle is automatically 'plain'. So thats not a problem.

Now I'm trying to do the same for my table of contents, but i'm encountering a problem. If my table of contents is only 1 page long it works just fine, but when its 2 or 3 pages the '\thispagestyle{fancy}' command doesn't seem to have an effect on the first page of the ToC.

I've tried to look in the fancyhdr package documentation but found nothing of help.

I've added a working example.
Attachments
Test.tex
(1.21 KiB) Downloaded 1055 times

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

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Customized Header for ToC Pages

Post by Stefan Kottwitz »

Hi Tompoesje,

welcome to the board!
Try

Code: Select all

\addtocontents{toc}{\protect\thispagestyle{fancy}}
instead or have a look at Modifying plain page style.

Stefan
LaTeX.org admin
Tompoesje
Posts: 3
Joined: Thu Apr 30, 2009 4:51 pm

Re: fancyhdr | Customized Header for ToC Pages

Post by Tompoesje »

The solution in your link works like a charm, thank you very much!
karianne
Posts: 6
Joined: Fri Jun 04, 2010 2:50 pm

Re: fancyhdr | Customized Header for ToC Pages

Post by karianne »

Hi,

I have a similar problem with fancyhdr and Table of Contents. I have defined my headers and footers (see attached file), but the headers in the Contents, List of Tables, and List of Figures pages still don't change. The first page is fine, but in the following pages I want the header to be lower-case letters, not capitalised.

cheers,
Karianne
Attachments
ex.tex
(1.64 KiB) Downloaded 759 times
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

fancyhdr | Customized Header for ToC Pages

Post by gmedina »

Hi,

use the \nouppercase command in the appropritae locations:

Code: Select all

\fancyhead[LE]{\nouppercase\leftmark}
\fancyhead[RO]{\nouppercase\rightmark}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
karianne
Posts: 6
Joined: Fri Jun 04, 2010 2:50 pm

fancyhdr | Customized Header for ToC Pages

Post by karianne »

Awsome!! Thank you!

I just found out that this also works (after fighting LaTeX all day):

Code: Select all

\tableofcontents{\fancyhead[LE]{\slshape\contentsname}}
\listoffigures{\fancyhead[LE]{\slshape\listfigurename}}
\listoftables{\fancyhead[LE]{\slshape\listtablename}}
And then including the fancyhead code for the rest of the document below.

Cheers, Karianne
kyhut
Posts: 1
Joined: Tue May 22, 2012 8:28 pm

Re: fancyhdr | Customized Header for ToC Pages

Post by kyhut »

Thanks Stefan, that just saved me a bunch of hassle to get the proper page style on my toc, lof, and lot.
Post Reply