Double Vertical Bar in LaTeX (\|)
- LaTeX command
\|- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
- Copy the Unicode character
- ∥
U+2225
Where it is used
Double vertical bar, the delimiter for norms and the symbol for parallel in some contexts.
\| prints two vertical lines and is mostly used in pairs for norms, \|x\|. As a plain symbol it has ordinary spacing, so when you mean the relation is parallel to, use \parallel, which adds relation spacing. For norms, \lVert and \rVert are recommended, because they tell LaTeX which side opens and closes, giving correct spacing next to operators and minus signs. It can be sized with \left\| ... \right\| or \big\|. In text mode \| does not give the bars; use \textbardbl or switch to math.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Double Vertical Bar: $\|$
\[ \|x\|_2 = \sqrt{x_1^2 + x_2^2 + \cdots + x_n^2} \]
\end{document}Related symbols
- Norm
\| x \| - Floor
\lfloor x \rfloor - Double Bracket Left
\llbracket - Floor Right
\rfloor - Double Bracket Right
\rrbracket - Floor Left
\lfloor
Frequently asked questions
- How do I write Double Vertical Bar in LaTeX?
- Type \| in math mode, for example $\|x\|_2 = \sqrt{x_1^2 + x_2^2 + \cdots + x_n^2}$. It works in plain LaTeX without loading any package.
- Which package do I need for \|?
- None. \| is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \| in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\|$ in running text. If you only need the glyph in text, paste the Unicode character ∥ instead (with XeLaTeX or LuaLaTeX and a font that has it).
Editor LaTeX AI Terbaik, Alternatif Overleaf
Octree membantu peneliti dari 15+ universitas menulis makalah penelitian lebih cepat menggunakan AI
- Hasilkan diagram TikZ yang indah menggunakan AI
- Unggah gambar dan konversi ke LaTeX dengan mulus
- Dapatkan bantuan instan untuk menulis dan memformat makalah penelitian