What is the "best LaTeX practices" for writing absolute value symbols? Are there any packages which provide good methods?
Some options include |x| and \mid x \mid, but I'm not sure which is best...
|
I have been using the code below using Since I don't think I have a case where I don't want this to scale based on the parameter, I make use of Swap definition of starred and non-starred command so that the normal use will automatically scale, and the starred version won't:
If you want it the other way around comment out the code between
|
|||||||||||||||||||
|
|
Note if you just use | you get mathord spacing, which is different from the spacing you'd get from paired mathopen/mathclose delimiters or from
|
||||
|
|
\usepackage{amsmath}...\(\lvert x\rvert\);\middenotes a relation symbol and is wrong for the absolute value. – egreg Jan 31 '12 at 23:45$\usepackage{mathtools}...\DeclarePairedDelimiter{\vert}{\lvert}{\rvert}as per your answer to a previous question? tex.stackexchange.com/a/42274/9757 – jamaicanworm Jan 31 '12 at 23:47\vertis not a good choice, as it's already defined. – egreg Jan 31 '12 at 23:50|symbol? – jamaicanworm Feb 1 '12 at 0:16|, but in some situations a certain care is needed. For instance\(|{-1}|=1\)without the braces would come out wrong, while\(\lvert-1\rvert=1\)surely gives correct output. – egreg Feb 1 '12 at 0:22