[Tex/LaTex] Length plus minus other length

calculationslengths

Consider the following example:

\newlength{\textsize}
\makeatletter
\setlength{\textsize}{\f@size pt}
\makeatother

\setlength{\parskip}{12pt plus 1pt} % WORKS
\setlength{\parskip}{\textsize plus 1pt} % FAIL

How to make the failing line work?

Which means: how to set a length to another length plus and/or minus other values?

Best Answer

\newlength{\textsize}
\makeatletter
\setlength{\textsize}{\f@size pt}
\makeatother

\setlength{\parskip}{12pt plus 1pt} % WORKS
\setlength{\parskip}{1\textsize plus 1pt} % FAIL

\showthe\parskip

LaTeX lengths are skip registers so \textsize is a complete glue specification and can not take a further plus component. 1\textwidth coerces this to a dimen, discarding any plus and minus components, so you can add a new plus component.

Related Question