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.
أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf
يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي
- أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
- ارفع صورة وحولها إلى LaTeX بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث