# After \clearpage move the figure to the top

I need to make a "pagebreak" after a figure so I use \clearpage. But I want the figure to stay at the top of the page and not centering at the now empty page. My code right now looks like:

\begin{figure}[t]
\centering
\includegraphics[scale=0.5]{YY.PNG}
\caption{XX}
\label{fig:BB}
\end{figure}

\clearpage

\section{AAA}

• One assumes the figure actually fits the entire page (or close to it)? And you have surrounding text you want to flow as per usual? – Werner Jun 23 '16 at 16:13
• \makeatletter\setlength\@fptop{0pt}\makeatother – David Carlisle Jun 23 '16 at 16:15
• or use \newpage rather than \clearpage – David Carlisle Jun 23 '16 at 16:16

You can use afterpage to perform some magic between page shipouts:

\documentclass{article}

\usepackage{graphicx,float}
\usepackage{afterpage}
\usepackage{showframe,lipsum}% Just for this example

\begin{document}

\section{First section}\lipsum[1-3]

\afterpage{
\begin{figure}[H]
\centering
\includegraphics[width=.8\textwidth,height=.8\textheight]{example-image}
\caption{XX}
\end{figure}
\clearpage
}

\clearpage% or more text (like \lipsum[4-6])

\section{Second section}\lipsum[4-6]

\end{document}


The image is stored in a non-float (using float's [H]ere float specifier) and output after the current page, together with a \clearpage. That ensure the figure appears on its own at the top between two pages of continuous content.