2

I am creating a table and am aligning the numbers in the column with the package \dcolumn. In "normal" cases this works, but not if I add parenthesis.

This is a minmal example that shows my problem:

\documentclass[a4paper,12pt,numbers=noenddot,fleqn]{scrreprt}
\usepackage{dcolumn}
\begin{document}

\begin{table}[htb]
\centering
\begin{tabular}{lD{.}{.}{3}l}

0   & 100(1) &  0.80(6) \\
1   & 71.9(8)&  0.797(6)\\
2   & 7.8(6) &  0.788(6)\\

\end{tabular}
\end{table}
\end{document}

Is there a way I can align the integer in the middle row aswell?

My result

Some things I tried:

...but obviously nothing worked... Thank you!

1 Answer 1

2

With siunitx instead of dcolumn:

enter image description here

\documentclass[a4paper,12pt,numbers=noenddot,fleqn]{scrreprt}
\usepackage{siunitx}
\begin{document}

\begin{table}[htb]
\centering
\begin{tabular}{lS[table-format=3.1(1)]S[table-format=1.3(1)]}
0   & 100(1) &  0.80(6) \\
1   & 71.9(8)&  0.797(6)\\
2   & 7.8(6) &  0.788(6)\\
\end{tabular}
\end{table}
\end{document}
3
  • Thanks for the answer, unfortunately with other packages I use (give to me as a template) there is an error. Is there a way to keep the package dcolumns?
    – HansR
    Commented Sep 26, 2020 at 8:52
  • @HansR: Which error message specifically do you get? Coudld you narrow down the issue to a MWE that allows others to reproduce this error? Probably there is a way to make siunitx cooperate with your template.
    – leandriis
    Commented Sep 26, 2020 at 9:27
  • 1
    The Error was : "! Package siunitx Error: Package 'SIunits' incompatible." If I delete the line \usepackage[amssymb,thinspace]{SIunits} it works as shown by your answer. I will ask my professor if it is neccessary. If not, I got an answer :) It does work now!
    – HansR
    Commented Sep 26, 2020 at 16:31

You must log in to answer this question.

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