7

How can I get Latex to add a constant to a value as part of a \vspace argument?

Here's my minimal example:

\documentclass{article}
\usepackage{calc}

\begin{document}
ab
%\vspace{20mm+10mm} %documentation of the calc package says it needs at least one dimen register
\newlength{\mylength}\setlength{\mylength}{20mm} \vspace{\mylength+10mm} 
\\cd
\end{document}

Which always produces ab +10mm cd.

  • 3
    \vspace{\dimexpr\mylength+10mm\relax}; but \vspace{\mylength}\vspace{10mm} is pretty much equivalent, because the second skip won't be used as a break point (unless \lastskip or \unskip are involved). – egreg Apr 7 '13 at 16:37
7

Use eTeX's features. Try the following

\vspace{\dimexpr\mylength+10mm\relax} 

You won't need the calc package.

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.