Search code examples
latexpdflatex

How centering polish numbers in tabular


 \begin{tabular}{ | c | c | }
  \hline numer & błąd \\
  \hline 11,1 &  11\\
  \hline 299,05  &  10,1\\
  \hline 3000,5 &  9,3\\ 
  \hline
 \end{tabular}

In my country using , not . as separator. I cant use 'S' in tabular header. How centering to comma in tabular enviroments?

I need table with centering by the comma in numbers. I can use r@{\,} but header is not centered.


Solution

  • The siunitx has an option to use , as decimal marker (if you compile with lualatex or xelatex, you don't need this \fontencoding{T1}\selectfont hack...):

    \documentclass{article}
    
    \usepackage[output-decimal-marker={,}]{siunitx}
    
    \begin{document}
    
    
     \begin{tabular}{ | S[table-format=4.2] | S[table-format=2.1] | }
      \hline {numer} & {\fontencoding{T1}\selectfont błąd}\\
      \hline 11,1 &  11\\
      \hline 299,05  &  10,1\\
      \hline 3000,5 &  9,3\\ 
      \hline
     \end{tabular}
    
    
    \end{document}
    

    enter image description here