# \twopagepicture package refining with long caption spanning across the two pages

The \twopagepicture package is definitely worth it when you have many large pictures. But perhaps I'm not getting the required results because I'm not following the advice correctly. Here are some steps I need to clarify:

1. When you say "These type of figures are best to insert them manually". You meant insert in the chapter directly? Where is the \twopagepicture command line then?
2. You adviced to "Try modifying the \twopagepicture by copying it and renaming it". Where should I copy the file? and HOW could I rename it?
3. The commands:

\cleartoevenpage
\includegraphics[height=0.95\textheight]{petra}
\newpage


should come in the chapter I'm writing? How do I combine these commands with the \twopagepicture command? Is the 0.95 indicative of an "OK" rescaling of my picture or should I try other ratios until I reach the desired results?

Last, I used the commands as follows in my chapter:

\cleartoevenpage
\twopagepicture{b}{p}{mypicture.jpg}{very very very very very very very very very very long caption }
\label{fig:mypicture}
\pagebreak
\cleardoublepage


By trying the \cleartoevenpage before the \includegraphics and the \newpage after, I do not get me the required results. Notice that I need to omit all paper margins and that still my float goes to the end of the chapter leaving a blank paper at the required section. Here is the picture

My .sty file has the following code for the \twopagepicture:

\usepackage{caption}
\usepackage{crop}
\usepackage[strict]{changepage}

\makeatletter
\newcommand{\cleartoevenpage}{%
\clearpage%
\ifoddpage\c@page\hbox{}\clearpage\fi}
\makeatother
\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%
\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
\if #1b\else
\caption{#4}%
\fi
\if #2p%
\if #1b%
\fi
\fi
\end{figure}%
\begin{figure}[#1]
\if #2p%
\if #1t%
\fi
\fi
\makebox[\textwidth][l]{%
\if #2p%
\let\mywidth\paperwidth
\hskip-\dimexpr1in+\hoffset+\oddsidemargin\relax
\else
\let\mywidth\linewidth
\fi
\if #2p%
\if #1b%
\fi
\fi
\end{figure}%
}}%
}


working under \documentclass[a4paper,12pt,twoside]{StyleThese}.

Finally, how can I manage a caption that spans above the two pages? If this is not possible, how to produce on the second page a white caption so that the tow parts of the picture level up together?

-

Producing two page spreads in my opinion requires manual intervention. What I mean by this is that you cannot really depend on a magic package or use floating images. I know Martin's solution works, but perhaps within certain constraints and I will leave it up to him to work out an alternative answer.

To use the solution I am proposing here, you need to understand how the image is placed. If you noticed (I said image) as I don't suggest you cut the image in two halves, but keep it intact as one image.

You can get a pdf of the above image to view the page parameters better, if you wish.

Step 1

Make sure that your image's aspect ratio is correct and check that when scaled will not overflow the page. For example in the image above, if we try to have the image fill the page horizontally, it will scale up to a height that will be taller than the page (havoc will ensue and the image will be all over the place and possibly portions of it will disappear). I think that your atm process image has this problem (if the image on the right is pushed down it will overflow the page and the image will move).

Step 2

Make sure the image is placed on an even page. You can do that with the macro \cleartoevenpage or even manually using a \newpage at an appropriate place.

Step 3

Place the image on the left page. This you do using:

 \includegraphics[height=0.78\textheight]{china-05}


(don't use a \begin{figure}..\end{figure}.)

What happens here you will get the page as shown in the image above. The part shown under the grid on the right, gets clipped automatically by the pdf engine.

Step 4

Place the image again on the next page. However, we need to "pull" this image leftwards, so we will only see the portion under the gridlines.

\hspace*{\dimexpr(-2in-\textwidth- 2\evensidemargin)}%
\includegraphics[height=0.78\textheight]{china-05}


Step 5

If you need to add some text on the top, you need to make sure it is in a box of a fixed size and that this box is place on both the left and right pages. I prefer a \vbox; if you more familiar with LaTeX you can use a minipage with a fixed height.

The code actually is very short and so far will be:

% left page
\cleartoevenpage
\checkoddpage%
{\parindent0pt
\vbox to 120pt{\lipsum[1]}%
\includegraphics[height=0.78\textheight]{china-05}}

% right page
{\parindent0pt
\vbox to 120pt{\lipsum[1]}%
\hspace*{\dimexpr(-2in-\textwidth-2\evensidemargin)}
\includegraphics[height=0.78\textheight]{china-05}}


Watch for \parindent, it has to be 0pt. Enclose it in a group {} so it does not affect the rest of the page.

Step 5

If you need to add some text to the right add is as a \parbox or \vbox.

General Suggestions

If you have diagrams or pictures spanning two pages, better to print them on A3 and include them in the final thesis as such. (You can adjust page numbering by leaving two empty pages at the appropriate place).

Work with MWE don't try and do this with the full thesis, you might need to try a few times until you get them right.

Scale down first say to 0.5\textheight and increase slowly to see where problems appear.

You can use pgfpages, which is available as part of the pgf suite, to scale a little if need be and combine the pages as I did with the examples.

The full MWE

\documentclass[twoside]{book}
\usepackage[left=80pt,right=80pt,top=0.75in]{geometry}
\usepackage{graphicx,lipsum}
\usepackage{changepage}
\usepackage{pgf,tikz,pgfpages}
%\usepackage{xlayouts,xcolor,amsmath,fancyhdr}
\makeatletter
\providecommand{\cleartoevenpage}[1][\@empty]{%
\clearpage%
\ifodd\c@page\null#1\clearpage\fi}
\makeatother
%\pagestyle{grid}
\begin{document}
\mainmatter
\null\newpage
%\pgfpagesuselayout{2 on 1}[a3paper,landscape,border shrink=0mm]
% first page
\cleartoevenpage
\checkoddpage%
{\parindent0pt
\vbox to 120pt{\lipsum[1]}%
\includegraphics[height=0.78\textheight]{china-05}}

%secondpage
{\parindent0pt
\vbox to 120pt{\lipsum[1]}%
\hspace*{\dimexpr(-2in-\textwidth-2\evensidemargin)}
\includegraphics[height=0.78\textheight]{china-05}}
\hspace{1em}\parbox[b]{0.35\textwidth}{\lipsum[1-2]}
\end{document}


(The grid and page dimensions were drawn with a package I am busy developing. It is not really ready yet for public release, however for whatever is worth you can get a copy at github).

-