[OS X TeX] Easy question: babel vs. decimal expressions.

Bruno Voisin bvoisin at mac.com
Tue Feb 5 16:37:16 CET 2008


Le 5 févr. 08 à 16:13, Javier Elizondo a écrit :

> I have a very simple question. If I load spanish using
> babel, and if I write in my tex file 62.5, it will
> appear written in the output PDF as 62,5
>
> I need in the output 62.5, does anyone know how can I
> correct this?

Does it work if you add in the preamble:

\AtBeginDocument{\decimalpoint}

Or just \decimalpoint anywhere after \begin{document}?

The Spanish language in babel (pp. 149--167 of /usr/local/texlive/2007/ 
texmf-dist/doc/generic/babel/babel.pdf) is rather poorly documented.  
The only mention of dots in math mode is, on p. 149:

> In math mode a dot followed by a digit is replaced by a decimal comma.

However, if you look at the documented code afterwards you'll find on  
p. 159:

> First, decimal comma.
> 36.450 \def\spanishdecimal#1{\def\es at decimal{{#1}}}
> 36.451 \def\decimalcomma{\spanishdecimal{,}}
> 36.452 \def\decimalpoint{\spanishdecimal{.}}
> 36.453 \decimalcomma
> 36.454
> 36.455 \es at set@shorthand{.}
> 36.456
> 36.457 \@namedef{es at math\string.}{%
> 36.458 \@ifnextchar\egroup
> 36.459 {\mathchar\es at period@code\relax}%
> 36.460 {\es at text@sh.}}
> 36.461
> 36.462 \declare at shorthand{system}{.}{\mathchar\es at period@code\relax}
> 36.463 \addto\shorthandsspanish{%
> 36.464 \mathchardef\es at period@code\the\mathcode‘\.%
> 36.465 \babel at savevariable{\mathcode‘\.}%
> 36.466 \mathcode‘\.="8000 %
> 36.467 \es at activate{.}}
> 36.468
> 36.469 \AtBeginDocument{%
> 36.470 \catcode‘\.=12
> 36.471 \if at filesw
> 36.472 \immediate\write\@mainaux{%
> 36.473 \string\catcode‘\string\.=12}%
> 36.474 \fi}
> 36.475
> 36.476 \declare at shorthand{spanish}{.1}{\es at decimal1}
> 36.477 \declare at shorthand{spanish}{.2}{\es at decimal2}
> 36.478 \declare at shorthand{spanish}{.3}{\es at decimal3}
> 36.479 \declare at shorthand{spanish}{.4}{\es at decimal4}
> 36.480 \declare at shorthand{spanish}{.5}{\es at decimal5}
> 36.481 \declare at shorthand{spanish}{.6}{\es at decimal6}
> 36.482 \declare at shorthand{spanish}{.7}{\es at decimal7}
> 36.483 \declare at shorthand{spanish}{.8}{\es at decimal8}
> 36.484 \declare at shorthand{spanish}{.9}{\es at decimal9}
> 36.485 \declare at shorthand{spanish}{.0}{\es at decimal0}

This seems to imply that \decimalcomma and \decimalpoint are switches  
to make "," and "." the math decimal separator, respectively, with  
\decimalcomma the default.

Hope this works,

Bruno Voisin


More information about the macostex-archives mailing list