German language: use of comma in numbers

Use the icomma package.

The effect can also be achieved with the siunitx package and its output-decimal-marker setting, although you'll have to pass numbers to the \num macro.


There are various situations one can find in.

(1) There are just a few decimal numbers in the document: use $123{,}45$

(2) There are several numbers and a few formulas involving the comma: use Herbert's trick and define also

\DeclareMathSymbol{\comma}{\mathpunct}{letters}{"3B}

using \comma when it must be a punctuation symbol in formulas

(3) Several numbers and several formulas: use icomma; one must remember to put a space when needed in cases such as the interval~$[0, 1]$. Actually icomma works as outlined in case (2), but using the , as a "math active" character that acts depending on the next token.

(4) Many numbers: use siunitx and \num, which ensures uniform treatment of the numbers. For example, one can change the format from 123.456,78 to a "more correct" $123\,456{,}78$ by changing one line in the document, i.e., in the argument of \sisetup.


\documentclass{minimal}
\usepackage[utf8]{inputenc}
\DeclareMathSymbol{,}{\mathord}{letters}{"3B}

\begin{document}
Der Preis beträgt $12.345,67$ Euro.    
\end{document}

you can also redefine the dot to a \mathpunct, if you like