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.

f(x)=x3−2x2−x+2f(x) = x^3 - 2x^2 - x + 2
\documentclass{article}
\begin{document}
Subtraction: $-$

\[ f(x) = x^3 - 2x^2 - x + 2 \]
\end{document}

Related symbols

All Math Symbols →

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.
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