4

I've using the fancyhdr package to modify the header and footer. If my \listoffigures spans multiple pages then the header and footer on page one of the LoF is not fancy. The TeX example below demonstrates this.

What am I doing wrong please?

\documentclass{report}

\usepackage[a3paper,landscape]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[L]{A}
\fancyhead[C]{FANCY}
\fancyhead[R]{HEADER}

\fancyfoot{}
\fancyfoot[L]{A}
\fancyfoot[C]{FANCY}
\fancyfoot[R]{FOOTER}

\begin{document}

\listoffigures\thispagestyle{fancy}

\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage
\begin{figure}[p]\begin{center}qwerty\caption{qwerty}\end{center}\end{figure}\clearpage

\end{document}
7
  • 1
    \listoffigures processes the entire list before \thispagestyle{fancy} is seen. the change of style needs to be made before that, probably within the definition of \listoffigures. Commented Nov 15, 2012 at 16:22
  • Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you.
    – Stephen
    Commented Nov 15, 2012 at 16:28
  • Instead of \begin{center}...\end{center} you could use just \centering ... in the figure environment.
    – Stephen
    Commented Nov 15, 2012 at 16:32
  • Indeed -- see tex.stackexchange.com/questions/2651/…
    – lockstep
    Commented Nov 15, 2012 at 17:00
  • @Stephen Thanks for the \centering command.
    – chris
    Commented Nov 16, 2012 at 8:24

1 Answer 1

5

The first page in a chapter (and also of the list of figures, which internally uses \chapter) use the plain pagestyle. So you need to redefine it: add

\fancypagestyle{plain}{
  \fancyhead{}
  \fancyhead[L]{A}
  \fancyhead[C]{FANCY}
  \fancyhead[R]{HEADER}

  \fancyfoot{}
  \fancyfoot[L]{A}
  \fancyfoot[C]{FANCY}
  \fancyfoot[R]{FOOTER}
}

after the similar settings you already do.

If the two page styles are really identical, then saying

\makeatletter
\let\ps@plain\ps@fancy
\makeatother

will make calling the plain page style equivalent to calling the fancy page style. With the method of redefining the plain style described above you get much more flexibility.

2
  • 1
    Thanks for the response. Chapter 7 of the fancyhdr user manual talks about this plain style. Is there a way I can copy my fancy style to plain, without having to repeat all the commands? Something like plain = fancy, instead of two identical definitions, one for fancy, one for plain?
    – chris
    Commented Nov 16, 2012 at 8:21
  • @chris Added the "simpler way".
    – egreg
    Commented Nov 16, 2012 at 10:24

You must log in to answer this question.

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