I know all of the following are used for showing the absolute value:

`$\lvert x \rvert$`

`$| x |$`

`$\mid x \mid$`

I myself think that there is another one `\abs`

; but I can't use this last one.

What is the difference between them?

Skip to content
# [Tex/LaTex] Difference between symbols for absolute value

symbols

I know all of the following are used for showing the absolute value:

`$\lvert x \rvert$`

`$| x |$`

`$\mid x \mid$`

I myself think that there is another one `\abs`

; but I can't use this last one.

What is the difference between them?

## Best Answer

You ask for the differences and here's an analysis for them.

First let's get rid of the last case:

`\mid`

is a relation symbol like`=`

or`<`

and TeX adds spaces around it that disqualify the command from being used for the absolute value.The other two seem good, but the first one is better as it doesn't need precautions. The fact is that

`|`

is considered an ordinary symbol, whereas`\lvert`

is an opening (like`[`

) and`\rvert`

is a closing (like`]`

).Let's compare some cases.

You can see in the picture that

`\lvert`

and`\rvert`

produces the right spacing in all cases, whereas`|...|`

doesn't. Not to speak about`\mid`

.Using

`|`

would force you to inputYou can

define`\abs`

as suggested in answers to Absolute Value Symbols but I recommendto follow the suggestion of makingnot`\left`

and`\right`

automatic, because it will most of the time choose a wrong size.