I am trying to put fancyhdr custom style on all pages except first one, but it either shows up on all of them, or on none, I can't make this style to go from second page, im new to latex, so any help is welcome.
2 Answers
The default page style - plain
- is used throughout article
, even if \maketitle
is used. To be sure though, you could add
\thispagestyle{plain}
\pagestyle{fancy}
to your preamble, which will ensure the first page uses plain
(as a result of \thispagestyle
) and subsequent pages use fancy
(as a result of \pagestyle
; \thispagestyle
overrides \pagestyle
).
Here's a complete minimal example:
\documentclass{article}
\usepackage{fancyhdr}%
\usepackage{lipsum}% Just for this example
\fancyhf{}% Clear all headers/footers
\fancyhead[L]{Left header}\fancyhead[C]{Centre header}\fancyhead[R]{Right header}
\fancyfoot[L]{Left footer}\fancyfoot[C]{Centre footer}\fancyfoot[R]{Right footer}
\pagestyle{fancy}
\thispagestyle{plain}
\title{My title}
\author{My author}
\begin{document}
%\maketitle
\lipsum[1-10]
\end{document}
Another option might be to use afterpage
which you can use to set the page style of page following the one containing the \afterpage
command. However, \afterpage
sets its contents in a group, which doesn't allow a regular \pagestyle
to survive. For that, you could use some other trickery, as discussed in Page styles only work for \thispagestyle
under afterpage
.
-
-
@botenvouwer: The page number should be available as
\thepage
. So add that wherever you want to see the page number.– Werner ♦Feb 6, 2019 at 16:32
You can also use \thispagestyle{empty}
to remove all header and footer (even the page number of the first page}. It is very useful when you want to make a page title for a report or a thesis.
You can use this command anywhere in your document.
\documentclass
are you using?\thispagestyle{plain}
(even under\maketitle
). However, if you add to your preamble\thispagestyle{plain}\pagestyle{fancy}
, you will always get aplain
first page, andfancy
subsequent pages. If not, something's amiss, and you'll have to show us what you're doing, because you might be doing it wrong...