Parallel in LaTeX (\parallel)

∥\parallel
LaTeX command
\parallel
Package
No package needed: built into LaTeX
Mode
Math mode only
Copy the Unicode character
∥U+2225

Where it is used

Relation meaning is parallel to, for lines, planes or vectors; also a parallel-composition operator.

Geometry writes \ell_1 \parallel \ell_2, physics writes components like F_\parallel (often via \|), and electrical engineering uses R_1 \parallel R_2 for resistors in parallel. Process calculi use it for parallel composition, P \parallel Q. The glyph is the same as \|, but \parallel gets relation spacing, so use it between objects and \| (or \lVert, \rVert) for norm delimiters. Its negation is \nparallel. For the KL divergence D(P \parallel Q) the relation spacing is standard, though some prefer \|.

Also listed under: Geometry

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

DKL(P∥Q)=∑xP(x)log⁡P(x)Q(x)D_{\mathrm{KL}}(P \parallel Q) = \sum_x P(x) \log \frac{P(x)}{Q(x)}
\documentclass{article}
\begin{document}
Parallel: $\parallel$

\[ D_{\mathrm{KL}}(P \parallel Q) = \sum_x P(x) \log \frac{P(x)}{Q(x)} \]
\end{document}

Related symbols

All Relations & Comparisons →

Frequently asked questions

How do I write Parallel in LaTeX?
Type \parallel in math mode, for example $D_{\mathrm{KL}}(P \parallel Q) = \sum_x P(x) \log \frac{P(x)}{Q(x)}$. It works in plain LaTeX without loading any package.
Which package do I need for \parallel?
None. \parallel is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \parallel in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\parallel$ 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).
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