11

I'm using tikz (tikzpicture to be precise) to make some "drawings" (trees). The problem is that my "drawing" is too long to fit on one single page (it's too long). I was wondering what was the best way to display it on two (or more) pages :

  • crop the picture and display it twice, first half on one page and second on second

  • use some option that would allow to display the image on the first page and continue on the second page if the picture is too long... (but how?)

  • ?

Thanks,

15

In my proposed solution, the picture is put into a macro \mypicture which takes rectangle coordinates as parameters. These are used to set the bounding box and clip the picture. This macro is used twice for displaying the picture. Here, I used some overlap between the two parts of the long picture but this can be adjusted easily.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\newcommand*{\mypicture}[2]{%
  \begin{tikzpicture}
  \path[draw=red,use as bounding box] (#1) rectangle ++(#2);% remove 'draw=red' if you don't want a frame
  \clip (#1) rectangle ++(#2);
  % Here comes the actual picture:
  \foreach \n in {1,...,10}
  {
    \path[fill=red!\the\numexpr10*\n\relax!blue,draw=black]
      (0,\the\numexpr3*\n\relax) circle (2cm) node {\Huge\n};
  }
  \end{tikzpicture}
}

\mypicture{-5,15}{10,18}
\clearpage
\mypicture{-5,0}{10,18}

\end{document}

enter image description here

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.