GeneralForce images/tables to verso

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
paulvanderheijden
Posts: 4
Joined: Sun Feb 17, 2008 2:34 pm

Force images/tables to verso

Post by paulvanderheijden »

Is there a way to group tables and images and show them on the verso (left hand) page only?

I'd like my tables/images on the left and my text on the right.

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Force images/tables to verso

Post by Juanjo »

Try the following example:

Code: Select all

\documentclass[twoside]{article}

%-----------------------------------------------------------------------------
% Put this block in the preamble

% This package defines the \EveryShipout command
\usepackage{everyshi}

% We redefine some parameters to avoid floats on even pages (twosided document)
\EveryShipout{\ifodd\value{page}\gdef\topfraction{0.7}\else\gdef\topfraction{0}\fi}
\EveryShipout{\ifodd\value{page}\gdef\bottomfraction{0.3}\else\gdef\bottomfraction{0}\fi}
\EveryShipout{\ifodd\value{page}\gdef\textfraction{0.2}\else\gdef\textfraction{1}\fi}
\EveryShipout{\ifodd\value{page}\gdef\floatpagefraction{0.5}\else\gdef\floatpagefraction{1}\fi}
\gdef\topfraction{0}\gdef\bottomfraction{0}\gdef\textfraction{1}\gdef\floatpagefraction{1}
%-----------------------------------------------------------------------------

% Only for testing purposes
\usepackage{lipsum}  % To generate text
\newcommand{\InsertAFigure}{%  To generate figures
\begin{figure}
   \centering \fbox{\parbox[][5cm][c]{5cm}{\centering A figure}}
   \caption{A figure}
\end{figure}}

\begin{document}

\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure \InsertAFigure \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-3] \InsertAFigure
\lipsum[1-10]

\end{document}
The relevant code goes between two dashed lines. If you want all the text in the right-hand pages, simply remove the line

Code: Select all

\EveryShipout{\ifodd\value{page}\gdef\textfraction{0.2}\else\gdef\textfraction{1}\fi}
mister_pink
Posts: 2
Joined: Sat Dec 13, 2008 8:38 pm

Re: Force images/tables to verso

Post by mister_pink »

Hi all.

Apologies for dragging up an old post, but the original question is exactly the same one as I'm now trying to solve! The above solution nearly works for me (with the line removed as described) but text still appears on left hand pages when there are no figures. I'd like to be able to have all the text on the right, leaving left pages blank if required.

As an added complication, if its possible I'd like to be able to define some smaller floats to go inline using text wrapping.

Thanks for your help in advance.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Force images/tables to verso

Post by Juanjo »

I'd like to be able to have all the text on the right, leaving left pages blank if required.
Perhaps you may try a more exigent set of parameters:

Code: Select all

\EveryShipout{\ifodd\value{page}\gdef\topfraction{1}\else\gdef\topfraction{0}\fi}
\EveryShipout{\ifodd\value{page}\gdef\bottomfraction{1}\else\gdef\bottomfraction{0}\fi}
\EveryShipout{\ifodd\value{page}\gdef\textfraction{0}\else\gdef\textfraction{1}\fi}
\EveryShipout{\ifodd\value{page}\gdef\floatpagefraction{0}\else\gdef\floatpagefraction{1}\fi}
\gdef\topfraction{0}\gdef\bottomfraction{0}\gdef\textfraction{1}\gdef\floatpagefraction{1}
If this does not work, you may manually insert "phantom" figures to "clean" even pages, avoiding text. For example, let:

Code: Select all

\newcommand{\InsertPhantomFigure}{\begin{figure}[p]\phantom{x}\end{figure}}
Add \InsertPhantomFigure in those parts of the document where you want to get blank left hand pages.
As an added complication, if its possible I'd like to be able to define some smaller floats to go inline using text wrapping.
Don't use the figure or table environment for this. Just directly include graphics with \includegraphics or tables with tabular. You may add captions with the \captionof command defined in the capt-of or caption packages.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
mister_pink
Posts: 2
Joined: Sat Dec 13, 2008 8:38 pm

Re: Force images/tables to verso

Post by mister_pink »

Cheers, that does the trick (with the phantom figures). Not ideal I guess, but it works! I was trying to add a pagebreak command into one of the if statements but it didn't seem to work.
Post Reply