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.
\documentclass{mwrep}
\usepackage{amsmath}
\begin{document}
Check:\\
with "," $0,125$\\
with "." $0.125$

with commas:
\begin{equation}
P=
\begin{bmatrix} 0,1 & 0,3 & 0,0 & 0,6 \\
                0,2 & 0,4 & 0,1 & 0,3 \\
                0,0 & 0,8 & 0,0 & 0,2 \\
                0,2 & 0,0 & 0,2 & 0,6
\end{bmatrix}
\end{equation}

with dots:
\begin{equation}
P=
\begin{bmatrix} 0.1 & 0.3 & 0.0 & 0.6 \\
                0.2 & 0.4 & 0.1 & 0.3 \\
                0.0 & 0.8 & 0.0 & 0.2 \\
                0.2 & 0.0 & 0.2 & 0.6
\end{bmatrix}
\end{equation}

\end{document}

As you can see numbers with a comma as a decimal separator are wider than those with a dot. How can I change space after a comma to be equal to space after a dot?

share|improve this question
2  
See also German language: use of comma in numbers. –  Hendrik Vogt Jun 20 '12 at 7:21
add comment

1 Answer 1

up vote 6 down vote accepted

You need an intelligent comma-package like icomma or ncccomma.

You can also adapt the code from Claudio Beccari's article in The PracTEX Journal, 2011, No. 1.

Add

\usepackage{ncccomma}

to your preamble.

If you have none of those packages installed, you can add Claudio Beccari's code to your preamble (I have removed the comments and added \makeatother as the last line):

\makeatletter
\DeclareMathSymbol{\punctcomma}{\mathpunct}{letters}{"3B}
\DeclareMathSymbol{\decimalcomma}{\mathord}{letters}{"3B}
\AtBeginDocument{\mathcode‘\,="8000}
{\catcode‘\,=\active \gdef,{\futurelet\let@token\m@thcomma}}
\def\m@thcomma{\let\@tempB\punctcomma
\@tfor\@tempA:=0123456789\do{%
    \expandafter\ifx\@tempA\let@token\let\@tempB\decimalcomma
    \@break@tfor\fi}\@tempB}
\makeatother

I Hope this will help.

share|improve this answer
add comment

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.