# Troubles with dcolumn package - how to use underscores?

I do have following table:

\documentclass[11   pt, oneside]{thesis}

\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}

\begin{tabular}{p{0.2\textwidth} d{2.2} p{0.1\textwidth} p{0.1\textwidth} p{0.1\textwidth} p{0.1\textwidth} }
\toprule
&- \Delta G_{5.0}& $\Phi$ $J/mol$& $\nu$ & $\sigma$ & $K_{kin}$ \\
\midrule
Light chain & -1.74e3 & - 0.9e3 & 2.2 & 10 & 1e3 \\
Heavy chain & - 3.24e3 &- 1.8e3 & 3.3 & 21 & 1e3 \\
Monomer & - 9.73e3 &- 5.5e3 & 6.6 & 57 & 1e3 \\
Dimer & - 18.0e3 &- 8.9e3 & 12.2 & 122 & 1e3 \\
Oligomer & - 20.3e3 & - 17.1e3 & 24.2 & 378 & 1e3 \\
\bottomrule
\end{tabular}
\end{document}


What works is G_5 but not G_{5.0} I do get the error: Missing } inserted & \Delta G_{5. Without the dcolumn package everything works fine.

Any ideas why ?

• \multicolumn{1}{c}{$G_{5.0}$} May 22 '15 at 12:02
• unrelated but 2.2 doesn't leave enough space for - 18.0e3 also why use d alignment for column 2 but p for column 3? May 22 '15 at 12:04
• you might want to look at siunitx and its table formatting instead. It is much more advanced than dcolumn (which though have its use from time to time). Regarding Davids first comment: remember this is a headline, these have to be handled specially, e.g. with \multicolumn May 22 '15 at 12:13

It's easier to use siunitx, because it also allows for different output formats with the same input:

\documentclass{article}
\usepackage{booktabs,siunitx}

\begin{document}

\begin{tabular}{
l
S[table-format=-2.2e1]
S[table-format=-2.1e1]
S[table-format=2.1]
S[table-format=3.0]
S[table-format=1.0e1]
}
\toprule
&{$-\Delta G_{5.0}$}& {$\Phi$ \si{J/mol}} & {$\nu$} & {$\sigma$} & {$K_{\mathrm{kin}}$} \\
\midrule
Light chain &  -1.74e3 &  -0.9e3 &  2.2 &  10 & 1e3 \\
Heavy chain &  -3.24e3 &  -1.8e3 &  3.3 &  21 & 1e3 \\
Monomer     &  -9.73e3 &  -5.5e3 &  6.6 &  57 & 1e3 \\
Dimer       & -18.0 e3 &  -8.9e3 & 12.2 & 122 & 1e3 \\
Oligomer    & -20.3 e3 & -17.1e3 & 24.2 & 378 & 1e3 \\
\bottomrule
\end{tabular}

\bigskip

\sisetup{output-exponent-marker={\,e\,},exponent-base={},exponent-product={}}

\begin{tabular}{
l
S[table-format=-2.2e1]
S[table-format=-2.1e1]
S[table-format=2.1]
S[table-format=3.0]
S[table-format=1.0e1]
}
\toprule
&{$-\Delta G_{5.0}$}& {$\Phi$ \si{J/mol}} & {$\nu$} & {$\sigma$} & {$K_{\mathrm{kin}}$} \\
\midrule
Light chain &  -1.74e3 &  -0.9e3 &  2.2 &  10 & 1e3 \\
Heavy chain &  -3.24e3 &  -1.8e3 &  3.3 &  21 & 1e3 \\
Monomer     &  -9.73e3 &  -5.5e3 &  6.6 &  57 & 1e3 \\
Dimer       & -18.0 e3 &  -8.9e3 & 12.2 & 122 & 1e3 \\
Oligomer    & -20.3 e3 & -17.1e3 & 24.2 & 378 & 1e3 \\
\bottomrule
\end{tabular}

\end{document}


As you see, changing options will change the output, but the input is exactly the same.

Please always post complete documents showing packages used.

Don't use p columns for numeric data, you can use \multicolumn for headings which need a different format, don't use math italic for multi-letter identifiers such as mol.

\documentclass{article}
\usepackage{dcolumn,booktabs}
\newcolumntype{d}{D..}

\begin{document}

\begin{tabular}{
l
d{3.4}
d{2.3}
d{2.1}
d{3.0}
D{e}{e}{1.1}
}

\toprule
&
\multicolumn{1}{c}{$- \Delta G_{5.0}$}&
\multicolumn{1}{c}{$\Phi$ $J/\mathrm{mol}$}&
\multicolumn{1}{c}{$\nu$}&
\multicolumn{1}{c}{$\sigma$}&
\multicolumn{1}{c}{$K_{\mathrm{kin}}$}\\
\midrule
Light chain & -1.74e3 & - 0.9e3 & 2.2 & 10 & 1e3 \\
Heavy chain & - 3.24e3 &- 1.8e3 & 3.3 & 21 & 1e3 \\
Monomer & - 9.73e3 &- 5.5e3 & 6.6 & 57 & 1e3 \\
Dimer & - 18.0e3 &- 8.9e3 & 12.2 & 122 & 1e3 \\
Oligomer & - 20.3e3 & - 17.1e3 & 24.2 & 378 & 1e3 \\
\bottomrule
\end{tabular}

\end{document}