Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

?

share|improve this question
4  
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
4  
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
add comment

4 Answers 4

up vote 26 down vote accepted

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

share|improve this answer
4  
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
add comment

Option C

\documentclass{article}

\usepackage{textcomp}

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

This produces a legit minus sign.

share|improve this answer
add comment

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}
share|improve this answer
1  
Or use a more lightweight numprint package. –  mbork Jul 29 '11 at 17:20
1  
+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 at 13:51
add comment

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.