1

I need to use the point "." as a decimal separator, but something strange happens, I write:

\documentclass[oneside]{scrbook}
\usepackage[spanish, es-tabla]{babel}
\usepackage{pgfplotstable}

\begin{document}
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,dec sep={n}}
\pgfmathprintnumber{12.3456}
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,dec sep={.}}
\pgfmathprintnumber{12.3456}
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,dec sep={,}}
\pgfmathprintnumber{12.3456}
\end{document}

the first one works as expected, but the others only show me the comma, why does this happen? am i forgetting something?, I tried also with use period,but it is the same.

5
  • 1
    Welcome! Can you please provide a complete yet minimal example that starts with \documentcass, ends with \end{document}, can be compiled and shows this issue? (Did you try use comma=false?)
    – user194703
    Dec 26, 2019 at 4:44
  • Sure @Schrödinger'scat, I'll prepare it
    – 4lrdyD
    Dec 26, 2019 at 4:46
  • 1
    Use \usepackage[spanish,es-nodecimaldot, es-tabla]{babel}, see tex.stackexchange.com/a/82013. That is, add the option es-nodecimaldot to babel.
    – user194703
    Dec 26, 2019 at 5:03
  • Yes, see my above comment: load babel with the es-nodecimaldot option.
    – user194703
    Dec 26, 2019 at 5:06
  • it was what I needed, now it works, thanks! @Schrödinger'scat
    – 4lrdyD
    Dec 26, 2019 at 5:09

1 Answer 1

2

If you wish to change the comma everywhere in your document to a period, use Gonzalos nice answer, i.e. load babel with es-nodecimaldot option. This answer is to show how one change the decimal separator locally to a period. This works by appending \decimalpoint to the code of use period.

\documentclass[oneside]{scrbook}
\usepackage[spanish, es-tabla]{babel}
\usepackage{pgfplotstable}
\pgfkeys{/pgf/number format/.cd,use period/.append code={\decimalpoint}}
\begin{document}
\pgfmathprintnumber{12.3456}
\pgfmathprintnumber[use period]{12.3456}
\pgfmathprintnumber{12.3456}
\end{document}

enter image description here

1
  • thanks @Schrödinger's cat, I will consider the latter
    – 4lrdyD
    Dec 26, 2019 at 5:52

Not the answer you're looking for? Browse other questions tagged .