I have the following problem: I would like to have a larger column spacing in the middle of my table in order to visually separate two different model specifications. I generally use dcolumn and multicolumn to create my table. Then I used \extracolsep in order to enforce different column spaces. However, this also messes with the \multicolumn spacing and I end up with a missaligned table.
MWE:
\documentclass[]{article}
\usepackage{dcolumn,tabularx,float}
\title{Minimum Working Example}
\author{Methamortix}
\begin{document}
\maketitle
\begin{abstract}
How to tex a beautiful tables.
\end{abstract}
\section{the MWE}
\begin{table}[H] \centering
\caption{A nice table }
\label{}
\tiny
\begin{tabular}{@{\extracolsep{-5pt}} lD{.}{.}{-3} @{\extracolsep{-10pt}} D{.}{.}{-3}@{\extracolsep{-10pt}} D{.}{.}{-3}@{\extracolsep{10pt}} D{.}{.}{-3} @{\extracolsep{-10pt}} D{.}{.}{-3} @{\extracolsep{-10pt}} D{.}{.}{-3} }
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{6}{c}{\textit{Dependent variable:}} \\
\cline{2-7}
\\[-1.8ex] & \multicolumn{6}{c}{ } \\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} & \multicolumn{1}{c}{(5)} & \multicolumn{1}{c}{(6)}\\
\hline \\[-1.8ex]
Medicine A & 0.999^{**} & 0.888 & 0.777^{**} & 0.666^{***} & 0.555 & 0.444 \\
& (0.111) & (0.222) & (0.333) & (0.444) & (0.555) & (0.666) \\
& & & & & & \\
Medicine B & 1.555 & 1.666^{***} & 1.777 & 1.888^{***} & 1.999 & 2.000^{*} \\
& (0.111) & (0.222) & (0.333) & (0.444) & (0.555) & (0.666) \\
& & & & & & \\
\hline \\[-1.8ex]
Observations & \multicolumn{1}{c}{200000} & \multicolumn{1}{c}{200000} & \multicolumn{1}{c}{200000} & \multicolumn{1}{c}{200000} & \multicolumn{1}{c}{200000} & \multicolumn{1}{c}{200000} \\
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.50} & \multicolumn{1}{c}{0.50} & \multicolumn{1}{c}{0.50} & \multicolumn{1}{c}{0.50} & \multicolumn{1}{c}{0.50} & \multicolumn{1}{c}{0.50} \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
\end{document}
This gives the following result:
As you can see the alignment of the column names and the number of observations and goodness of fit measure are now messed up.
Has someone some insights on how to fix this problem? Or maybe a different solution to end up with a space separation between column 3 and 4?
Thanks a lot!
Best Answer
Your table code is quite unusual. I would rather write your table on the following way:
Edit: Added example of use sign
-
in table.