0

I don't understand why, but the following code fails with the error

! Missing \endcsname inserted.
<to be read again> 
                   \myStock 
l.607 \AtBeginDocument
                      {\@nameuse{CROP@init@\CROP@driver}}
? 
! Emergency stop.
<to be read again> 
                   \myStock 
l.607 \AtBeginDocument
                      {\@nameuse{CROP@init@\CROP@driver}}

while if I use \newcommand instead of \setlength, it works great.

Any idea why I can't feed the crop package with length variable, while it works with the geometry package?

Thanks!

MWE:

\documentclass{article}
\usepackage{lipsum}

\newlength{\myWidth}\setlength{\myWidth}{297mm}
% Does not work
\newlength{\myStock}\setlength{\myStock}{302mm}
% Works
% \newcommand{\myStock}{302mm}
\usepackage[
  paperwidth=\myWidth,
  paperheight=\myWidth,
  pdftex=false,dvips=false,vtex=false,
  ]{geometry}

\usepackage[width=\myStock,height=\myStock,center,pdflatex,frame,noinfo]{crop}

\begin{document}%
\lipsum[1-20]
\end{document}

1 Answer 1

2

The expanded form of the lengths registers works:

\newlength{\myWidth}\setlength{\myWidth}{297mm}
\newlength{\myStock}\setlength{\myStock}{302mm}
...
\usepackage[width=\the\myStock,height=\the\myStock,center,pdflatex,frame,noinfo]{crop}

Then the value of the options width and height is 859.27322pt instead of the length register.

2
  • Thanks, then is there any advantages of using length instead of newcommand?
    – tobiasBora
    Commented Nov 11, 2017 at 17:58
  • @tobiasBora It depends on the usage. I do not see much benefit as option for package crop. An advantage can be, if the length is used in calculations. Commented Nov 11, 2017 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .