Skip to content
All LaTeX symbols

Absolute value and norm (|x|, ‖x‖)

Delimiters

|x|

LaTeX command

|x|

plain bars

Use inside math mode: $|x|$ — base LaTeX, KaTeX and MathJax

Plain | works but LaTeX cannot tell an opening bar from a closing one, so spacing is sometimes off. amsmath's \lvert and \rvert fix that and are in KaTeX. For tall contents use \left| … \right|. The double bar \| is the norm.

All ways to write it

CommandUsePackageCopy
|x|plain barsnone
\lvert x \rvertcorrectly spaced barsamsmath
\left| \frac{a}{b} \right|scaling barsnone
\|x\|normnone
\lVert x \rVertcorrectly spaced normamsmath
\abs{x}with the physics or mathtools packagephysicsnot in KaTeX

Commands marked with a package need that \usepackage line in a LaTeX document. “Not in KaTeX” means the command will not render in KaTeX- or MathJax-based tools such as Markdown previews, Jupyter and Confluence math apps; use one of the other forms there.

Example

\left| \frac{x}{y} \right| = \frac{\lvert x \rvert}{\lvert y \rvert}, \qquad \lVert \mathbf{v} \rVert = \sqrt{v_1^2 + v_2^2}

Scaling bars around a fraction, and the Euclidean norm.

Questions

Why is the spacing wrong with plain | bars?

| is an ordinary symbol with no left/right identity. Use \lvert…\rvert or \left|…\right| so LaTeX knows which side is which.

Related symbols

Using absolute value in Confluence

Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type |x| and it renders inline or as a block, with a live preview while you edit. The app uses KaTeX, so pick one of the commands above that is not marked “not in KaTeX”.