[Tex/LaTex] Remove header/footer on page with large figure

afterpagefloatsheader-footer

I have a question that is similar to this one, though the solutions proposed there do not work for me. I want to insert a large figure in a document that has headers (section titles) and footers (page numbers). Because of the size of the figure and its caption, it doesn't fit nicely within the region bounded by the header/footer, so I want to remove these and put the image on a clean page.

I have seen some solutions that involve the afterpage package, but I never got it to work as intended; I always end up getting a clean page after the figure (see example below). Also, people have suggested to use fancyhdr's \iffloatpage functionality, but I only want to apply this pagestyle to some figures with the [p] position, not all.

\documentclass[twoside]{book}

% Import some packages
\usepackage{afterpage}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage[font={small}]{caption}  % Figure/table caption style

% Desired page dimensions
\usepackage{geometry}               
\geometry{paperwidth=170mm,paperheight=240mm, headsep=30pt, footskip=40pt, inner=70pt, outer=40pt, bottom=100pt, top=80pt}

% Set-up header/footers
\usepackage{fancyhdr}               % Headers/footers (load after geometry
\pagestyle{fancy}                           % Set fancy header/footer style
\fancyhf{}                                      % Clear header/footer
\fancyfoot[RO, LE]{\thepage}        % Page numbers outside of page

\makeatletter

\fancyhead[LE]{\textsc{\nouppercase{\leftmark}}}            % Chapter title on even pages
\fancyhead[RO]{\textsc{\nouppercase{\rightmark}}}       % Section title on odd pages

\begin{document}

\chapter{Very Important Chapter}
\section{Section with big figure}

\blindtext[3]

% The figure below needs to be on a blank page, with no header/footer
\afterpage{\thispagestyle{empty}}
\begin{figure}[p]
\begin{center}
\includegraphics[width=0.9\textwidth, height=16cm]{example-image-c}
\caption{\blindtext[1]}
\end{center}
\end{figure}

\blindtext[12]

\end{document}

Best Answer

I don't believe \afterpage will run on a page generate by a [p] float, since no text is allowed. If you set \thispagestyle{empty} using everypage, it isn't applied until the NEXT page.

\documentclass[twoside,a4paper]{book}

% Import some packages
\usepackage{afterpage}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage[font={small}]{caption}  % Figure/table caption style

% Desired page dimensions
\usepackage{geometry}               
\geometry{paperwidth=170mm,paperheight=240mm, headsep=30pt, footskip=40pt, inner=70pt, outer=40pt, bottom=100pt, top=80pt}

% Set-up header/footers
\usepackage{fancyhdr}               % Headers/footers (load after geometry
\pagestyle{fancy}                           % Set fancy header/footer style
\fancyhf{}                                      % Clear header/footer
\fancyfoot[RO, LE]{\thepage}        % Page numbers outside of page

\makeatletter

\fancyhead[LE]{\textsc{\nouppercase{\leftmark}}}            % Chapter title on even pages
\fancyhead[RO]{\textsc{\nouppercase{\rightmark}}}       % Section title on odd pages

\usepackage{everypage}

\begin{document}

\chapter{Very Important Chapter}
\section{Section with big figure}

\blindtext[3]

\afterpage{\clearpage}% force [p] figure to next page (probably not needed)
\AddThispageHook{\thispagestyle{empty}}%
% The figure below needs to be on a blank page, with no header/footer
\begin{figure}[p]
\begin{center}
\includegraphics[width=0.9\textwidth, height=16cm]{example-image-c}
\caption{\blindtext[1]}\label{here}
\end{center}
\end{figure}


\blindtext[12]

\end{document}