# Need help using dcolumn

Please help! I need to align my table which looks crazy right now. I tried working with the dcolumn package but couldn't get it to work. Any help is appreciated!

MWE:

\documentclass[twocolumn]{article}

\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcommand\mC[1]{\multicolumn{1}{C@{}}{#1}}
\sisetup{group-separator={,}, group-minimum-digits=4}
\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}
\usepackage{makecell}
\setcellgapes{2pt}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{upquote}
\usepackage{balance}
\usepackage{wasysym}
\usepackage{footmisc}
\usepackage{float}
\floatstyle{boxed}
\restylefloat{figure}

%ZARKO:
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage{textcomp}
\usepackage{booktabs, makecell, tabularx}
\setcellgapes{2pt}
\usepackage{siunitx}
\sisetup{group-integer-digits,% in case of rounding decimals to three digits can be omitted
group-separator={,},
group-minimum-digits=4
}
\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}
%END ZARKO

\title{\LARGE \bf ECON 425 Term Paper}

\author{}

\begin{document}

\begin{table*}[!htbp]
\caption{Estimates of pay-performance sensitivity.}
\label{tab:table1}
OLS regressions of CEO salary and CEO total compensation on change in shareholder wealth. Standard errors in parentheses.

\medskip
\setlength\tabcolsep{4pt}
\small
\makegapedcells
\begin{tabularx}{\textwidth}{@{}L lll@{}}
\toprule
salary\\
(eq. \ref{eqn:first})}

compensation\\
(eq. \ref{eqn:second})}

& \thead[l]{CEO salary \\ (not controlling \\for industry) (eq. \ref{eqn:third})}

\\

Return (\%)       &  $\underset{(0.083))}{-0.320}$        &   $\underset{(1.545)}{2.213}$        &  $\underset{(0.082)}{-0.303}$
\\
Volume & $\underset{(0.000)}{0.002}$ & $\underset{(0.003)}{0.069}$ & $\underset{(0.000)}{0.002}$
\\
Return*Volume   & $\underset{(0.000)}{0.000}$      &  $\underset{(0.000)}{0.000}$   &   $\underset{(0.000)}{0.000}$                          \\
Log (bonus)
&  $\underset{(1.38)}{-5.269}$   & --- & $\underset{(1.365)}{-6.431}$          \\

Stock Awards    & $\underset{(0.000)}{0.036}$ & --- &  $\underset{(0.000)}{0.036}$                   \\
Option Awards    &  $\underset{(0.000)}{0.023}$        & --- &  $\underset{(0.001)}{0.027}$                      \\
Other Compensation & $\underset{(0.000)}{0.028}$ & --- & $\underset{(0.003)}{0.027}$
\\
Age &  $\underset{(4.567)}{33.387}$ &  $\underset{(84.768)}{913.016}$ &  $\underset{(4.575)}{39.237}$
\\
Age\textsuperscript{2} & $\underset{(0.039)}{-0.217}$ &  $\underset{(0.733)}{-7.435}$ &  $\underset{(0.039)}{-0.267}$
\\
Male & $\underset{(18.079)}{-2.601}$ & $\underset{(337.631)}{-465.612}$ &  $\underset{(17.615)}{-31.349}$
\\
Outdoors &  $\underset{(77.902)}{-173.761}$ & $\underset{(1453.675)}{-4268.128}$
\\
Mining & $\underset{(26.792)}{-178.289}$ & $\underset{(499.369)}{-972.327}$
\\
Utilities & $\underset{(34.906)}{-199.853}$  &  $\underset{(651.127)}{-4217.222 }$
\\
Construction & $\underset{(33.259)}{-102.424}$ & $\underset{(620.558)}{-3572.244}$
\\
Wholesale &  $\underset{(28.814)}{-193.954}$ &  $\underset{(537.382)}{-3827.542}$
\\
Information &  $\underset{(24.494)}{-218.414}$ &  $\underset{(456.968)}{-618.642}$
\\
Finance &  $\underset{(23.320)}{-160.005}$ & $\underset{(434.591)}{-3078.595 }$
\\
Real estate &  $\underset{(25.248)}{-303.096}$ & $\underset{(470.966)}{-3410.482}$
\\
Professional & $\underset{(27.486)}{-238.323}$ & $\underset{(512.813)}{-3776.246}$
\\
Waste  & $\underset{(31.766)}{-186.965}$& $\underset{(592.813)}{-3365.898}$
\\
Education & $\underset{(50.956)}{-287.113}$ & $\underset{(950.712)}{-5770.548}$
\\
Healthcare & $\underset{(32.953)}{-153.385}$ & $\underset{(615.121)}{-2123.471}$
\\
Arts & $\underset{(56.622)}{178.082}$ & $\underset{(1056.786)}{-2303.748}$
\\
Food & $\underset{(31.091)}{-34.24}$ & $\underset{(579.849)}{-2656.446}$
\\
Other & $\underset{(61.642)}{-109.691}$ & $\underset{(1150.511)}{-3786.196}$
\\
Manufacturing & $\underset{(22.394)}{-193.729}$ & $\underset{(417.698)}{-2540.859}$
\\
Transportation & $\underset{(29.509)}{-313.349}$ & $\underset{(551.778)}{-3678.069}$
\\
Retail &  $\underset{(25.756)}{-80.145}$ & $\underset{(480.656)}{-2295.232}$
\\
\bottomrule
\end{tabularx}

\smallskip
$^{*}p<0.10$, $^{**}p<0.05$, $^{***}p<0.01$.
\end{table*}

\end{document}


Here's how it looks at the moment:

• You have several of the same packages loaded twice. Perhaps that is causing some issues? – AML May 7 '18 at 2:25
• @AML I will delete some of the repeated packages and see if that helps. – texmex May 7 '18 at 2:27
• In a dcolumn-based column, the paradigm is "one number per cell". You definitely can't have things like $\underset{(0.083))}{-0.320}$ (of which you have a great many). – Mico May 7 '18 at 3:19
• A separate comment: What purpose is being served by showing the final 18 rows of the regression output? If I understand your table, the 18 rows show coefficients (and standard errors) for 18 sector dummy variables. Unless you make a big point somewhere in the body of the text about the coefficient estimates of the 18 dummy variables, you may as well not shown them at all and, instead, put in a blurb in the table to state that regressions 1 and 2 included 18 sectoral dummies. Your readers will actually appreciate it. – Mico May 7 '18 at 7:28
• @Mico I wish I heard this before I submitted the paper. Thanks though. – texmex May 7 '18 at 23:10

The dcolumn package expects that the cells it's supposed to operate on contain just one number -- more precisely, just one number that contains a decimal marker. The cell contents are automatically placed in math mode; adding $...$ delimiters isn't appropriate, and \underset{...}{...} won't work either.

If you want to proceed with the dcolumn approach, you'll have to rewrite all three data columns significantly. You will also, in all likelihood, have to split the table across two pages, since you have an astonishingly large number of regression coefficients to report.

Here's how the first few rows of the modified table might look like:

\documentclass[twocolumn]{article}

\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath} % Times Roman text and math fonts
\usepackage{amsmath,geometry,booktabs}

\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcommand\mC[1]{\multicolumn{1}{C@{}}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c@{}}{#1}}

\usepackage{siunitx}
\sisetup{group-separator={,}, group-minimum-digits=4}

\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}

\usepackage{makecell}
\setcellgapes{2pt}

\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{upquote,balance,wasysym,footmisc}

\usepackage{float}
\floatstyle{boxed}
\restylefloat{figure}

%ZARKO:
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage{textcomp}
\usepackage{booktabs, makecell, tabularx}
\setcellgapes{2pt}
\usepackage{siunitx}
\sisetup{group-integer-digits,% in case of rounding decimals to three digits can be omitted
group-separator={,},
group-minimum-digits=4
}
\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}
%END ZARKO

%% MICO
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}

\begin{document}

\begin{table*}[!htbp]
\caption{Estimates of pay-performance sensitivity.}
\label{tab:table1}
\small
OLS regressions of CEO salary and CEO total compensation on change in shareholder wealth. Standard errors in parentheses.

\medskip
\makegapedcells
\begin{tabularx}{\textwidth}{@{} L *{3}{d{2.4}} @{}}
\toprule
Dependent variable
& \mc{\thead[l]{CEO total\\ compensation\\ (eq. \ref{eqn:second})}}
& \mc{\thead[l]{CEO salary (not\\ controlling for\\ industry) (eq. \ref{eqn:third})}}
\\
\midrule
Return (\%)   & -0.320  & 2.213   & -0.303  \\
& (0.083) & (1.545) & (0.082) \\
Volume        & 0.002   & 0.069   & 0.002   \\
& (0.000) & (0.003) & (0.000) \\
Return\,$*$Volume & 0.000   & 0.000   & 0.000   \\
& (0.000) & (0.000) & (0.000) \\
\dots \\
\bottomrule
\end{tabularx}

\smallskip
$^{*}p<0.10$, $^{**}p<0.05$, $^{***}p<0.01$.
\end{table*}

\end{document}