0

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}
2

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}
  • Worked like a charm, thanks! A quick note to future readers who are wondering what is different between my code and that of the accepted answer: import the everypage package and apply \AddThispageHook{\thispagestyle{empty}} before the float. – MPA Apr 20 '18 at 16:22
  • Also note the a4paper (it is needed if not default). – John Kormylo Apr 20 '18 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.