I have two sideways tables that I want on two facing pages so the reader can turn the entire book and read them both in one turn. For the moment I keep moving them around to keep them on facing pages. Is there a way I can make the first one float until it's on a left page and then place the other one right after? Or perhaps some similar way to automatically get them on the same spread?
[Tex/LaTex] How to float until on left (or right) page
double-sidedfloatspositioningrotating
Related Solutions
The following should do it. It needs at least two compiler runs to be stable. With a lot of floats it can take several compilation runs until the document is stable.
Updates:
Works now for twoside
mode; now with caption support;
Added float settings and removed !
from the float position to also support smaller images;
Moved p
images to the page corners.
\documentclass[twoside]{book}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{afterpage}
\usepackage{placeins}
\usepackage{xcolor}
% For the `memoir` class remove the following two packages.
% This class already provide the functionality of both
\usepackage{caption}
\usepackage[strict]{changepage}
%%%
\setcounter{totalnumber}{1}
\setcounter{topnumber}{1}
\setcounter{bottomnumber}{1}
\renewcommand{\topfraction}{.99}
\renewcommand{\bottomfraction}{.99}
\renewcommand{\textfraction}{.01}
\makeatletter
\newcommand*{\twopagepicture}[4]{%
\checkoddpage
\ifoddpage
\expandafter\@firstofone
\else
\expandafter\afterpage
\fi
{\afterpage{%
\if #1t%
\if #2p%
\thispagestyle{empty}%
\afterpage{\thispagestyle{empty}}%
\fi
\fi
\begin{figure}[#1]
\if #2p%
\if #1t%
\vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
\fi
\fi
\if #1b%
\caption{#4}%
\fi
\makebox[\textwidth][l]{%
\if #2p\relax
\let\mywidth\paperwidth
\hskip-\dimexpr1in+\hoffset+\evensidemargin\relax
\else
\let\mywidth\linewidth
\fi
\adjustbox{trim=0 0 {.5\width} 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
\if #1b\else
\caption{#4}%
\fi
\if #2p%
\if #1b%
\vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
\fi
\fi
\end{figure}%
\begin{figure}[#1]
\if #2p%
\if #1t%
\vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
\fi
\fi
\makebox[\textwidth][l]{%
\if #2p%
\let\mywidth\paperwidth
\hskip-\dimexpr1in+\hoffset+\oddsidemargin\relax
\else
\let\mywidth\linewidth
\fi
\adjustbox{trim={.5\width} 0 0 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
\if #2p%
\if #1b%
\vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
\fi
\fi
\end{figure}%
}}%
}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum
\lipsum
\twopagepicture{b}{l}{image}{Test}
\lipsum
\twopagepicture{t}{l}{image}{Test}
\lipsum
\twopagepicture{b}{p}{image}{Other test}
\lipsum
\twopagepicture{t}{p}{image}{Other test with
very very very very very very very very very very very
very very very very very very very very very very very
very very very very very very very very very very very
long caption
}
\lipsum
\lipsum
\end{document}
(The image shown is a panorama photo made by me from top of the Preikestolen mountain, Norway)
I've found the following set of instructions works well in the circumstances you describe; I use the \afterpage
command provided by the afterpage
package.
...
\afterpage{\clearpage
\begin{sidewaystable} % no need for the [h] or even [h!] specifier
\centering % better than \begin{center} ... \end{center}
\begin{tabular}...
...
\end{tabular}
\caption{xyz} \label{tab:xyz}
\end{sidewaystable}
\clearpage } % note the "}" to denote the end of the argument of \afterpage
...
The key is the use of \clearpage
commands both before and after the sideways{figure/table} environment.
Best Answer
Use package
dpfloat
(double page float)