8

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.

4
  • What \documentclass are you using?
    – Werner
    Jan 6, 2016 at 20:25
  • I am using article Jan 6, 2016 at 20:28
  • The default is for the first page to be set using \thispagestyle{plain} (even under \maketitle). However, if you add to your preamble \thispagestyle{plain}\pagestyle{fancy}, you will always get a plain first page, and fancy 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...
    – Werner
    Jan 6, 2016 at 20:33
  • Thank you very much, this works perfectly, first is plain, others are my own style, thank you again for the help. Jan 6, 2016 at 20:37

2 Answers 2

11

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:

enter image description here

\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.

2
  • how would you add page number? Feb 6, 2019 at 12:29
  • @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
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .