I am basically reasking the same question as here, which hasn't had any definitive answer even yet.
I restate the problem. The MWE
\documentclass{book}
\usepackage{calc}
\begin{document}
\hspace{-\widthof{abc}}
\end{document}
produces the following errors:
6: Missing number, treated as zero. \hspace{-\widthof{abc}}
6: Illegal unit of measure (pt inserted). \hspace{-\widthof{abc}}
6: Package calc Error: `\widthof ' invalid at this point. \hspace{-\widthof{abc}}
Questions:
\hspacesurely does take negative values and\widthofdoes produce lengths, so why doesn't it work?- Is there a way to achieve what is intended without resorting to the tedious
\newlengthandsetlength?

calcneeds to parse for the\widthofand then alters the way\hspaceworks (there is no expandable way to get the width of arbitrary text, afaik), and seeminglycalcdidn't implement-\widthofin its parser, so not much you can do about it, other than using\newlength\mytmplength\newcommand\hspaceNegWd[1]{\settowidth\mytmplength{#1}\hspace{-\wd\mytmplength}}. – Skillmon Jan 25 '24 at 07:40\makebox[0pt][l]{abc}, instead of backing up by the width. – egreg Jan 25 '24 at 11:24