Modulus in LaTeX (|z|)
- LaTeX command
|z|- Package
- No package needed: built into LaTeX
- Mode
- Text and math mode
Where it is used
Modulus (absolute value) of z, its distance from the origin: √(a² + b²) for z = a + bi.
Bare vertical bars work for simple cases but are ambiguous to TeX, which cannot tell opening from closing; that causes bad spacing in expressions like |-z|. Use \lvert z \rvert, or define a macro, to get correct spacing, and \left| \frac{z}{w} \right| when the content is tall. Never use \mid here: it is a relation with wide spacing. Key properties are |zw| = |z||w| and the triangle inequality |z + w| \leq |z| + |w|. In vector contexts the double bars \| \| denote a norm instead.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Modulus: $|z|$
\[ \lvert z w \rvert = \lvert z \rvert \lvert w \rvert \]
\end{document}Related symbols
- Argument
\arg(z) - Complex Conjugate (Star)
z^* - Principal Argument
\text{Arg}(z) - Complex Conjugate
\bar{z} - Polar Form
r e^{i\theta} - Imaginary Part
\Im(z)
Frequently asked questions
- How do I write Modulus in LaTeX?
- Type |z| in math mode, for example $\lvert z w \rvert = \lvert z \rvert \lvert w \rvert$. It works in plain LaTeX without loading any package.
- Which package do I need for |z|?
- None. |z| is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use |z| in text mode, or only in math mode?
- Both. |z| compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
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