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.

Should I typeset numbers in a running text with math mode?

I read $4795$ pages.

I read 4705 pages.

I tried it out with the default font, and there does seem to be tiny differences in kerning. That could just be my imagination, though.

share|improve this question
1  
The difference will be very visible for text fonts with old-style numbers (e.g. Linux Libertine). –  Caramdir May 26 '12 at 0:11
    
see the answer to the question old-style-figures-use-in-references-brackets-e-g-to-equations-bibliography which quotes from a tugboat article by donald knuth regarding the difference between "math" and "non-math" numbers. the answer contains a link to the tugboat article. –  barbara beeton May 26 '12 at 22:01

2 Answers 2

up vote 19 down vote accepted

Here's a minimal document

\documentclass{article}
\begin{document}
\showboxbreadth=100 \showboxdepth=100

\sbox0{I read $4795$ pages. AV}\showbox0

\sbox0{I read 4795 pages. AV}\showbox0
\end{document}

In the log file we can see the result of the \showbox commands; I added AV just to show how kerning is displayed.

> \box0=
\hbox(6.94444+1.94444)x97.58348
.\OT1/cmr/m/n/10 I
.\glue 3.33333 plus 1.66498 minus 1.11221
.\OT1/cmr/m/n/10 r
.\OT1/cmr/m/n/10 e
.\OT1/cmr/m/n/10 a
.\OT1/cmr/m/n/10 d
.\glue 3.33333 plus 1.66666 minus 1.11111
.\mathon
.\OT1/cmr/m/n/10 4
.\OT1/cmr/m/n/10 7
.\OT1/cmr/m/n/10 9
.\OT1/cmr/m/n/10 5
.\mathoff
.\glue 3.33333 plus 1.66666 minus 1.11111
.\OT1/cmr/m/n/10 p
.\OT1/cmr/m/n/10 a
.\OT1/cmr/m/n/10 g
.\OT1/cmr/m/n/10 e
.\OT1/cmr/m/n/10 s
.\OT1/cmr/m/n/10 .
.\glue 4.44444 plus 4.99997 minus 0.37036
.\OT1/cmr/m/n/10 A
.\kern-1.11113
.\OT1/cmr/m/n/10 V


! OK.
l.5 \sbox0{I read $4795$ pages. AV}\showbox0

? 
> \box0=
\hbox(6.94444+1.94444)x97.58348
.\OT1/cmr/m/n/10 I
.\glue 3.33333 plus 1.66498 minus 1.11221
.\OT1/cmr/m/n/10 r
.\OT1/cmr/m/n/10 e
.\OT1/cmr/m/n/10 a
.\OT1/cmr/m/n/10 d
.\glue 3.33333 plus 1.66666 minus 1.11111
.\OT1/cmr/m/n/10 4
.\OT1/cmr/m/n/10 7
.\OT1/cmr/m/n/10 9
.\OT1/cmr/m/n/10 5
.\glue 3.33333 plus 1.66666 minus 1.11111
.\OT1/cmr/m/n/10 p
.\OT1/cmr/m/n/10 a
.\OT1/cmr/m/n/10 g
.\OT1/cmr/m/n/10 e
.\OT1/cmr/m/n/10 s
.\OT1/cmr/m/n/10 .
.\glue 4.44444 plus 4.99997 minus 0.37036
.\OT1/cmr/m/n/10 A
.\kern-1.11113
.\OT1/cmr/m/n/10 V

! OK.
l.7 \sbox0{I read 4795 pages. AV}\showbox0

? 

The two boxes are exactly the same except for the \mathon and \mathoff items that may add a kern if \mathsurround is nonzero.

You can see that the digits are taken from the same font. This is important in case other settings are chosen, for example Euler digits.

Write in math numbers that are intended in their mathematical sense. Page numbers or years, for instance, are "words".

share|improve this answer

This is an extension and illustration of points made in the comments and is intended to complement egreg's answer.

Although people sometimes talk as if there are just two kinds of figures - old-style/hanging/text, on the one hand, and lining/maths, on the other - this is only part of the story.

Figures can take various forms and fonts vary in the kinds and variety they provide. For example, some fonts provide specialised characters for use in subscripts and superscripts. Others provide figures designed specifically to match small-caps.

Taking Latin Modern as an example, we find four kinds of regular, Arabic numerals:

  1. proportional and lining
  2. proportional and old-style
  3. tabular and old-style
  4. tabular and lining

Whether a style is lining or old-style tells you how the figures are positioned relative to the baseline: a lining figure sits on the baseline, whereas an old-style one may hang partly below it.

Whether a style is proportional or tabular tells you the relative width of figures: tabular figures all have the same width whether they are fat (like 0 and 8) or thin (like 1 and 7), whereas proportional figures have different widths depending on the fatness or thinness of their shapes.

Generally, numbers used in maths should be tabular and lining, while numbers used in text should be proportional and either old-style or lining (depending on context and who you listen to).

By way of illustration:

4 kinds of figures

\documentclass{article}
\usepackage{cfr-lm}

\begin{document}
In some cases, text numerals are `old-style' or `text' or `hanging'.
For example, 533 blades of grass were allegedly squashed when 2 armies fought the Battle of Hastings in 1066 but 111 people failed to dial 999 as telephones had not yet been invented.
Of course, small numbers such as `2' should always be written out as words in such cases: `two armies` rather than `2 armies'.

In these cases, numerals in maths should look quite different.
For example, the product of $2$ and $533$ is $1066$, while the product of $111$ and $3^2$ is $999$.

In fact, there is a second difference here which can be observed by comparing the following:

\begin{tabular}{lll}
  1234567890    &   proportional, old-style & default text\\
  $1234567890$  &   tabular, lining & maths\\
  \textto{1234567890}   &   tabular, old-style\\
  \textpl{1234567890}   &   proportional, lining\\
\end{tabular}

Proportional, lining figures may be more appropriate for postcodes such as \textpl{DG87 9CE}, ordinary telephone numbers such as \textpl{(0800) 754 621}, and reference numbers such as \textpl{YF0089-735V/4TG/0678} etc.
\end{document}

I have yet to find a use for tabular old-style figures, but I use the other three kinds regularly.

share|improve this answer

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.