1

I am using using XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/W32TeX) to design a book cover. I thought of writing a generic document with customizable sizes of book width, height, bleed and spine that I can use for books of other sizes also. I am using the calc package to compute the final widths and heights including the spine and/or bleed.

I cannot get crop to work with dynamic width and length. Below is an MWE.

\documentclass[12pt]{article}
\usepackage{calc}
\newlength{\bookwidth}
\newlength{\bookheight}
\newlength{\bookspine}
\newlength{\bookbleed}
\newlength{\ltwidth}
\newlength{\cvrwidth}
\newlength{\cvrheight}
\setlength{\bookwidth}{138mm}   % metric demy 8vo
\setlength{\bookheight}{216mm}  % metric demy 8vo
\setlength{\bookspine}{8mm}     % spine based on number of pages 
\setlength{\bookbleed}{3mm}     % bleed as suggested by printing press
\setlength{\ltwidth}{\bookwidth*\real{2.0} + \bookspine}
\setlength{\cvrwidth}{\bookwidth*\real{2.0} + \bookspine + \bookbleed*\real{2.0}}
\setlength{\cvrheight}{\bookheight + \bookbleed*\real{2.0}}
\usepackage[dvips=false,pdftex=false,vtex=false,margin=0in,paperwidth=\ltwidth,paperheight=\bookheight]{geometry}
%Does not compile with the following
%\usepackage[noaxes,noinfo,cam,dvips,pdftex,center,width=\cvrwidth,height=\cvrheight]{crop}
%The following works though
\usepackage[noaxes,noinfo,cam,dvips,pdftex,center,width=290mm,height=222mm]{crop}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\noindent Book cover content here.\\
\the\ltwidth\\\the\cvrwidth\\\the\cvrheight
\end{document}

1 Answer 1

2

LaTeX expects that package options are simple strings or something, that expands to simple strings. A length register cannot be expanded and will break, for example, when LaTeX tries to find out, if the option is defined. A length register can be expanded by prefixing it with \the:

\usepackage[..., width=\the\cvrwidth, height=\the\cvrheight, ...]{crop}
2
  • Thanks, that works. Wondering why geometry package option works without expanding the register? \usepackage[...,paperwidth=\ltwidth,paperheight=\bookheight]{geometry}
    – user22209
    Jun 4, 2015 at 2:42
  • Package geometry defines and uses a different option handler for proper support of key value options. Package crop implements the key value parsing inside \DeclareOption*, when LaTeX passes the unrecognized options to the package. Jun 4, 2015 at 3:14

You must log in to answer this question.

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