# abs undefinded control structure

have a strange prob with \abs. Even a simple term like \abs{x} does not work.

It does not work out. Undefined control structure will be displayed when using pdflatex.

amsmath-package was used. .aux files were deleted. math mode  was used.

-
Welcome to TeX.SE. The \abs macro is not predefined by most math-related packages I'm familiar with. However, it may easily be defined via \newcommand{\abs}[1]{\left\lvert#1\right\rvert}. This definition assumes implicitly that the macro will be used in math mode only. – Mico Aug 24 '12 at 15:20
Always adding the \left/right is not a good idea in general, see my answer. – daleif Aug 24 '12 at 15:22
the \abs command was defined in an example file distributed with ams document classes. unfortunately, instead of reading the instructions and using the designated template files to launch documents, many people start with the example file, rip (some) things out and put in their own material. this has led to many problems, and not just for authors. ams author packages are being revamped, and the definition of \abs will go away. it was only an example. – barbara beeton Aug 24 '12 at 17:26

Not every conceivable mathematical operator have been defined in advanced. So you neeed to define it. Here is my usual methord

\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}


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

\usepackage{mathtools,etoolbox}
\DeclarePairedDelimiterX{\abs}[1]{\lvert}{\rvert}{\ifblank{#1}{{}\cdot{}}{#1}}


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

Addition: Why is not a good idea to always autoscale, this image says it all

-
To be honest both last two examples look wrong to me about their vertical extent. – percusse Aug 24 '12 at 15:28
that's strange concerning the amsmath package. i was 'sure' that abs was pre-defined. thx. | was currently used because it was only a short (absolute value) term. your hint will be used the next time. :-) – mnemonic Aug 24 '12 at 15:32
@percusse: in which manner? I usually use the following rule: It should be clear to the reader what the fences enclose, but the fences should not be so large that they dominate the expression. In the later there is not much reason to left the |'s extend further down. – daleif Aug 24 '12 at 15:38
I see your argument however, I think they should enclose the index constraints (like the first one without the top excess) otherwise it looks (at least to me) like a misplaced index constraint for the whole abs value. I tend to smash the operator inside the delimiters. – percusse Aug 24 '12 at 15:43
Ah, sorry. I didn't see this. Well, my quick experiment with mathtools : \abs[\Bigg]{\mathop{ \sum_{\substack{1 \le i \le 10\\ 1 \le j \le 5}}^\infty x^{i} y^{j}}} which is almost OK for me but I would even make it a little longer to get the other constraint too. – percusse Aug 24 '12 at 18:43