Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have been able to use the \twopagepicture package with success (all margins, appearances, etc.) correspond to what I have been looking for one of my wide figures in the thesis, however, it only gets at the end of the chapter not right after the text where it is supposed to introduce the figure. Is there a particular command I should add to force the figure to the next even/odd pages? I have tried the \clearpage before the next section but still it is.

I am working on a memoir like class that I have found useful for french style memoires. Here is what you can find on my styles file:

\usepackage{amsmath,amssymb}             % AMS Math %Format& definition of styles Myriam
\usepackage[french]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{multirow}
\usepackage{supertabular}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{afterpage}
\usepackage{placeins}
\usepackage{xcolor}
\usepackage{diagbox}
\usepackage{slashbox}

% 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 {\mywidth} 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={\mywidth} 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{natbib}
\usepackage{array}
\usepackage{booktabs,tabularx}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{xcolor}\usepackage{multicol}
\usepackage{verbatim}
\usepackage[normalem]{ulem}
\usepackage{color}
\definecolor{forestgreen}{rgb}{0.13,0.54,0.13}
\usepackage[left=1.5in,right=1.3in,top=1.1in,bottom=1.1in,includefoot,includehead,headheight=13.6pt]{geometry}
\renewcommand{\baselinestretch}{1.05}





% Table of contents for each chapter

\usepackage[nottoc, notlof, notlot]{tocbibind}
\usepackage[french]{minitoc}
\setcounter{minitocdepth}{3}
\mtcindent=15pt
% Use \minitoc where to put a table of contents

\usepackage{aecompl}

% Glossary / list of abbreviations

\usepackage[intoc]{nomencl}
\renewcommand{\nomname}{Liste des Abréviations}

\makenomenclature

% My pdf code

\usepackage{ifpdf}

\ifpdf
  \usepackage[pdftex]{graphicx}
  \DeclareGraphicsExtensions{.jpg}
  \usepackage[a4paper,pagebackref,hyperindex=true]{hyperref}
\else
  \usepackage{graphicx}
  \DeclareGraphicsExtensions{.ps,.eps}
  \usepackage[a4paper,dvipdfm,pagebackref,hyperindex=true]{hyperref}
\fi

\graphicspath{{.}{images/}}

%nicer backref links
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifcase #1 %
(Non cité.)%
\or
(Cité en page~#2.)%
\else
(Cité en pages~#2.)%
\fi}
\renewcommand*{\backrefsep}{, }
\renewcommand*{\backreftwosep}{ et~}
\renewcommand*{\backreflastsep}{ et~}

% Links in pdf
\usepackage{color}
\definecolor{linkcol}{rgb}{0,0,0.4} 
\definecolor{citecol}{rgb}{0.5,0,0} 

% Change this to change the informations included in the pdf file

\hypersetup
{
bookmarksopen=true,
pdftitle="EFFETS DE LA FLEXIBILITÉ ET LA STANDARDISATION DES SYSTÈMES D'INFORMATION SUR L'INNOVATION DE SERVICE DANS LES OPÉRATIONS BANCAIRES SOUS -TRAITÉES",
pdfauthor="Myriam RAYMOND", %auteur du document
pdfsubject="Flexibilité et standardisation des SI dans les BPOs", %sujet du document
%pdftoolbar=false, %barre d'outils non visible
pdfmenubar=true, %barre de menu visible
pdfhighlight=/O, %effet d'un clic sur un lien hypertexte
colorlinks=true, %couleurs sur les liens hypertextes
pdfpagemode=None, %aucun mode de page
pdfpagelayout=SinglePage, %ouverture en simple page
pdffitwindow=true, %pages ouvertes entierement dans toute la fenetre
linkcolor=linkcol, %couleur des liens hypertextes internes
citecolor=citecol, %couleur des liens pour les citations
urlcolor=linkcol %couleur des liens pour les url
}

% definitions.
% -------------------

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{2}

% Some useful commands and shortcut for maths:  partial derivative and stuff

\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\def\abs{\operatorname{abs}}
\def\argmax{\operatornamewithlimits{arg\,max}}
\def\argmin{\operatornamewithlimits{arg\,min}}
\def\diag{\operatorname{Diag}}
\newcommand{\eqRef}[1]{(\ref{#1})}

\usepackage{rotating}                    % Sideways of figures & tables
%\usepackage{bibunits}
%\usepackage[sectionbib]{chapterbib}          % Cross-reference package (Natural BiB)
%\usepackage{natbib}                  % Put References at the end of each chapter
                                         % Do not put 'sectionbib' option here.
                                         % Sectionbib option in 'natbib' will do.
\usepackage{fancyhdr}                    % Fancy Header and Footer

% \usepackage{txfonts}                     % Public Times New Roman text & math font

%%% Fancy Header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fancy Header Style Options

\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings

%\renewcommand{\chaptermark}[1]{         % Lower Case Chapter marker style
%  \markboth{\chaptername\ \thechapter.\ #1}}{}} %

%\renewcommand{\sectionmark}[1]{         % Lower case Section marker style
%  \markright{\thesection.\ #1}}         %

\fancyhead[LE,RO]{\bfseries\thepage}    % Page number (boldface) in left on even
% pages and right on odd pages
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}      % Chapter in the right on even pages
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}     % Section in the left on odd pages

\let\headruleORIG\headrule
\renewcommand{\headrule}{\color{black} \headruleORIG}
\renewcommand{\headrulewidth}{1.0pt}
\usepackage{colortbl}
\arrayrulecolor{black}

\fancypagestyle{plain}{
  \fancyhead{}
  \fancyfoot{}
  \renewcommand{\headrulewidth}{0pt}
}

\usepackage{MyAlgorithm}
\usepackage[noend]{MyAlgorithmic}

%%% Clear Header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clear Header Style on the Last Empty Odd pages
\makeatletter

\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
  \hbox{}%
  \thispagestyle{empty}%              % Empty header styles
  \newpage%
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% Prints your review date and 'Draft Version' (From Josullvn, CS, CMU)
\newcommand{\reviewtimetoday}[2]{\special{!userdict begin
    /bop-hook{gsave 20 710 translate 45 rotate 0.8 setgray
      /Times-Roman findfont 12 scalefont setfont 0 0   moveto (#1) show
      0 -12 moveto (#2) show grestore}def end}}
% You can turn on or off this option.
% \reviewtimetoday{\today}{Draft Version}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

\newenvironment{maxime}[1]
{
\vspace*{0cm}
\hfill
\begin{minipage}{0.5\textwidth}%
%\rule[0.5ex]{\textwidth}{0.1mm}\\%
\hrulefill $\:$ {\bf #1}\\
%\vspace*{-0.25cm}
\it 
}%
{%

\hrulefill
\vspace*{0.5cm}%
\end{minipage}
}

\let\minitocORIG\minitoc
\renewcommand{\minitoc}{\minitocORIG \vspace{1.5em}}



\newenvironment{bulletList}%
{ \begin{list}%
    {$\bullet$}%
    {\setlength{\labelwidth}{25pt}%
     \setlength{\leftmargin}{30pt}%
     \setlength{\listparindent}{20pt}%
     \setlength{\itemsep}{\parsep}}}%
{ \end{list} }

\newtheorem{definition}{Définition}
\renewcommand{\epsilon}{\varepsilon}

% centered page environment

\newenvironment{vcenterpage}
{\newpage\vspace*{\fill}\thispagestyle{empty}\renewcommand{\headrulewidth}{0pt}}
{\vspace*{\fill}}

And this is how my chapter looks like:

    \chapter{Cas Pilote:}
    \label{chap:Pilote}
    \minitoc
    \twopagepicture{b}{p}{Chapitre8/ATMprocessmap.jpg}{Shéma du processus de dévidage des enveloppes deposées par les clients dans les guichets automatiques.}\label{fig:ATMprocess}
    \section % another section
\end

Could you please help in telling me why the process picture is shifted till the end of the chapter and does not take its place after the \twopagepicture environment? I still am facing a shifting between the left portion of the picture and the right portion (amounting to the caption's space). I totally depend on you figuring out what packages &/or commands are conflicting and resulting in these two issues please.


OK. I seem a bit clearer on this oversize image. 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: a) 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? b)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? c) 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}{Chapitre8/ATMprocessmap.jpg}{Schéma du processus de dévidage des enveloppes de paiement déposées dans les guichets automatiques}
    \label{fig:ATMprocess}
    \pagebreak 
    \cleardoublepage

By trying the \cleartoevenpage before the \includegraphics and the \newpage after 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. How could I manage a caption that spans above the two pages?

share|improve this question
2  
The problem would be much more comprehensible if you add a proper minimal example to your question and give a hint where to find this »twopagepicture« package. –  Thorsten Donig Mar 11 '12 at 20:59
    
It seems that this cross-post contains some code: SPAN a figure over two pages. –  Stefan Kottwitz Mar 11 '12 at 21:21
    
I did add the minimal example and am really waiting "desperatly" for some help. S.O.S –  Myriam Iskander Mar 16 '12 at 23:54
    
@MyriamIskander Can you post the offending image somewhere on the net, it might be able to be positioned quite easily otherwise, depending on the aspect ratio. You need also to add the class you need in your MWE. –  Yiannis Lazarides Mar 17 '12 at 0:39
add comment

1 Answer

up vote 3 down vote accepted

The reason has to do with an oversize image. As LaTeX cannot fit it on a page it will float to the end. These type of figures are best to insert them manually. You will need to define a different environment for this. Try modifying the \twopagepicture by copying it a renaming it and just comment out the begin{figure} and \end{figure}.

\newcommand*{\twopagepicture}[4]{% copy twopagepicture an comment out
    .....
 %   \begin{figure}[#1]
    ....                
 %    \end{figure}%
 %   \begin{figure}[#1]
    .....     
 %   \end{figure}%
   ......
}

This ensures that the images will be shown exactly where placed.

To have a correctly placed two page spread firstly, one needs a method to clear to an even page, normally I would code it as follows:

\usepackage[strict]{changepage}
\makeatletter
\newcommand{\cleartoevenpage}{%
  \clearpage%
  \ifoddpage\c@page\hbox{}\clearpage\fi}

The second issue to take into consideration, is that the image width is always larger than the \textwidth dimension and hence any scaling must be done on the \textheight. This is important, otherwise you will get a new page.

enter image description here

The even page image is simply placed normally but issuing a \cleartoevenpage before the placement and a \newpage after it, producing the image shown above.

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

The odd page image, will have to be shifted to the left by \textwidth.

 \hspace*{-\textwidth}\includegraphics[height=0.95\textheight]{petra}\hspace{1em}

enter image description here

The caption can be placed using a parbox or a minipage. In this case I have used a parbox. If your captions will have more than a paragraph of text, then use a minipage. Depending on the amount of text you have it may look better if you shift it slightly up or down. This can be done either using a vspace command or use a rule (I prefer the latter as I can have a visual clue and only zero the width at the final copy).

  \parbox[b]{0.25\textwidth}{\lipsum*[1-2]\par\rule{1pt}{50pt}}

You can see the rule in the last image below.

enter image description here

Full MWE

\documentclass{book}
\usepackage[left=0pt,right=0pt,top=0.5in,bottom=0.5in]{geometry}
\usepackage{graphicx,lipsum,caption,crop}
\usepackage[strict]{changepage}
\makeatletter
\newcommand{\cleartoevenpage}{%
  \clearpage%
  \ifoddpage\c@page\hbox{}\clearpage\fi}
\begin{document}
First page

\cleartoevenpage
\includegraphics[height=0.95\textheight]{petra}
\newpage
\hspace*{-\textwidth}\includegraphics[height=0.95\textheight]{petra}\hspace{1em}
\parbox[b]{0.25\textwidth}{\lipsum*[1-2]\par\rule{1pt}{50pt}}
\end{document}

Hope this helps.

share|improve this answer
    
Hello @Yiannis the document class is \documentclass[a4paper,11pt,twoside]{StyleThese} I didn't understand what you meant with comment out. Did you mean remove delete or just putting the % comment?? I'm not sure I am understanding. –  Myriam Iskander Mar 17 '12 at 23:24
    
@MyriamIskander By comment out I mean just put the % as I marked it above. –  Yiannis Lazarides Mar 18 '12 at 3:08
    
Tried this option, but had very puzzled results (even afer several compilations). The picture gets parts onto the same page with text overlapping on it. Plus no caption appears with the figure. –  Myriam Iskander Mar 18 '12 at 12:24
    
But the \pagebreak \cleardoublepage did force the figure to appear at the right place. The problem is now to account for the caption shifting –  Myriam Iskander Mar 18 '12 at 12:30
    
@MyriamIskander It is difficult to tell without having a knowledge of the image. Can you post it somewhere? –  Yiannis Lazarides Mar 18 '12 at 16:07
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.