[Tex/LaTex] \abs produces “undefined control structure” error


I'm getting an Undefined control structure error when I use \abs, even for a simple term like \abs{x}.

I'm using pdflatex and the amsmath package in math mode $ $. I've also tried deleting .aux files.

Do you have any advice?

Best Answer

Not every conceivable mathematical operator has been defined in advance. So you neeed to define it. Here is my usual method:


Then \abs{x} = \lvert x \rvert, \abs*{x}=\left\lvert x \right\rvert and say \abs[\big]{x} = \bigl\lvert x \bigr\rvert.

In recent projects I've extended it a bit with


Then one can write \abs{}: \mathbb{R}\to[0,\infty) and \abs{} will added a centered dot to indicate an empty argument.

Addition: Here's an example of why it's not always a good idea to autoscale:

enter image description here