# Remove the heading of the page where the figure is?

I need to insert a very large figure which will occupy the whole page, so I need to remove the heading of the page where the figure is. I do this with code:

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{graphicx}

\begin{document}
\chapter{Sample Chapter}
\section{New section}

\lipsum{1-6}
\begin{figure}[p]
\thispagestyle{empty}
\caption{hello}
\end{figure}•
\lipsum{2-5}

\end{document}


The result is that the page where the figure is has the heading but one of the pages before the page of the figure doesn't have the heading. It removes the wrong heading of the page. How should I resolve the problem?

• May 23, 2022 at 14:25
• @JohnKormylo The second link can resolve this problem. Thanks a lot. May 24, 2022 at 0:38
• @JohnKormylo How did you know so much about LeTeX? Which book of LaTeX made you so magic? May 24, 2022 at 0:43
• The TeXbook by Knuth, source2e.pdf (from CTAN), occasional .sty files and lots of experimentation. May 24, 2022 at 3:14
• @JohnKormylo Is this one: https://theswissbay.ch/pdf/Gentoomen%20Library/Extra/D._Knuth-The_TeXbook.pdf May 24, 2022 at 5:50

Your figure is typeset on a "page of floats", and unfortunately, LaTeX uses the headers/footers definition of the previous "normal" page for these.

However, fancyhdr has a special command for detecting that we are on a page of floats, and then we can make the header conditional on this. In the following example I use the headings option that fancyhdr has (in version 4 and later) to duplicate the headings style. I then redefine the headers so that they will be empty on all float pages.

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[headings]{fancyhdr} % at least version 4

\begin{document}
\chapter{Sample Chapter}
\section{New section}

\lipsum{1-6}
\begin{figure}[p]
\thispagestyle{empty}
\caption{hello}
\end{figure}
\lipsum{2-5}

\end{document}


Now if you want to suppress the headers only on one page, you can use a different test: just check the page number. In order not to have to guess the page number, or look at the printed copy, you can use a label. The refcount package has a command \getpagerefnumber to get the numerical vale of the page number of the label, that can be used in numerical comparisons.

I have put the label of the special page in a macro, so that you can repeat the process for later pages if so required.

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[headings]{fancyhdr} % at least version 4
\usepackage{refcount}
\usepackage{ifthen}

\newcommand{\whichlabel}{specialfig}
% \checkpage{value on special page}{value on other pages}
\newcommand{\checkpage}[2]{%
\ifthenelse{\thepage=\getpagerefnumber{\whichlabel}}{#1}{#2}%
}
% Don't print headers on the special page.
% If you later want to do the same on another page, just give it a new \label
% and \renewcommand{\whichlabel}{new label}
}

\begin{document}
\chapter{Sample Chapter}
\section{New section}
ref on page~\pageref{specialfig}.

\lipsum[1-6]

\begin{figure}[p]
\fbox{\rule{0.9\textwidth}{0pt}\rule{0pt}{0.9\textheight}}
\end{figure}
\lipsum[7]
\begin{figure}[p]
\fbox{\rule{0.9\textwidth}{0pt}\rule{0pt}{0.9\textheight}}
\end{figure}
\lipsum[2-5]
\end{document}

• Hm, image is push to the end of document, second and last page use empty page style. If I change placement option to !ht figure is on third page, but empty page style is activated on the second page. It works correctly if figure is inserted after third page after chapter title. May 23, 2022 at 10:50
• Hello. Thanks for your reply. But the heading style can't be changed as it is designed by the editor of the journal. How can I resolve this problem without changing the default heading, just make the heading disappeared here? May 23, 2022 at 10:50
• If the heading style is designed by the editor and if you are not allowed to change it, then the problem probably can't be changed. But if you are allowed to use fancyhdr, you can use it to emulate the used style, and use my solution to suppress it on the figure page. May 23, 2022 at 19:17
• Okay. I just want to modify this page. From your answer, it seems to change every figure with [p], which is beyond my need. Is there a way to just remove this page's heading? May 24, 2022 at 0:14
• I have added an example, where only one page has the headers suppressed. May 24, 2022 at 22:30

I think you first has to go to create a new page, than set the pagestyle to empty with the command \thispagestyle{empty} that you already used and then insert the figure with the placement command here like this \begin{figure}[!h].

In my opinion the "clean" way would be to declare a new page environment for that and then insert the image directly in that env.

• I add \newpage before \begin{figure}[p], but there is nothing different. May 23, 2022 at 10:53
• Pls try \clearpage May 24, 2022 at 7:56
• \clearpage can't resolve the problem. May 25, 2022 at 1:12