Math & Science ⇒ Norwegian comma vs period for decimal numbers.
Norwegian comma vs period for decimal numbers.
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?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
Norwegian comma vs period for decimal numbers.
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.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}Norwegian comma vs period for decimal numbers.
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}