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}
3

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.

  • Thanks, then is there any advantages of using length instead of newcommand? – tobiasBora Nov 11 '17 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. – Heiko Oberdiek Nov 11 '17 at 18:31

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.