[Tex/LaTex] Long variable names in table

tables

I have a long variable name (first column, row three) in a table, is there a way I can separate the variable in two lines? This is my table:

% Tabla 6 test de tendencia paralela
\begin{table}[htbp]
\footnotesize
\begin{adjustwidth}{-1in}{-1in} %
\centering
\caption{Test de tendencia paralela}
\begin{tabular}{lccc}
\toprule
      & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} \\
Variables & \multicolumn{1}{c}{Número de Operaciones NB} & \multicolumn{1}{c}{Desembolsos  PPML} & \multicolumn{1}{c}{Crédito Promedio PPML} \\
    \midrule
      & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
Tratamiento & \multicolumn{1}{c}{0.09} & \multicolumn{1}{c}{-0.28} & \multicolumn{1}{c}{-0.13} \\
      & \multicolumn{1}{c}{(0.17)} & \multicolumn{1}{c}{(0.49)} & \multicolumn{1}{c}{(0.33)} \\
Distancia entre localidad y sucursal (Km) & \multicolumn{1}{c}{-0.75***} & \multicolumn{1}{c}{-3.60***} & \multicolumn{1}{c}{-1.69***} \\
      & \multicolumn{1}{c}{(0.18)} & \multicolumn{1}{c}{(1.01)} & \multicolumn{1}{c}{(0.46)} \\
Recaudación IVA (log) & \multicolumn{1}{c}{0.17} & \multicolumn{1}{c}{0.17} & \multicolumn{1}{c}{0.44**} \\
      & \multicolumn{1}{c}{(0.14)} & \multicolumn{1}{c}{(0.2)} & \multicolumn{1}{c}{(0.19)} \\
Tasa de desempleo & \multicolumn{1}{c}{-3.53} & \multicolumn{1}{c}{-2.97} & \multicolumn{1}{c}{3.3} \\
      & \multicolumn{1}{c}{(3.55)} & \multicolumn{1}{c}{(6.34)} & \multicolumn{1}{c}{(5.62)} \\
Crédito familias (log) & \multicolumn{1}{c}{-0.12} & \multicolumn{1}{c}{-0.40*} & \multicolumn{1}{c}{-0.41**} \\
      & \multicolumn{1}{c}{(0.09)} & \multicolumn{1}{c}{(0.24)} & \multicolumn{1}{c}{(0.19)} \\
Constante      & \multicolumn{1}{c}{} & \multicolumn{1}{c}{6.73***} & \multicolumn{1}{c}{3.19**} \\
                & \multicolumn{1}{c}{} & \multicolumn{1}{c}{(1.76)} & \multicolumn{1}{c}{(1.33)} \\
    \bottomrule
    \multicolumn{4}{l}{\textsuperscript{}\footnotesize{Período: septiembre 2011 a abril de 2012. Errores clúster a nivel de localidad. *** p<0.01, ** p<0.05, * p<0.1}}
\end{tabular}%
    \label{tab:paralela}%
\end{adjustwidth}
\end{table}%

Best Answer

I think you should do the following:

  • Get rid of all \multicolumn{1}{c}{...} "wrappers"

  • Use a package, e.g., the dcolumn package, to align the numeric data in columns 2, 3, and 4 on the decimal markers

  • Use a tabularx environment, with width set to \textwidth, instead of tabular.

  • Use \addlinespace directives generously.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{booktabs,tabularx,ragged2e,dcolumn,caption} 
\newcolumntype{C}{>{\Centering\arraybackslash \hspace{0pt}}X}
\newcolumntype{d}[1]{D{.}{,}{#1}}
% handy shortcut macros
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\MC[1]{\multicolumn{1}{C}{#1}}

\begin{document}

\begin{table}
\small
\caption{Test de tendencia paralela} \label{tab:paralela}
\begin{tabularx}{\textwidth}{@{} l *{3}{d{2.4}} @{}}
\toprule
Variables & \mc{(1)} & \mc{(2)} & \mc{(3)} \\ 
          & \MC{Número de Operaciones NB} 
          & \MC{Desembolsos  PPML} 
          & \MC{Crédito Promedio PPML} \\
\midrule
\addlinespace
Tratamiento            & 0.09 & -0.28 & -0.13 \\
                       & (0.17) & (0.49) & (0.33) \\
\addlinespace
Distancia entre localidad & -0.75^{***} & -3.60^{***} & -1.69^{***} \\
\quad y sucursal (km)     & (0.18) & (1.01) & (0.46) \\
\addlinespace
Recaudación IVA (log)  & 0.17 & 0.17 & 0.44^{**} \\
                       & (0.14) & (0.2) & (0.19) \\
\addlinespace
Tasa de desempleo      & -3.53 & -2.97 & 3.3 \\
                       & (3.55) & (6.34) & (5.62) \\
\addlinespace
Crédito familias (log) & -0.12 & -0.40^{*} & -0.41^{**} \\
                       & (0.09) & (0.24) & (0.19) \\
\addlinespace
Constante              &  & 6.73^{***} & 3.19^{**} \\
                       &  & (1.76) & (1.33) \\
\bottomrule
\addlinespace
\multicolumn{4}{@{}l}{\footnotesize Período: septiembre 2011 a abril de 2012. Errores clúster a nivel de localidad.}\\
\multicolumn{4}{@{}l}{\footnotesize ${}^{***}\ p<0.01$; ${}^{**}\ p<0.05$; ${}^{*} p<0.1$}\\
\end{tabularx}
\end{table}
\end{document}
Related Question