Graphics, Figures & TablesSpan a Figure over two Pages

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mirou
Posts: 18
Joined: Thu Apr 29, 2010 4:36 am

Span a Figure over two Pages

Post by mirou »

Hello TeX friends,

I am using Latex and doing my thesis in memoir class.
I have been able to use the \twopagepicture to span a process map over tow opposite pages in my chapter. However, my figure is reproduced at the end of the chapter not under its relative section.

In my chapter here is the code

Code: Select all

\chapter{Cas Pilote:}
\label{chap:Pilote}
\minitoc
\section 
text text text
\twopagepicture{b}{p}{Chapitre8/processmap.jpg}{processus}\label{fig:ATMprocess}
\section
text text text
\end
Im my formats and styles definition file I have the following code:

Code: Select all

\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 {.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{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}
Can anyone help me find a command that would force Latex to produce the figure at the first available even page and not wait until all the chapter is over (40 pages!!!).
Notice that I have used \clearpage and \cleardoublepage but both have absolutely no effect on the positioning of the figure.
Thanks
Last edited by mirou on Sat Mar 17, 2012 2:09 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Span a Figure over two Pages

Post by Stefan Kottwitz »

For information for our readers, the same question has been cross-posted to TeX.SX.

Stefan
LaTeX.org admin
Post Reply