[Tex/LaTex] Crop package in a document with TikZ graphics

croptikz-pgf

My Problem Briefly

I've created an address book for my son's kindergarten using XeLaTeX. I used TikZ for creating the headers and footers and some other graphics. The book is in DIN A6 format. The printer asked me for crop marks since she will be printing the pages in a larger format and then cutting them down to DIN A6. When I use the crop package (e.g., with [cam,a5,center]) the TikZ graphics, which are positioned with coordinates, are misplaced since their coordinates then apply to the physical page size specified in the crop package options.

I am using Texmaker and MiKTeX 2.9 on Windows 7.

One Possible Solution:
I could "simply" adjust the coordinates of all the TikZ graphics to reflect the size of the pre-cropped physical page (DIN A5) so that they will be where they need to be on the DIN A6 page once it is cropped. As the document hast 252 pages, this would be quite a lot of work, however. And I would rather not because I may also want to produce a digital version of the address book.

My Question:
Is there a way to set up the crop package or my preamble such that the TikZ graphics' coordinates remain based on the DIN A6 page specification even when I am using an additional, larger physical page specification for cropping purposes?

Here is the preamble and the code of the example images (the one difference in the two images being the crop package):

\documentclass[10pt,twoside,openright,a6paper]{scrbook}

\usepackage[xetex]{graphicx}
\usepackage[no-math]{fontspec}
\usepackage{xunicode}% provides unicode character macros 
\defaultfontfeatures{Mapping=tex-text}
\usepackage{xunicode}

\setmainfont[]{DINNeuzeitGroteskStd-Light}
\setsansfont[]{DINNeuzeitGroteskStd-BdCond}

\usepackage{polyglossia}

\usepackage{microtype}

\setdefaultlanguage[spelling=new,babelshorthands=true]{german}

\usepackage[german]{translator}

\usepackage[top=1.2cm,inner=.5cm,outer=.5cm,bottom=1.2cm]{geometry}

\usepackage[cam,a5,center]{crop} %IN THE OTHER VERSION OF THE PDF FILE THIS PACKAGE IS OFF.

\usepackage{color}

\usepackage{setspace}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[LE]{\begin{tikzpicture}[remember picture,overlay]
\node [xshift=-1mm,yshift=-1mm] at (current page.south west)
[text width=10mm,text depth=1.2ex,text height=4mm,fill=violet!100,above right,text=white,align=center]
{\mbox{\hspace{.08cm}}\textsf{\thepage}};
\end{tikzpicture}}

\fancyfoot[RO]{\begin{tikzpicture}[remember picture,overlay]
\node [xshift=94mm,yshift=-1mm] at (current page.south west)
[text width=9mm,text depth=1.2ex,text height=4mm,fill=violet!100,above right,text=white,align=center]
{\textsf{\thepage}};
\end{tikzpicture}}

\fancyhead{} % clear all header fields

\fancyfoot[C]{}
\renewcommand{\headrulewidth}{0pt}

\usepackage{tocstyle}
\newtocstyle[allwithdot][]{mytocstyle}{\settocfeature[-1]{entryhook}{\normalsize}}
\usetocstyle{mytocstyle}
\settocstylefeature[0]{entryvskip}{2pt}

\makeatletter
\renewcommand*\l@chapter{\bprot@dottedtocline{1}{1.4em}{2.3em}}% no indentation
\renewcommand{\@pnumwidth}{1.6em}
\renewcommand{\@tocrmarg}{4em}
\makeatother

\usepackage{float}

\usepackage{tabularx}
\usepackage{booktabs}

\usepackage{rotating}

\usepackage{ragged2e}

\usepackage{array}
\usepackage{colortbl}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{amsmath,amssymb}
\usepackage{verbatim}
\usepgflibrary{arrows}
\usetikzlibrary{automata}
\usetikzlibrary{arrows,decorations.pathmorphing,decorations.text,backgrounds,positioning,fit,petri,intersections,shapes.multipart} 


\usepackage{multirow}

\usepackage[small,raggedright]{titlesec}
\titlespacing*{\chapter}{0pt}{0cm}{1cm}
\titleformat*{\chapter}{\color{violet}\bf\sf}
\titleformat*{\section}{\color{violet}\bf\sf}

\setkomafont{caption}{\footnotesize}

\usetikzlibrary{automata}
\usetikzlibrary{arrows,decorations.pathmorphing,decorations.text,backgrounds,positioning,fit,petri,intersections,shapes.multipart,calendar}

\usepackage[labelformat=empty]{caption}
\captionsetup{margin={1cm,1cm},justification=centering}


\usepackage[hyperfootnotes=false]{hyperref}

\hyphenation{Na-tur-wis-sen-schaften}

\usepackage{pbox}

\usepackage[autostyle,german=guillemets]{csquotes}

\newcommand{\longpage}{\enlargethispage{\baselineskip}}
\newcommand{\shortpage}{\enlargethispage{-\baselineskip}}

\usepackage{marvosym}

\urlstyle{same}

\begin{document}

\chapter*{Child's Name}
\addcontentsline{toc}{chapter}{\textnormal{Child's Name}}
\thispagestyle{fancy}

\begin{tikzpicture}[remember picture,overlay]
\node [xshift=61mm,yshift=140.5mm] at (current page.south west)
[text width=42mm,text depth=.7ex,text height=1.5cm,fill=violet!100,above right,text=white]
{\hfill{}\textsf{Child's Name}\mbox{\hspace{.45cm}}};
\end{tikzpicture}


\noindent
Text Text Text . . .

\vfill

\noindent
Address Information

\end{document}

Using the crop package:

without crop

Not using the crop package:

using crop

Best Answer

The TikZ overlay and remember picture options need two compile cycles to position the objects on the page. You can use this property to achieve what you want in a simple matter, this is not a perfect solution but a simple workaround:

  1. Compile with the crop-package turned off until everything is stable.
  2. Compile only once with the crop-package enabled. The coordinates are correct then and TikZ has not yet realized that the page format changed. The output looks as follows:

enter image description here

And please post a minimal working example, as not everybody has special fonts, etc. available and they distract from the main issue.

Related Question