0

I currently generate a big DIN A1 single-page PDF with TikZ (i.e. a big picture).

In a second document I grab sections of this big picture PDF page with the TeX package pdfpages and put them in several DIN A4 pages. Those pages are not a regular and complete cut-up like a poster or something. Each page will be the grab of a specific rectangular part of the original, possibly with different zoom/scale.

My question is: can I do this in one step with one source (La)TeX file resulting in a single multi-page PDF?

That would mean that I would want to crop&copy&paste from the first page onto the second, third and so on.

  • Well, that could be a job for tikz's spy library see section §72 of the pgfmanual – BambOo Sep 29 '19 at 13:39
  • @BambOo It seems that spy can only be used in the same picture environment. And I know of no way to span a picture across multiple pages. – Robert Siemer Sep 29 '19 at 16:28

1 Answers1

4

I do not have your poster, so I made something up. You can use the following steps:

  1. Create your poster and save it in a \savebox.
  2. Clip on parts of it.

To make the second task more convenient, I added as style that installs local coordinates (as in this answer) and does all the repeating steps. So to clip on a part of the poster you need only to say

\begin{tikzpicture}[poster clip]
  \clip (0.2,0.3) rectangle (0.45,0.5);
\end{tikzpicture}

The coordinates are such that (0,0) is the lower left corner and (1,1) the upper right corner of the poster.

\documentclass{article}
\usepackage{tikz}
\newsavebox\myposter
\sbox\myposter{\begin{tikzpicture}
\draw[left color=blue,right color=red] (0,0) rectangle (12,15)
node[midway,font=\Huge\sffamily\bfseries,text=white,align=center]
{Imagine\\ I was a\\ fancy\\ poster};
\end{tikzpicture}}
\tikzset{poster clip/.style={execute at begin picture={
 \node[overlay,anchor=south west,inner sep=0pt,opacity=0] (poster) {\usebox\myposter};
 \begin{scope}[x={(poster.south east)},y={(poster.north west)}]
},execute at end picture={\node[anchor=south west,inner sep=0pt] (poster) {\usebox\myposter};
\end{scope}}}}
\begin{document}
\usebox\myposter
\clearpage
\section{Blub}
\begin{tikzpicture}[poster clip]
  \clip (0.2,0.3) rectangle (0.45,0.5);
\end{tikzpicture}
\clearpage
\section{Pft}
\begin{tikzpicture}[poster clip]
  \clip (0.45,0.5) circle[radius=4cm];
\end{tikzpicture}
\end{document}

enter image description here

  • The savebox idea is great and works for me, too. I don’t use that opacity trick for measurement and I’m not sure it improves the example: the savebox’s width is already known with \the\wd\myposter. Further, I’m not sure if it makes sense to refer to relative points between 0 and 1. I use coordinate calculations to measure in the units I use in the original “poster” instead. – Robert Siemer Oct 21 '19 at 21:12
  • @RobertSiemer Please feel free to modify the answer for your purposes. It is certainly true that the width is known, yet sometimes there are some surprises when putting stuff in nodes, which I wanted to avoid. Likewise, if you are more comfortable working with absolute coordinates, you only need to drop [x={(poster.south east)},y={(poster.north west)}]. That is, I am sure there are tons of variations, and depending on the use case some variations may be more elegant than this one. –  Oct 21 '19 at 21:29