# \thispagestyle{plain} has no effect [duplicate]

I'm using the default settings of the fancyhdr package and calling \pagestyle{fancy} at the beginning of my document of type report. Since I have some large figures and tables, I would like to suppress the headers on individual pages in the document. To this end, I have tried calling \thispagestyle{plain} immediately before inclusion of the figures, however, this seems to have no effect whatsoever. On the other hand, calling \pagestyle{plain} does work; the headers then disappear for the rest of the document. I've spent quite a long time trying to fix this, what am I missing?

EDIT: The problem seems to appear only on pages containing tables or figures, i.e., float objects. I've found a possible duplicate here:

\lhead{\iffloatpage{}{\small\normalfont\TheTitle}}
\fancyfoot{}


to the preamble seems to fix the problem, although I don't really understand what is going on here...

EDIT: Another duplicate is

which recommends the floatpag package for this situation.

SOLUTION: I tried the floatpag package, but it seemed to cause the line spacing in my tables to change, so I decided to use the method from the accepted answer. Thus, I defined a custom fancy style in the preamble:

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter. #1 }}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}{}}
\fancyhf{}
\fancyfoot[C]{\iffloatpage{}{\thepage}}
\renewcommand{\footrulewidth}{\iffloatpage{0pt}{0pt}}

-

## marked as duplicate by Werner, cmhughes, Thorsten, T. Verron, GuidoMay 31 '13 at 5:38

Have you tried \thispagestyle{empty}? Also, it would help if you could give something of a MWE. – A.Ellett May 31 '13 at 1:21
I tried \thispagestyle{empty}, with the same result. It just doesn't do anything. I'll put together a minumum example... – Patrick May 31 '13 at 1:23
I think the problem has to do with how floats a placed. At the time LaTeX sees the \thispagestyle{...} command, it doesn't know where the floats are going to be placed. When the floats are placed, the \thispagestyle{...} has been executed for a different page (or overriden). – A.Ellett May 31 '13 at 2:17
yes, that makes sense. The above somehow redefines the fancy style in the case that the page contains only float objects. Unfortunately, I still can't get rid of the header in the case that a page contains a float and text together... – Patrick May 31 '13 at 2:19
I would recommend manually placing the float one the page if you feel you know where you want it. That is, doesn't use the float environment at all. Just place the figure or image in a minipage and place where you want it. – A.Ellett May 31 '13 at 2:21

Using \iffloatpage you can specify a behaviour for non-float pages and a different behaviour for float pages; the syntax is

\iffloatpage{value for float page}{value for other pages}


For example, using

\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}


you are declaring a thickness of 0.4pt for the headrule in non-float pages and a thickness of 0pt (i.e., no rule) for float pages.

A complete example:

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhf{}
\renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}

\begin{document}

Text

\begin{figure}[p]% [p] was used for the example only
\centering
A
\caption{A test figure in a float page}
\end{figure}

\end{document}


Notice also that I used the more modern \fancyhead[<options>], \fancyfoot[<options>] syntax instead of the "old" \Xhead, \Xfoot one.

-

Here's a working example

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}

\thispagestyle{empty}

Empyt first page

\pagebreak

Decorated second page

\end{document}


The question then is: what are you doing differently? Of course, when we see your MnonWE, we may know. ;)

-
Ok, I can confirm that it works in a simple example like this. I must be including a package that somehow overwrites the command or the plain/empty style. Any ideas what could be causing this? I would like to show you my non working example, but then I would have to upload my thesis... – Patrick May 31 '13 at 1:35
All I can say is, post a MWE which exhibits what's happening. Make a document which loads the same packages as your thesis, then gradually remove packages (first those which you believe should have no effect upon page header and footers) until you've paired it down to something manageable which nevertheless still fails to recognize you \thispagestyle{empty} – A.Ellett May 31 '13 at 1:37
Additionally, you may want to check out Why doesn't \pagestyle{empty} work on the first page of a chapter? – A.Ellett May 31 '13 at 1:40
So I've narrowed it down to pages with float objects. The \thispagestyle command works as expected on pages without tables or figures. I've just found this link: tex.stackexchange.com/questions/13307/… – Patrick May 31 '13 at 1:56
I've edited the question accordingly. – Patrick May 31 '13 at 2:02