[Tex/LaTex] Using crop package with XeLaTeX

paper-sizexetex

When using the crop package with XeLaTeX the cropping of the first page doesn’t work. While the following document compiles fine with PDFLaTeX the result with XeLaTeX is this:

wring cropping

As you can see the first page has crop marks but the size of the actual cropped paper. Is there a way to fix this?

% !TeX program = xelatex
\documentclass{scrbook}

\usepackage{geometry}
\geometry{paperwidth =10cm,paperheight=20cm}

\usepackage[a4,center,cam]{crop}

\usepackage{lipsum}
\begin{document}
\lipsum
\lipsum
\end{document}

Here are some information about my system and versions: I’m running TeX Live 2015 (Intel 64bit; via MacTeX) on Mac OS X 10.10.5. I’m compiling this document with XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015) and an up-to-date distribution, using the following files:

 *File List*
 scrbook.cls    2015/10/03 v3.19a KOMA-Script document class (book)
scrkbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-dependent basics and keyval usage)
 scrbase.sty    2015/10/03 v3.19a KOMA-Script package (KOMA-Script-independent basics and keyval usage)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty    2015/10/03 v3.19a KOMA-Script package (loading files)
tocbasic.sty    2015/10/03 v3.19a KOMA-Script package (handling toc-files)
scrsize11pt.clo 2015/10/03 v3.19a KOMA-Script font size class option (11pt)
typearea.sty    2015/10/03 v3.19a KOMA-Script package (type area)
geometry.sty    2010/09/12 v5.6 Page Geometry
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
    crop.sty    2003/05/20 v1.9 crop marks (mf)
   color.sty    2014/10/28 v1.1a Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
   xetex.def    2015/09/11 v4.06 LaTeX color/graphics driver for XeTeX (TeX Live/RRM/JK)
infwarerr.sty   2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
    crop.cfg
  lipsum.sty    2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text
 ***********

This is how my crop.cfg looks like (it’s the one shipped with TeX Live. I have made no user-config.

% crop.cfg for xetex - JK - 2007-01-19
% This attempts to persuade crop.sty to work with xetex
% Public domain

\@ifundefined{XeTeXversion}{}{
    %% Force crop.sty to use the "pdftex" driver (i.e., \pdfpagewidth, \pdfpageheight) with XeTeX
    \def\CROP@driver{pdftex}
}

\endinput

%% End of file `crop.cfg'.

I tried to play with the drivers in a new config, these are the results:

In all cases the crop marks are shown.

  • none, vtex: all pages in the cropped size
  • pdftex: all page in A4 except the first one (see screenshot above)
  • dvips: only first page in A4 all others in cropped size

Using geometry’s showcrop=true is impossible since it breaks TikZ current page node coordinates.

Best Answer

I have the following crop.cfg. Try that.

% crop.cfg for xetex - JK - 2006-06-07
% This attempts to persuade crop.sty to work with xetex

\@ifundefined{XeTeXversion}{}{
    %% Use the "pdftex" driver (i.e., \pdfpagewidth, \pdfpageheight) with XeTeX
    \def\CROP@reqdriver{pdftex}

    %% make crop.sty believe this is valid
    \@ifundefined{pdfoutput}{
      \newcount\pdfoutput \pdfoutput=1
    }{}
}

\endinput
%% End of file `crop.cfg'.
Related Question