0

I am outputting regression results from Stata to Latex. The problem is that, no matter how many columns I have, the spacing between the last column and the rest of the table is wider than other columns. I believe this is because I include a long note via the eesttab option in Stata:

 addnote("\begin{minipage}[t]{\columnwidth} 4-line CAPTION \end{minipage}")

Here is an example of Latex output:

\begin{document}
\begin{landscape}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
 \setlength{\tabcolsep}{1pt}
\renewcommand{\arraystretch}{.9}
\begin{longtable}{l*{8}{c}}
\caption{OLS: \% Managed Care (All Models)}\\
\hline\hline
                    &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}&\multicolumn{1}{c}{(6)}&\multicolumn{1}{c}{(7)}&\multicolumn{1}{c}{(8)}\\
                     &         b/t         &         b/t         &         b/t         &         b/t         &         b/t         &         b/t         &         b/t         &         b/t         \\
\hline
Emergency Fund Shock&    -0.00156         &    -0.00207\sym{**} &    -0.00293\sym{***}&    -0.00264\sym{***}&  -0.0000396         &    0.000367         &    0.000420\sym{***}&    0.000420\sym{***}\\
                    &     (-0.52)         &     (-3.13)         &     (-3.71)         &     (-3.62)         &     (-0.18)         &      (0.67)         &      (4.20)         &      (4.60)         \\
\end{longtable}
}
\end{landscape}
\end{document}

Is there a better way to add a caption to tex tables via esttab in Stata? I am trying to avoid having to edit each table by hand.

1 Answer 1

2

I fixed your code because it doesn't typeset as is, I also changed some things to make the table "cleaner". I also removed the \multicolumn commands you added, which were useless considering you only had single columns. This command is useful if your header refers to 2 or more columns, but for a single one, it's not needed.

I personally don't see particularly long space before the last column. Let me know if what you see below is what you see when you typeset.

The space I see between (7) and (8) is the same I see between (3) and (4) and between (4) and (5). I think it's just a matter of the amount of content.

One last thing, I commented out this command \setlength{\tabcolsep}{1pt}. The reason is that setting the column space to 1 point, it makes it even smaller than the default one. The table looked a bit better after removing that command. You could increase the value, but the spacing between columns will remain proportional, therefore pretty much unchanged.

longtable

\documentclass{article}
\usepackage[a4paper, landscape]{geometry}
\usepackage{booktabs}
\usepackage{longtable}

\begin{document}

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
%\setlength{\tabcolsep}{1pt}
\renewcommand{\arraystretch}{.9}

\begin{longtable}{l*{8}{c}}
\caption{OLS: \% Managed Care (All Models)}\\
\toprule

    & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\
    & b/t & b/t & b/t & b/t & b/t & b/t & b/t & b/t \\ \midrule

Emergency Fund Shock & -0.00156 & -0.00207\sym{**} &  -0.00293\sym{***} & -0.00264\sym{***} & -0.0000396 & 0.000367 & 0.000420\sym{***} & 0.000420\sym{***} \\

    & (-0.52) & (-3.13) & (-3.71) & (-3.62) & (-0.18) & (0.67) & (4.20) & (4.60) \\ 

\bottomrule
\end{longtable} 
\end{document}
1
  • Thank you. Your code worked very well! Thank you. I realize that the problem is a long footnote I am trying to include at the bottom of the table. The last line is `\multicolumn{9}{l}{\footnotesize \begin{minipage}[t]{\columnwidth} The unit of observation is the county-year level and the total number of observations is a really big number. (Row 1) is the difference between the emergency fund balance predicted by the previous fiscal year and the amount reported at the close of the fiscal year t, scaled by the latter amount.\end{minipage}}\`
    – user32881
    Oct 13, 2013 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .