7

\usepackage[spanish]{babel} makes $12.34$ to print "12,34", not "12.34". It doesn't change dot to comma if one says for example $x.y$.

Can I use only that feature from babel package, and still use finnish hyphenation, typography etc?

T. Verron
  • 13,552
  • Does http://tex.stackexchange.com/questions/97571/how-to-convert-dots-to-commas-in-mathmode help? – cgnieder May 17 '13 at 09:02
  • rather than doing complicated things with active characters, perhaps adding some mark-up to the source is a simpler option: $\np {12.34}$, with the \np macro from the numprint package, which is configurable (\npdecimalsign{,} for example; see the doc page 14). You also need option np to use the abbreviated form rather than \numprint. –  May 17 '13 at 09:14
  • Cgnieder: not really, think about If $x=y$ we have \[ f(x)=f(y). \]. Of course there are solutions, like x \approx 12{,}34. But babel-spanish -style would be easiest way. – Jori Mäntysalo May 17 '13 at 09:46

1 Answers1

6

I would suggest you use the siunitx package and set the comma as decimal point by \sisetup{output-decimal-marker = {,}}.

Using this package will also allow you to use some other very nice features that you'll find handy, such as 3-number separators, SI units, D columns (when dealing with tables full of numbers) and much more!

Take a look at the siunitx package documentation.

Also, according to section 4.1 of the "Estilo spanish para el sistema babel", you can set the use of comma as decimal point by \decimalcomma.

In other words, load the babel package like this: \usepackage[spanish,finnish]{babel} (so your main language is finnish) and then set the comma as decimal point by \decimalcomma.

Finally, as suggested by cgnieder, you could try looking at this post: How to convert dots to commas in mathmode?

Mario S. E.
  • 18,609
  • 1
    siunit seems to be great for many uses. However, for only decimal comma \num{12.34} does not feel much better than 12{,}34. – Jori Mäntysalo May 17 '13 at 10:12
  • If that is the case, then why not writing it directly? You can write 12.34 and 12,34 – Mario S. E. May 17 '13 at 10:25
  • @MarioS.E. the spacing in $12,34$ will be wrong if you campare to $12{,}34$ – cgnieder May 17 '13 at 10:29
  • @MarioS.E.Sorry, does not work. With \usepackage[spanish,finnish]{babel} (and \decimalcomma) I got dot, not comma. With \usepackage[finnish,spanish]{babel} I got comma, but also wrong \contentsname. – Jori Mäntysalo May 17 '13 at 12:56
  • The thing is finnish option is redefining the decimal separator. The spanish option cannot pass the \decimalcomma command to finnish. I read the whole Spanish Babel and it doesn't mention how to "export" this feature, so most likely there must be a way to change this within the finnish option. I found some documentation regarding finnish and babel (ftp://ftp.di.uminho.pt/pub/ctan/macros/latex/contrib/babel-contrib/finnish/finnish.pdf) but it doesn't go over comma. I would suggest you stick with the other options (siunitx package or `\matcode' changes) mentioned in my answer – Mario S. E. May 17 '13 at 13:11
  • @MarioS.E.OK, I marked this as answered. I have never looked at code of babel package, so maybe I'n not going to look how babel-spanish makes it. – Jori Mäntysalo May 18 '13 at 05:56