[Tex/LaTex] Make a length negative

lengthsmacrosspacing

I was wondering if there is a way to have a \negate command which makes lengths negative. So you could do things like:

\newlength{\negativeabovecaptionskip}
\setlength\negativeabovecaptionskip{\negate{\abovecaptionskip}}

\the\abovecaptionskip %prints: 10pt
\the\negativeabovecaptionskip %prints: -10pt

%%But also:
\newlength{\negativeparskip}
\setlength\negativeparskip{\negate{\parskip}}

\the\parskip %prints: 15pt plus 2pt minus 1pt
\the\negativeparskip %prints: -15pt plus 1pt minus 2pt
%(notice that the the plus/minus values switched possitions)

Any ideas?

Best Answer

I do find your second requirement a bit curious. Why should the stretch and shrink part be exchange? Aren't you looking simply for the normal minus sign?

\documentclass[parskip]{scrartcl}
\begin{document}
\newlength{\negativeabovecaptionskip}
\setlength\negativeabovecaptionskip{-\abovecaptionskip}

\the\abovecaptionskip %prints: 10pt

\the\negativeabovecaptionskip %prints: -10pt

%%But also:
\newlength{\negativeparskip}
\setlength\negativeparskip{-\parskip}

\the\parskip %prints: 15pt plus 2pt minus 1pt

\the\negativeparskip %prints: -15pt plus 1pt minus 2pt

\end{document}
Related Question