14in place of
3,14. 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. 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: icomma and ziffer. Icomma ensures that there will be no extra space after a comma, unless you type a space after it (as in
f(x, y)— in the absence of the package, you don’t need that space), in which case the usual small space after the comma appears. Ziffer 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 ‘cents’ part of an amount of currency. The numprint package provides a command
}that prints its argument according to settings you give it, or according to settings chosen to match the language you have selected in babel. The formatting works equally well in text or maths. The command is very flexible (it can also group the digits of very ‘long’ numbers), but is inevitably less convenient than icomma or ziffer if you are typing a lot of numbers.
Go to previous question, or next question
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dec_comma
Comments, suggestions, or error reports? - see “how to improve the FAQ”.
This is FAQ version 3.26, released on 2013-02-25.