15

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.

  • Use lualatex instead of xelatex – user2478 Oct 26 '15 at 19:15
  • A quick-and-dirty (but functioning) fix: Insert \null\clearpage\pagenumbering{arabic} immediately after \begin{document} -- and throw away the first page... – Mico Oct 26 '15 at 19:22
  • @Herbert: I Never used Lualatex, are there any other differences to care about. How about support for microtype.sty e.g.? – Tobi Oct 26 '15 at 19:33
  • @Mico: Yep, that was my fix too, but I was hoping for a better solution ... – Tobi Oct 26 '15 at 19:34
  • The microtype package works far better under LuaLaTeX than under XeLaTeX. – Mico Oct 26 '15 at 19:40
9

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'.
  • I am as @Tobi using a Mac with TeXLive 2015 and can confirm that the crop.cfg from your answer fixes the issue. (with the crop.cfg of the OP, I get the same problem in the pdf as mentioned in the question). – user4686 Oct 27 '15 at 13:20
  • Indeed your (older) config file works. Any ideas to whom I can report this? Unfortunately there’s no contact information in the manual of crop and the last update was 2003 … – Tobi Oct 27 '15 at 13:43
9

It is a problem with scrbook, with book the example works fine. In the end it boils down to the fact that (newer versions of) scrbook inserts a \special at \begin{document}. One can reproduce the problem with this code:

\documentclass{book}
\usepackage[paperwidth =10cm,paperheight=20cm]{geometry}
\AtBeginDocument{\special {papersize=\the \paperwidth ,\the \paperheight }}
\usepackage[a4,center,cam]{crop}
\usepackage{lipsum}

%\makeatletter\let\scr@ifdvioutput\@gobble \show\@begindocumenthook

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

The code is inserted by scrbook with a \scr@ifdvioutput test, this explains why the problem disappears if one defines \pdfoutput and set it to 1. Imho the problem should be reported to the KOMA author.

Edit

A work around is to add another \special:

\documentclass{scrbook}
\usepackage[paperwidth =10cm,paperheight=20cm]{geometry}
\usepackage[a4,center,cam]{crop}
\AtBeginDocument{\special {papersize=\the \stockwidth ,\the \stockheight }}

\usepackage{lipsum}
\begin{document}
\lipsum
\lipsum
\end{document}
  • Thanks for finding that out! I’ll contact Markus to report this. – Tobi Oct 27 '15 at 14:02
  • @jfbu: I don't understand your remark. graphics loads xetex.def on my machine and not pdftex.def. – Ulrike Fischer Oct 27 '15 at 14:09
  • I posted the issue in the german KOMA-Script-Forum: komascript.de/node/1982 – Tobi Oct 27 '15 at 14:12
  • sorry, got confused by current confusing using `pdftex' graphics driver log message from crop.sty. My bad. Best would be for crop.sty to be updated rather than force it to act as if under pdftex and consequent log messages. – user4686 Oct 27 '15 at 14:17
  • good catch and fix! (deleting my earlier comment where I had erred about graphics) – user4686 Oct 27 '15 at 14:22
5

In July I posted this problem on the KOMA-Script Forum and was told that the new version of KOMA (3.18 and later) set pagesize=auto as a default. Using pagesize=false reverts to the old behaviour, which works correctly with the crop-package.

  • Thanks! I didn’t search the forum before posting my issue … mea culpa O:-) – Tobi Oct 27 '15 at 15:20
0

try adding

pdftex, % or any other renderer

in the options of the package, e.g.:

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

It worked for me.

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.