# Issuing a full-page figure manually before (not after) the current one

Usually, when there is too much pending floating material (figures, tables and such), LaTeX just gives up on placing it on the current page and generates a “float page” containing only floats before proceeding with the main material. What I would like to do is almost like that, but not quite: to place a single figure on its own page page before the one the current paragraph would go on. I don’t need this figure to be passed through the floats mechanism specifically, but it can if needed.

Unlike a similar question here on TeX.SE, I want the figure emitted on its own page, not retroactively tucked into the bottom of the text on the previous one, so this doesn’t sound impossible in principle from the way TeX operates: the current page has not yet been shipped out and forgotten by TeX, it should be entirely possible to ship out a different one before it. However, I recognize that TeX page breaking may yet decide to break the page before the current line or indeed the current paragraph, so just doing a \shipout from the main document without entering the output routine would be incorrect (even forgetting that it also would not play nice with page headers and such), and I do not understand LaTeX output routine arcana enough to patch it to do this.

(To avoid X/Y issues: I actually want my figure to end up on the left page of a spread and my text on the right, but I don’t think this is expressible in LaTeX without global optimization of pagination.)

If this is relevant, I’m currently using KOMA-Script, scrlayer-scrpage and geometry, but I’m willing to switch if necessary (except maybe for the kaijū that is memoir). M(N)WE:

\documentclass[a4paper]{scrartcl}
\usepackage{geometry}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}
\title{Hello world} \author{John Doe} \date{}
\begin{document}

% Page 1 and start of page 2 (I want 1 and 3)
\maketitle
\lipsum[1-5]

% Paragraph on page 2 (I want 3) anchoring a big figure
\lipsum*[6][1-3]
\begin{figure}
% FIXME This ends up on page 3, but I want it on page 2
\rule{\textwidth}{.8\textheight}
\end{figure}
\lipsum*[6][4-100]

% Some more text that ends up on pages 2 and 4 (I want 3 and 4)
\lipsum[7-10]

\end{document}

• At the current point in time I would say it is not possible with the standard handling of floats in LaTeX, it needs some alterations of how float pages are constructed and placed. Technically, as you say, by the time, we reach the OR with a full page 2 (but no footer or header attached) one could take a look at a question like " am I on a left page and can I make a float page" and if so put that out first and then the current page as page 3. It would make a useful scenario and might come as we are currently looking at the OR stuff, but not soon. – Frank Mittelbach Dec 13 '20 at 23:04
• The "problem" is that the paragraph is formatted on page 1 but doesn't print until page 2. If the figure is printed on page 2, then the surrounding text will be printed on page 3, after the figure. LaTeX goes to some effort to prevent that. – John Kormylo Dec 13 '20 at 23:14

Floats are always printed in the order they are created, by type. OTOH, it is possible to slip in a table before a figure, or create a new float type specifically to bypass the queue.

This solution used afterpage, which will always print on the next page (or column). Note that \parindent is not set to 0pt, unlike a figure.

\documentclass[a4paper]{scrartcl}
\usepackage[showframe]{geometry}
\usepackage{scrlayer-scrpage}
\usepackage{afterpage}
\usepackage{lipsum}
\title{Hello world} \author{John Doe} \date{}
\begin{document}
\maketitle
\lipsum[1-5]
\lipsum*[6][1-3]
\afterpage{\vspace*{0pt plus 1fil}\noindent\rule{\textwidth}{.8\textheight}\newpage}% will put \rule on next page
\lipsum*[6][4-100]
\lipsum[7-10]

\end{document}

• Unfortunately, floats are not the point of my question, source order is: I want the figure content to be mentioned in the TeX source where it logically fits, not at a seemingly random point 500 words before which happens to be on the previous output page. That just isn’t good programming practice, I think. – Alex Shpilkin Dec 13 '20 at 21:51
• I wasn't sure the default position was on page 1. – John Kormylo Dec 13 '20 at 22:18

In your example document the figure logically fits between between the first two paragraphs and following ones. Why not put it there? --- GOM

% placefigprob.tex  SE 574884

\documentclass[a4paper]{scrartcl}
\usepackage{geometry}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}
\usepackage{comment}
\usepackage{afterpage}

\newcommand{\showfig}{%
\begin{figure}
FIXME This ends up on page 3, but I want it on page 2
\rule{\textwidth}{.8\textheight}
\end{figure}
}
\title{Hello world} \author{John Doe} \date{}
\begin{document}

\maketitle
\textbf{ Page 1 and start of page 2 (I want 1 and 3)} \\
%\maketitle
\lipsum[1-2]
\showfig
\lipsum[3-5]

\textbf{Paragraph on page 2 (I want 3) anchoring a big figure} \\
\lipsum*[6][1-3]
\begin{comment}
\begin{figure}
FIXME This ends up on page 3, but I want it on page 2
\rule{\textwidth}{.8\textheight}
\end{figure}
\end{comment}
%\showfig
\lipsum*[6][4-100]

\textbf{ Some more text that ends up on pages 2 and 4 (I want 3 and 4)} \\
\lipsum[7-10]

\end{document}


The above is a semi-modification of your MWE.