# Geometry and layouts - problem with crop marks and Tikz current page

The issue is as follows:

1. I am laying out an approximately square page on A3 stock using geometry.
2. Because it is duplexed, it has to be centered and the cropping is critical
3. If the layout does not go to the paper edge there is not an issue. MWE1

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage{geometry}

\geometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=217mm,layouthoffset=60mm,layoutvoffset=30mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}
\begin{document}
\lipsum[1]
\end{document}


1. However I think it is often the case that layouts within bigger stock will extend to the full dimension of the stock along one axis (so only 2 cuts needed). In this case the crop marks are not really usable, and the critical part of them falls off the stock (and won't print either as it is on the paper edge): MWE2

    \geometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=297mm,layouthoffset=60mm,layoutvoffset=0mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}


So I want to create some sort of crop mark at the layout edge (even a small dot or a line segment ending at the edge. How can I do this? I really want to manage the layout with geometry and not with the crop package.

I thought to use Tikz to draw something, but this raises another issue with setting a layout with geometry. Tikz "current page" does not locate to the page layout but rather to the stock edges (as shown in MWE below). So this also breaks all my existing Tikz code that uses the page position. How to correct for this as well as produce the crop mark at the page edge as opposed to the paper edge. MWE3

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage{geometry}
\usepackage{tikz}

\geometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=297mm,layouthoffset=60mm,layoutvoffset=0mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}

\begin{document}

\lipsum[1]

\tikz[remember picture,overlay] {%
\draw [blue,line width=5mm]
(current page.south west)
rectangle
(current page.north east)
}%

\end{document}


• I think a clue to getting geometry to produce proper crop marks when at the paper edge may lie here: tex.stackexchange.com/questions/291344/… -- though I don't know how to make use of that May 22 '19 at 11:27

Using egreg's answer to How to print (or use) the values of geometry properties in document page? and the node definition macro in tikzpagenodes, I've defined nodes corresponding to the layout area. These are automatically calculated using the paper and layout dimensions. The first page uses your MWE1 geometry, and the second page uses your MWE2 geometry.

\documentclass[a4paper]{book}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc,fit}
\makeatletter
\newcommand{\geometrylen}[1]{\csname Gm@#1\endcsname}
\@newtikzpagenode{current page layout area}{%
\def\northeast{%
\pgfpoint{\paperwidth-\geometrylen{layouthoffset}}
{\paperheight-\geometrylen{layoutvoffset}}
}
\def\southwest{%
\pgfpoint{\paperwidth-\geometrylen{layouthoffset}-\geometrylen{layoutwidth}}
{\paperheight-\geometrylen{layoutvoffset}-\geometrylen{layoutheight}}
}%
}
\makeatother

\geometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=217mm,layouthoffset=60mm,layoutvoffset=30mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}

\begin{document}
\lipsum[1]
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page layout area.south west) rectangle (current page layout area.north east);
\end{tikzpicture}
\clearpage
\newgeometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=297mm,layouthoffset=60mm,layoutvoffset=0mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}
\lipsum[2]
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page layout area.south west) rectangle (current page layout area.north east);
\end{tikzpicture}
\end{document}


• Ah.. that is good May 24 '19 at 0:35

Perhaps the most straightforward way is to simply redefine the crop marks to be drawn the other direction (i.e., away from the edge). Page 1 below is based on your first MWE, whereas page 2 is based on the second.

\documentclass{book}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{picture}

\makeatletter
\def\Gm@cropmark(#1,#2,#3,#4){%
\begin{picture}(0,0)
\setlength\unitlength{1truemm}%
\linethickness{0.25pt}%
\put(#3,0){\line(#1,0){17}}%
\put(0,#4){\line(0,#2){0.495\Gm@layoutheight}}%
\end{picture}}%

\renewcommand*{\Gm@pageframes}{%
\vb@xt@\z@{%
\ifGm@showcrop
\vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset%
\hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset%
\vb@xt@\Gm@layoutheight{%
\let\protect\relax
\hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,-1,-3,0)\hfil\Gm@cropmark(1,-1,3,0)}%
\vfil
\hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,1,-3,0)\hfil\Gm@cropmark(1,1,3,0)}}%
\hss}%
\vss}%
\fi%
\ifGm@showframe
\if@twoside
\ifodd\count\z@
\let\@themargin\oddsidemargin
\else
\let\@themargin\evensidemargin
\fi
\fi
\moveright\@themargin%
\vb@xt@\z@{%
\vskip\topmargin\vb@xt@\z@{\vss\Gm@hrule}%
\@tempdima\textwidth
\if@mparswitch
\ifodd\count\z@
\Gm@vrules@mpi
\else
\Gm@vrules@mpii
\fi \else
\Gm@vrules@mpi
\fi
\vb@xt@\z@{\vss\Gm@hrule}%
\vskip\footskip\vb@xt@\z@{\vss\Gm@hruled}%
\vss}%
\fi%
}}%
\makeatother

\geometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=217mm,layouthoffset=60mm,layoutvoffset=30mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}

\begin{document}
\lipsum[1]

\newgeometry{twoside=true,landscape,%
layoutwidth=300mm,layoutheight=297mm,layouthoffset=60mm,layoutvoffset=0mm,showcrop,showframe,
bindingoffset=5mm,left=32mm, textwidth=197mm,marginparsep=4mm,marginparwidth=47mm,%
a3paper,}

\lipsum[2]
\end{document}


If you do not want to load the picture package, you can hard-code the vertical crop mark length into the picture environment with something like \put(0,#4){\line(0,#2){108}}

• Yes for some reason tikzpagenodes (text area etc) do work correctly, but the "current page" coordinates do not - as shown above. The marks should go at the logical page boundary (not the paper border as above, or the text border). Ideally just outside that border so they are cropped out in the cut. Put another way, the left hand side of the blue box above is not at the page boundary albeit that is what you told it to do. May 21 '19 at 16:45
• Just to clarify - crop marks need to go at (or better still indicate without actually touching) the borders of the logical page, not the text block. They are for physically cutting the paper. May 21 '19 at 18:31
• @AubreyBlumsohn Please see my edited answer. Here, you would cut along the inner edge of the blue lines to produce a nearly square physical page. The top and bottom edges of the stock would also be the top and bottom edges of the paper. Is this correct?
– erik
May 21 '19 at 19:24
• OK idea is getting there. It is not the marginpar though -- to the left it would be the bindingoffset+left margin (in this instance 5mm+32mm) from left text area and to right, the right margin (not explicitly stated in this geometry specification but essentially page width minus textwidth minus 32+5 from other side). If you look at 2nd image this thread you see that a glimmer of crop marks are actually drawn, and crop marks will be the same as those shown in image1 (MWE1). Left & right margins are not the same - they are specified in geometry -- and swopped on reverse of the paper. May 21 '19 at 20:04
• The more general question is why current page text area.north east (etc) are not correct when geometry specifies a differing page sizes and paper sizes. It should follow the paper not the page (unlike package tikzpagenodes which gets its positions correct as you say). To understand better try MWE1 - what you draw should match the shown crop marks on both sides of the paper (more lipsum needed for a page 2) May 21 '19 at 20:07