# Unusual graphics and caption placement

Here is a picture from an Oxford University Press publication, showing two images a small one at the left and a larger one at the right. The unusual part is that the caption of the right image is also placed on the left page.

I am sure there might be another way and I tried a couple, but in order to achieve the layout, I placed the captions using the header of the left page.

There are two issues that concern me.

1. First is to ensure that no more than one image floats on the left page (otherwise the captions will all go amiss). To try and prevent it I have set, the \topnumber=1. I would however like to have this one changed later on. At what point will it be safe to change it?

2. Adding the images to the List of Figures (can't use normal techniques) since both captions appear on the same page, but the images on different pages.

My aim is to have a fully automated solution without any author intervention other than to type the relevant two-image macro \doubletakeimage{matron}{stuartpearson}.

The MWE is simplified a bit, as I took out the width and height calculations as well as additional formatting commands. Also the captions are currently fixed for ease of readability and specified in the ps@caption command.

\documentclass{book}
\makeatletter
\usepackage[showframe=true]{geometry}

\@twosidefalse \@mparswitchfalse % one side option
\reversemarginpar

%% Stick the caption in the head might as well place the first picture also?
\def\asidecaption{\parbox{4.2cm}{{\bfseries Image \thefigure}\par\lorem}%
}
\def\ps@caption{%
\let\@oddfoot\@empty\let\@evenfoot\@empty%
\begin{picture}(0,0)%
\refstepcounter{figure}
\put(-150,-80){\asidecaption\par}%
\refstepcounter{figure}
\put(-150,-370){\asidecaption}%
\end{picture}%
}%
\let\@mkboth\@gobbletwo%
\let\chaptermark\@gobble%
\let\sectionmark\@gobble%
}
\def\doubletakeimage#1#2{%
\renewcommand{\topfraction}{.95}  % ensure seecond image will not float away
\begin{figure}[t]
\thispagestyle{caption}
\includegraphics[width=\textwidth]{#1}%
\end{figure}
\begin{figure}[tp]
\hspace*{-\marginparwidth}\includegraphics[height=0.9\textheight]{#2}
\end{figure}
}
\newcommand\lorem{Fusce adipiscing justo nec ante. Nullam in enim.
Pellentesque felis orci, sagittis ac, malesuada et, facilisis in,
ligula. Nunc non magna sit amet mi aliquam dictum. In mi. Curabitur
sollicitudin justo sed quam et quadd. \par}

\usepackage{graphicx}
\usepackage{lipsum}
\graphicspath{{chapters/}}

\renewcommand{\topfraction}{.95}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.04}
\renewcommand{\floatpagefraction}{.92} % have a high one don't encourage it
\setcounter{topnumber}{1}
\setcounter{bottomnumber}{0}
\setcounter{totalnumber}{3}
\begin{document}

\doubletakeimage{matron}{stuartpearson}
\lipsum[1-4]
\doubletakeimage{matron}{stuartpearson}
\lipsum[1-4]
\end{document}


Any suggestions to alternatives and improvements in the coding are welcomed and appreciated.

-
I found this package tug.ctan.org/tex-archive/macros/latex/contrib/fltpage. It may help you, if I have understood your issue. – gcedo May 2 '12 at 10:01
@Edo Thanks, I am aware of the package, but does not exactly do what I want and would prefer to develop the additional code as there is more I am doing with similar image examples. – Yiannis Lazarides May 2 '12 at 10:24
I think the best way would be to look at every spread as a unit. That is, modify the output routine like for twocolumn, but shipping out two pages at once. That way you have full control over the positioning of floating figures and their captions on both pages of a spread. I could cook up an answer, but it would be a lot of work, so I'd need some indication that (a) this would really be useful and (b) there is no easier, satisfactory way... – Stephan Lehmke May 2 '12 at 15:17
@StephanLehmke IMHO going the output routine way is an overkill. When you use the header with the ps@caption you already in the output routine and you also know thepage reliably, as well as the section marks. Of course via the output routine one need not use any fancy "double image" macros. My caveats are to set the floating limits properly on the left page and reset them later. For example you do not want to end with two images there. On the other hand a solution using the output routine will be more elegant. – Yiannis Lazarides May 2 '12 at 19:03
Well on that spread I'm not seeing a double image but one image which fits into the type area and one image which extends beyond the type area, where the captions are set into the margin, plus a bit of logic for getting caption placement right. That concept will extend easily to a lot of image combinations, in particular such that the images could float to left or right pages if allowed to. But I couldn't imagine to make a formal specification for this without even a technically available concept of "spread". – Stephan Lehmke May 2 '12 at 22:48

The MWE below is a kludge because forcing a page break prevents the float of the first image, so the position of \doubletakeimage need to be adjusted carefully, but solved (so awkward, I admit) the problem of the list of figures.

\documentclass[twoside]{book}

\usepackage{graphicx}
\usepackage{captdef}
\usepackage{xcolor}
\usepackage{lipsum}

\def\doubletakeimage#1#2{%
\pagebreak[4]\marginpar{
\figcaption[little caption fig 1]{This is the first very long caption that is linked to the figure 1}
\vspace{9cm}
{Figure \ref{fig:bigger}. This is a second (fake) very long caption for the right figure in the next page}}
\renewcommand{\topfraction}{.95}  % hard float
\begin{figure}[h]% left-side figure
\framebox{
\begin{minipage}[t]{1\columnwidth}%
%   \includegraphics[height=0.9\textheight]{#1}
Some image called #1 here
\vspace{5cm}\\
\end{minipage}}
\end{figure}

\begin{figure}[t]% right-side figure

\vspace{2cm}\textcolor{red}{\caption[little caption
fig 2]{\label{fig:bigger}This is the true caption that will be hidden by the image}}\vspace{-2cm}
\framebox{
\begin{minipage}[t]{1\columnwidth}%
%\includegraphics[width=\textwidth]{#2}
Some other bigger image named #2 here
\vspace{7cm}
\end{minipage}}
\end{figure}
}

\begin{document}
\listoffigures
\vspace{3cm}
\section*{Odd page without figures, see next page}
\lipsum[1-2]
\doubletakeimage{matron}{stuartpearson}
\lipsum[1-10]
\end{document}


Edit

This modification avoid force page breaks. As he two figure are true floats, now it is not necessary find an exact position. Is enough to put \doubletakeimage somewhere between the first paragraphs of the even page (Not anywhere: if too low the first float could jump to the next page). The vertical position of the second caption is controlled by the position of the macro itself, as will appear at the same level (really is only a margin note).

% remember to pdflatex this MWE twice !
\documentclass{book}
\usepackage[
asymmetric,
marginparsep=.1\textwidth,
marginpar=.3\textwidth,
tmargin=2cm,bmargin=2cm,
left=7cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{captdef}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage[margincaption,
outercaption,raggedright]{sidecap}
\usepackage{marginnote}
\sidecaptionvpos{figure}{t}
\usepackage{fancyhdr}
\fancyfoot{}
\fancyfoot[RO, LE] {\thepage}
\fancyfoot[LO, RE] {\leftmark }
\renewcommand{\footrulewidth}{1pt}
\pagestyle{fancy}

\def\doubletakeimage#1#2{% The macro

\begin{SCfigure}[t!] % left-side figure
\includegraphics
[width=\textwidth,height=\textheight,keepaspectratio]{#1}
\caption[Little caption #1]{
\\ \rule{\linewidth}{0.15em} \bfseries
Long caption of figure #1.
\\ \rule{\linewidth}{0.15em} }
\end{SCfigure}

\begin{figure}[t!]% right-side figure
\vspace{2em} %  True  hidden caption
\caption[Little caption #2]{\label{fig:#2}}
\vspace{-4.2em}
\hspace{-0.4\textwidth}
\includegraphics[width=1.4\textwidth,
height=\textheight,keepaspectratio]{#2}
\end{figure}
\marginnote{\raggedright
Figure \ref{fig:#2}. (next page) \\
\rule{\linewidth}{0.15em} \bfseries
This is the fake long caption of figure #2.   \\
\rule{\linewidth}{0.15em}}
}

\begin{document}
\listoffigures
\chapter{Two figures}
\section{Searching a good place}
\lipsum[1-5] % body text page 3
\lipsum[5] % good place for the macro
\lipsum[6] % good place too in "Sed commodo" paragraph
\doubletakeimage{matron}{stuartpearson}
\lipsum[7] % also can be good place
\lipsum[8] % still there are room here
\lipsum[9] % too late to use the macro
\lipsum[10-16] % wait to page 6 to use the macro
\end{document}

-