summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-dec_comma.html
blob: 07856bead654f7c959055a93fd6280ed380ce29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<head>
<title>UK TeX FAQ -- question label dec_comma</title>
</head><body>
<h3>The comma as a decimal separator</h3>
<p/>TeX embodies the British/American cultural convention of using a
period as the separator between the whole number and the decimal
fraction part of a decimal number.  Other cultures use a comma as
separator, but if you use a comma in maths mode you get a small space
after it; this space makes a comma that is used as a decimal separator
look untidy.
<p/>A simple solution to this problem, in maths mode, is to type
<code>3</code><code>{,}</code><code>14</code> in place of <code>3,14</code>.  While such a
technique may produce the right results, it is plainly not a
comfortable way to undertake any but the most trivial amounts of
typing numbers.
<p/>Therefore, if you need to use commas as decimal separator, you will
probably welcome macro support.  There are two packages that
can help relieve the tedium: <i>icomma</i> and <i>ziffer</i>.
<p/><i>Icomma</i> ensures that there will be no extra space after a
comma, unless you type a space after it (as in <code>f(x, y)</code> &mdash; in
the absence of the package, you don&rsquo;t need that space), in which case
the usual small space after the comma appears.  <i>Ziffer</i> is
specifically targeted at the needs of those typesetting German, but
covers the present need, as well as providing the double-minus sign
used in German (and other languages) for the empty &lsquo;cents&rsquo; part of an
amount of currency.
<p/>The <i>numprint</i> package provides a command
<code>\</code><code>numprint{</code><em>number</em><code>}</code> that prints its argument according to
settings you give it, or according to settings chosen to match the
language you have selected in <i>babel</i>.  The formatting works
equally well in text or maths.  The command is very flexible (it can also
group the digits of very &lsquo;long&rsquo; numbers), but is inevitably less
convenient than <i>icomma</i> or <i>ziffer</i> if you are typing a
lot of numbers.
<dl>
<dt><tt><i>icomma.sty</i></tt><dd>Distributed as part of <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/was.zip">macros/latex/contrib/was</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/was/">browse the directory</a>)
<dt><tt><i>numprint.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/numprint.zip">macros/latex/contrib/numprint</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/numprint/">browse the directory</a>)
<dt><tt><i>ziffer.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/ziffer.zip">macros/latex/contrib/ziffer</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/ziffer/">browse the directory</a>)
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dec_comma">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dec_comma</a>
</body>