Subtraction in LaTeX (-)
- LaTeX command
-- Package
- No package needed: built into LaTeX
- Mode
- Text and math mode
- Copy the Unicode character
- −
U+2212
Where it is used
Subtracts one quantity from another; in math mode the hyphen key becomes a true minus sign, not a hyphen.
Inside math mode the hyphen character is converted into a proper minus sign, which is longer than a text hyphen and gets binary operator spacing in a - b. Outside math you only get a short hyphen, so a negative number in running text should still be written as $-5$ rather than typed bare. When the minus is unary, as in -x or e^{-t}, TeX removes the surrounding space automatically. Do not confuse it with \setminus, which denotes set difference A \setminus B, or with the en dash used for ranges. For a superscript minus, as in x^{-1} or Cl^-, braces are needed only when more than one character follows.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Subtraction: $-$
\[ f(x) = x^3 - 2x^2 - x + 2 \]
\end{document}Related symbols
All الرموز الرياضية →Frequently asked questions
- How do I write Subtraction in LaTeX?
- Type - in math mode, for example $f(x) = x^3 - 2x^2 - x + 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?
- Both. - 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 بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث