[Tex/LaTex] How to convert dots to commas in mathmode

math-modepunctuation

For my study of physics I have to do various lab reports. Normally I just process all my data using python, gnuplot or Mathematica and copy it from there to my TeX document. Unfortunately all these applications use the . (dot) as a decimal seperator. Because I study in Germany the german standard says that I have to use , (comma) as the decimal seperator. In most cases the supervisors of the lab are forgiving, but one of them told me to redo my whole lab report because of this. Now I don't want to search all the 15 pages to replace all dots with commas. I could have used a regular expression but this still implied editing the whole file.

Best Answer

It is perhaps less intrusive just to change the mathcode of . rather than globally define an active . to be a comma.

\mathcode`\.=\mathcode`\,

Would define . to be like , (as in the self-answer) If you want the . to be mathord so it os not followed by a thin space then you could use

\DeclareMathSymbol{.}{\mathord}{letters}{"3B}
Related Question