I'd like to get "page x of y" in a footer on each page, and the way I've found is to use:
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\cfoot{Page \thepage\ of \pageref{LastPage}}
This works but has introduced a solid line at the top of each page and some headers. How do I get "page x of y" without any headers at all?
Best Answer
Regarding the header settings when using
fancyhdr
: In order to remove the header rule, you need to set it to0pt
usingAlthough this is a length, it's used as a command within the header. In order to clear the entire header, use
which clears everything (left, centre and right, on odd and even pages).
If you want the mean
\chapter
page (I assume you are using a document class likebook
orreport
), you can set the page style for that specific chapter manually usingThe reason for this is because
\chapter
(and\chapter*
) sets the page style toplain
by default (since the page configuration is different from other pages, with a large open "header"). Here is a minimal example capturing the above:If you want the page style to be
fancy
regardless (or globally), and therefore would like to avoid setting tofancy
manually at every\chapter
, you could just overwrite theplain
page style withfancy
(or create a newplain
page style altogether; it depends on your usage/preference):Add the above after setting all the
fancy
header styles, or see section 7 Redefiningplain
style (p 7) of thefancyhdr
documentation. Note, thelipsum
package is not necessary; it was merely used for creating dummy text, Lorem Ipsum style.