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}