Vertical Bar in LaTeX (\left| x \right|)
- LaTeX command
\left| x \right|- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Vertical bars that resize to their content, for absolute values and determinants.
Use \left| ... \right| when an absolute value contains a fraction or sum, as in \left| \frac{a}{b} \right|, and for determinants of tall matrices (though vmatrix is simpler). Plain | is ambiguous to LaTeX: it cannot tell an opening bar from a closing one, which can spoil spacing around a leading minus sign. For consistent results define a macro with \lvert and \rvert, or use \left\lvert ... \right\rvert. For set-builder separators and conditional probabilities, use \mid or \middle| instead.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Vertical Bar: $\left| x \right|$
\[ \left| \int_a^b f(x)\,dx \right| \le \int_a^b |f(x)|\,dx \]
\end{document}Related symbols
- Big Parentheses
\Big( x \Big) - Curly Braces
\left\{ x \right\} - Bigg Parentheses
\Bigg( x \Bigg) - Square Brackets
\left[ x \right] - Left Delimiter with Invisible Right
\left( x \right. - Parentheses
\left( x \right)
Frequently asked questions
- How do I write Vertical Bar in LaTeX?
- Type \left| x \right| in math mode, for example $\left| \int_a^b f(x)\,dx \right| \le \int_a^b |f(x)|\,dx$. It works in plain LaTeX without loading any package.
- Which package do I need for \left| x \right|?
- None. \left| x \right| is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \left| x \right| in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\left| x \right|$ in running text.
Math poweredWrite LaTeX using AI
Best AI LaTeX Editor, Overleaf Alternative
Octree helps researchers from 15+ universities write research papers faster using AI
- Generate beautiful TikZ diagrams using AI
- Upload image and convert it to LaTeX seamlessly
- Get instant assistance with writing and formatting research papers