Align numbers with numbers and asterisks in table by decimal point
The siunitx
approach would be something like
\documentclass{article}
%tables
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{siunitx} %align numbers by decimal point
\begin{document}
\sisetup{table-format = -1.2}
\begin{longtable}[]{S[table-format=2.0]SSSS[table-format = 0.2]}
\caption{} \label{}\\
\toprule
{\textbf{Item}} & {\textbf{\textit{b}}} & {\textbf{\textit{t}}} & {\textbf{\textit{F}}} & {\textbf{\textit{R$^2$}}}\\
\midrule
\endfirsthead
\toprule
{\textbf{Item}} & {\textbf{\textit{b}}} & {\textbf{\textit{t}}} & {\textbf{\textit{F}}} & {\textbf{\textit{R$^2$}}}\\
\midrule
\endhead
\bottomrule
\endfoot
\endlastfoot
1 & -1.45{$^{***}$} & -7.44{$^{***}$} & 55.34 & .18 \\
11 & -.86{$^{*}$} & -2.09{$^{*}$} & 4.36 & .01 \\
12 & -1.79{$^{***}$} & -3.80{$^{***}$} & 14.47 & .05 \\
13 & -.56 & -1.34 & 1.80 & .00 \\
61 & -1.79{$^{***}$} & -5.85{$^{***}$} & 34.20 & .12 \\
62 & -1.00{$^{**}$} & -3.17{$^{**}$} & 10.05 & .04 \\
63 & -.27 & -.65 & .43 & .00 \\
64 & -.37 & -.97 & .94 & .00 \\
65 & -.34 & -.85 & .73 & .00 \\
66 & 1.05{$^{**}$} & 2.70{$^{**}$} & 7.30 & .02 \\
67 & -1.12{$^{**}$} & -2.90{$^{**}$} & 8.40 & .03 \\
72 & -.41 & -1.20 & 1.43 & .00 \\
73 & -.27 & -.82 & .67 & .00 \\
74 & 2.05{$^{***}$} & 4.99{$^{***}$} & 24.88 & .09 \\
75 & 1.61{$^{***}$} & 4.41{$^{***}$} & 19.46 & .07 \\
76 & .29 & .91 & .83 & .00 \\
\bottomrule
\end{longtable}
\end{document}
which requires a little alteration of the data positioning in the table, and appropriate application of the table-format
option. If you want the final column not to add in the leading zero, set add-integer-zero = false
.
The dcolumn
package already uses math mode to typeset its numbers. Which will give you things like proper minus signs and so on. So your $
for the superscript are actually interpreted as leaving math mode.
I suggest fixing the document in the following way:
Get rid of all the
$
around your stars, e.g.1 & -1.45^{***} & -7.44^{***} & 55.34 & .18 \\
Treat stars like digits in the space computation:
\begin{longtable}[]{d{2.0}d{2.5}d{2.5}d{2.2}d{0.2}}
Use
multicolumn
to specify a different format for your headers:\multicolumn{1}{c}{\textbf{Item}} & \multicolumn{1}{c}{\textbf{b}} & \multicolumn{1}{c}{\textbf{t}} & \multicolumn{1}{c}{\textbf{F}} & \multicolumn{1}{c}{\textbf{R$^2$}} \\
The result looks like this: