How can I align numbers in table according to the decimal comma please when I don't know how many numbers are befor the comma and how many decimal places the number will have?
\documentclass[12pt,a4paper]{report}
\usepackage[english,czech]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}
\usepackage{amsmath, amssymb, bm}
\usepackage[nottoc]{tocbibind}
\usepackage{icomma,dcolumn,booktabs}
\newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
\usepackage{tabularx, ragged2e}
\newcolumntype{d}[1]{D{.}{,}{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}
\begin{table}\small
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{@{} L *{8}{c} @{}}
\toprule
Číslo & $P$ & $T_0$ & $e$ & $\omega$ & $i$ & $a$ \\[0.33ex]
zdroje& (dny) & (RJD) & & ($^\circ$) & ($\mathrm{M}_{\odot}$) & ($\mathrm{M}_{\odot}$) \\
\midrule
1 & 5,732436(15) & 54002,780(46) & 0,0910(37) & 149,2(3,0) & & \\
2 & 5.732824(3) & 54002,7241(96) & 0,0858(41) & 145,6(3,9) && \\
3 & 5.732824(1) & 54002,7775(34) & 0,0883(26) & 149,1(2,3) && \\
\bottomrule
\addlinespace
\end{tabularx}
\end{table}
\end{document}
Best Answer
with
siunitx
andmakecell
packages:in your mwe you have mess in use of decimal points and commas. i decide to use decimal points. if you like to have commas in resulting table, than you need to add in preamble:
also your use of uncertainty (with commas) is not clear. such notation is not supported in the
siunitx
pacakage (as far as i know).