Most of the world will write a decimal number like this: "0.36704 or .36704" and write a large number like this: "3,000,000"
In Norway (and probably other places in Europe), however, we write a decimal number like this: "0,36704 (and never ,36704)" and a large number like this: "3 000 000"
If I use comma "," in math environment in latex, I get a small space to the right of it as a result of it mostly being used for coordinates. Is there a way to set it up in such a way that this space is removed by default?
Math & Science ⇒ Norwegian comma vs period for decimal numbers.
- Stefan Kottwitz
- Site Admin
- Posts: 10290
- Joined: Mon Mar 10, 2008 9:44 pm
Norwegian comma vs period for decimal numbers.
You could use the
icomma package. It makes the comma context aware: if there's a space after the comma, it works like before with a small space after it, if there's not space then it works like a decimal separator without additional spacing after it. So it works like expected, still letting you the option for having space.
Stefan

Code: Select all
\documentclass{article}
\usepackage{icomma}
\begin{document}
$(x, y) = (0, 3)$ % with desired space
and $z = 0,36704$.% no space after decimal separator
\end{document}
LaTeX.org admin
Norwegian comma vs period for decimal numbers.
Without a package wrap the comma in braces:
The package siunitx and its
Regards
Code: Select all
\documentclass{article}
\begin{document}
$(x,y)$ $0{,}1234$ $3\,000\,000$
\end{document}
\num
macro allows for very much customization of the printing of numbers. Here's a very short example:Code: Select all
\documentclass{article}
\usepackage{siunitx}
\sisetup{
add-decimal-zero = true , % default setting, not needed
output-decimal-marker = {,} ,
group-separator = \, % default setting, not needed
}
\begin{document}
\num{0,1234} \num{.1234} \num{3000000}
\num{2.} \num{3}
\end{document}
site moderator & package author
Re: Norwegian comma vs period for decimal numbers.
icomma package is a thing of beauty. thanks! 
