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 Mga Simbolo ng Math →

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 poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers