How can I build a macro that return the absolute value of an argument of another macro? I would like that the \abs
macro return the absolute value of the its argument.
\RequirePackage{tikz}
\newcommand{\abs}[1]{<implementation>}
\newcommand{\command}[2]{\raisebox{\numexpr\abs{#1}*#1\relax\baselineskip}[0pt][0pt]{}{}}
So whether I use a positive or negative number as argument, the expression \abs{#1}
will always be positive.
Best Answer
--1
is legal in\numexpr
, equivalent to1
. Sois what you're looking for. Then
will do.