LaTeX forum ⇒ Graphics, Figures & TablesSpan a Figure over two Pages

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

Span a Figure over two Pages

Postby mirou » Sun Mar 11, 2012 11:16 pm

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
  1. \chapter{Cas Pilote:}
  2. \label{chap:Pilote}
  3. \minitoc
  4. \section
  5. text text text
  6. \twopagepicture{b}{p}{Chapitre8/processmap.jpg}{processus}\label{fig:ATMprocess}
  7. \section
  8. text text text
  9. \end

Im my formats and styles definition file I have the following code:
  1. \usepackage{amsmath,amssymb} % AMS Math %Format& definition of styles Myriam
  2. \usepackage[french]{babel}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage[T1]{fontenc}
  5. \usepackage{lmodern}
  6. \usepackage{multirow}
  7. \usepackage{supertabular}
  8. \usepackage{rotating}
  9. \usepackage{graphicx}
  10. \usepackage{adjustbox}
  11. \usepackage{afterpage}
  12. \usepackage{placeins}
  13. \usepackage{xcolor}
  14. \usepackage{diagbox}
  15. \usepackage{slashbox}
  16.  
  17. % For the `memoir` class remove the following two packages.
  18. % This class already provide the functionality of both
  19. \usepackage{caption}
  20. \usepackage[strict]{changepage}
  21. %%%
  22.  
  23. \setcounter{totalnumber}{1}
  24. \setcounter{topnumber}{1}
  25. \setcounter{bottomnumber}{1}
  26. \renewcommand{\topfraction}{.99}
  27. \renewcommand{\bottomfraction}{.99}
  28. \renewcommand{\textfraction}{.01}
  29.  
  30. \makeatletter
  31. \newcommand*{\twopagepicture}[4]{%
  32. \checkoddpage
  33. \ifoddpage
  34. \expandafter\@firstofone
  35. \else
  36. \expandafter\afterpage
  37. \fi
  38. {\afterpage{%
  39. \if #1t%
  40. \if #2p%
  41. \thispagestyle{empty}%
  42. \afterpage{\thispagestyle{empty}}%
  43. \fi
  44. \fi
  45. \begin{figure}[#1]
  46. \if #2p%
  47. \if #1t%
  48. \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
  49. \fi
  50. \fi
  51. \if #1b%
  52. \caption{#4}%
  53. \fi
  54. \makebox[\textwidth][l]{%
  55. \if #2p\relax
  56. \let\mywidth\paperwidth
  57. \hskip-\dimexpr1in+\hoffset+\evensidemargin\relax
  58. \else
  59. \let\mywidth\linewidth
  60. \fi
  61. \adjustbox{trim=0 0 {.5\width} 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
  62. \if #1b\else
  63. \caption{#4}%
  64. \fi
  65. \if #2p%
  66. \if #1b%
  67. \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
  68. \fi
  69. \fi
  70. \end{figure}%
  71. \begin{figure}[#1]
  72. \if #2p%
  73. \if #1t%
  74. \vspace*{-\dimexpr1in+\voffset+\topmargin+\headheight+\headsep\relax}%
  75. \fi
  76. \fi
  77. \makebox[\textwidth][l]{%
  78. \if #2p%
  79. \let\mywidth\paperwidth
  80. \hskip-\dimexpr1in+\hoffset+\oddsidemargin\relax
  81. \else
  82. \let\mywidth\linewidth
  83. \fi
  84. \adjustbox{trim={.5\width} 0 0 0,clip}{\includegraphics[width=2\mywidth]{#3}}}%
  85. \if #2p%
  86. \if #1b%
  87. \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%
  88. \fi
  89. \fi
  90. \end{figure}%
  91. }}%
  92. }
  93. \makeatother
  94. \usepackage{natbib}
  95. \usepackage{array}
  96. \usepackage{booktabs,tabularx}
  97. \usepackage{longtable}
  98. \usepackage{ltxtable}
  99. \usepackage{xcolor}\usepackage{multicol}
  100. \usepackage{verbatim}
  101. \usepackage[normalem]{ulem}
  102. \usepackage{color}
  103. \definecolor{forestgreen}{rgb}{0.13,0.54,0.13}
  104. \usepackage[left=1.5in,right=1.3in,top=1.1in,bottom=1.1in,includefoot,includehead,headheight=13.6pt]{geometry}
  105. \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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9406
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Mar 11, 2012 11:26 pm

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

Stefan
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 5 guests