Ceci est une ancienne révision du document !

— title: The comma as a decimal separator category: usage permalink: /FAQ-dec-comma date: 2014-06-10 —

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.

A simple solution to this problem, in maths mode, is to type `3`{,}`14` in 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`](https://ctan.org/pkg/icomma) and [`ziffer`](https://ctan.org/pkg/ziffer).

[`Icomma`](https://ctan.org/pkg/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`](https://ctan.org/pkg/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`](https://ctan.org/pkg/numprint) package provides a command `\numprint{number}` that prints its argument according to settings you give it, or according to settings chosen to match the language you have selected in [`babel`](https://ctan.org/pkg/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`](https://ctan.org/pkg/icomma) or [`ziffer`](https://ctan.org/pkg/ziffer) if you are typing a lot of numbers.

2_composition/langues/utiliser_la_virgule_comme_separateur_decimal.1528035543.txt.gz · Dernière modification: 2018/06/03 16:19 par samcarter
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0