In number theory a ∣ b means a divides b. Use \mid rather than a bare | so LaTeX spaces it as a relation. The same \mid is correct for 'such that' in set-builder notation and for conditional probability.
All ways to write it
| Command | Use | Package | Copy |
|---|---|---|---|
\mid | divides, with relation spacing | none | |
\nmid | does not divide, ∤ | amssymb | |
| | plain bar — tighter spacing, use for absolute value | none |
Commands marked with a package need that \usepackage line in a LaTeX document.
Example
3 \mid 12, \qquad P(A \mid B) = \frac{P(A \cap B)}{P(B)}Divisibility, and the vertical bar as 'given' in probability.
Questions
\mid or | for conditional probability?
\mid. It gets the spacing of a relation symbol; | is treated as an ordinary character and sits too close.
Related symbols
Using divides in Confluence
Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type \mid and it renders inline or as a block, with a live preview while you edit. Every command on this page renders there without extra packages.