1

I am very new to LaTeX's usage. I have a very big picture which takes about two pages. I found out how to do it on the following link How to include a picture over two pages, left part on left side, right on right (for books)? It has almost worked with some few exceptions.

As a consequence this has changed my entire text after the figure to Latin and I am not able to get it back to English.

In addition, the image is not appearing where I want it to appear but rather 8 pages after the wished position.

\clearpage and \cleardoublepage are not working

here is how I called the image

 \lipsum
 \lipsum
 \twopagepicture{t}{l}{img/myimage.jpeg}{Test}
 \lipsum
 \lipsum

Below is the code in the preambles

\renewcommand{\topfraction}{.99}
\renewcommand{\bottomfraction}{.99}
\renewcommand{\textfraction}{.01}
\makeatletter
\newcommand*{\twopagepicture}[4]{%
  \cleardoublepage
  \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{lipsum}

What could I do to solve these two big problems? Does anyone have any idea on what is going wrong? I want to add that I'm viewing the result in pdf

  • "this has changed my entire text after the figure to latin" - Is it possible that you might be mistaken and in fact this is due to \lipsum? Why don't you try \twopagepicture{t}{l}{img/myimage.jpeg}{Test} without lipsum preceding and following it? (\lipsum generates a bunch of latin text, as 'filler'.) – srao Jun 15 '14 at 19:01
  • @srao thanks a lot. the latin text problem has been solved. in addition the position problem was also solved with \cleardoublepage. you made my day, unfortunately I am not able to give you some rate – zeroday Jun 15 '14 at 19:18
  • Glad it helped. I have posted the comment as an answer below, you may 'accept' it if it has resolved the issue. – srao Jun 15 '14 at 20:19
2

\lipsum generates a bunch of latin text, as 'filler'. If you remove all instances of this and just type the following alone

 \twopagepicture{t}{l}{img/myimage.jpeg}{Test}

the issue is solved.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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