Writing a negative number in text mode: $-$9 or $-9$?

If we want to produce -9, typing -9 in an input file is not correct because - is intentionally designed for hyphenation so its glyph is bad to represent the minus sign.

To produce the minus sign, we use $-$ instead of -. My question is, should a number be enclosed in $ together with the - if we want to render a negative number? In other words, which one is recommended in text mode: $-$9 or $-9$? In other words, which one is recommended out of: Option A $-$9 is a negative number.  or Option B $-9$is a negative number.  ? - Depends on whether you want 9 to be printed in the text font or the math font (which might be different, especially when using old-style numerals). – Caramdir Jul 29 '11 at 15:38 Obvious, but maybe useful: In case you use e.g. \emph{$-9$}, the number nine remains unaffected by the emphasis command, whereas \emph{$-$9} produces the number nine emphasised. – Harold Cavendish Jul 29 '11 at 15:49 4 Answers $-9$ Minus nine is a number, so you should type the whole number in a single mode, in this case the math mode. If you can find a minus sign in text font, typing the sign and nine both in text mode is acceptable depend on the context. - I think this is the way to go. I saw some paper by Knuth (I think it was about the new fonts used in Concrete Math) where he mentioned that he was changing all his numbers to include the $\$. – Peter Grill Jul 29 '11 at 17:44
The Knuth paper is here, and Knuth changed some numbers to math mode, when there are actually math, as opposed to, say, a year. – mafp Jan 29 '13 at 23:33

Option C

\documentclass{article}

\usepackage{textcomp}

\begin{document}
\textminus 9
\end{document}


This produces a legit minus sign.

-

Although it's a bit overkill, you could use the \num macro of the siunitx package:

\documentclass{article}

\usepackage{siunitx}

\begin{document}

\Huge

In mathmode: $$-9$$

With \textsf{siunitx}: \num{-9}

\end{document}

-
Or use a more lightweight numprint package. – mbork Jul 29 '11 at 17:20
+1 for siunitx – Tobi Jul 29 '11 at 22:37
It's especially valuable if you are converting to HTML using tex4ht; in this case no equation (MathML or bitmap representation) is created, instead the number is printed as text. (At least in theory; I have found that negative numbers don't work correctly out of the box). – krlmlr Feb 20 '14 at 13:51

I'd also say Option B or Option C since the minus sign and the number are consistently formatted in these two cases.

If you prefer Option C and your editor supports Unicode (such as Emacs) you can facilitate entering negative numbers by loading the inputenc or even better the inputenx package and associate \textminus with the Unicode minus sign U+2212:

\documentclass{article}

\usepackage{textcomp}

\usepackage[utf8]{inputenc}

\DeclareUnicodeCharacter{2212}{\textminus}

\begin{document}

\noindent
number \textminus9\\
number −9

\end{document}

-