1

I have a table imported using the eststo package in Stata that isn't centering using the usual \centering command:

{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{2}{c}}
\hline\hline
            &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
            &\multicolumn{1}{c}{inc\_margin}&\multicolumn{1}{c}{inc\_margin}\\
\hline
incterms    &      -3.115         &      -2.967\sym{*}  \\
            &     (-2.03)         &     (-2.54)         \\
[1em]
RDI\_1       &     -0.0457         &                     \\
            &     (-0.07)         &                     \\
[1em]
RDI\_2       &       0.115         &                     \\
            &      (0.15)         &                     \\
[1em]
RDI\_3       &       0.374         &       0.438         \\
            &      (0.35)         &      (0.51)         \\
[1em]
RDI\_4       &       4.104\sym{***}&       4.095\sym{***}\\
            &      (5.07)         &      (5.73)         \\
[1em]
\_cons      &      -1.143         &      -1.332         \\
            &     (-0.25)         &     (-0.33)         \\
\hline
\(N\)       &          17         &          17         \\
\hline\hline
\multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}
  • Welcome to TeX.SX! Please make your code complete with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but it's necessary to understand your problem and help you. – CarLaTeX Dec 6 '16 at 4:05
  • 1
    Where exactly did you place the `\centering'? Make sure it's outside the outermost brackets. – Michael Palmer Dec 6 '16 at 4:06
  • Assuming you inserted a \centering instruction immediately after the opening curly brace, you must leave at least one blank line (or provide an explicit \par instruction) between \end{tabular} and the closing curly brace. – Mico Dec 6 '16 at 6:52
1

In addition to centering the tabular environment, you may also want to give some thought to making the appearance of the table more visually appealing than what's provided by the eststo Stata package. Among possible improvements are (a) aligning of numbers on the decimal markers, (b) use of better-spaced horizontal lines, i.e., non-use of \hline and \hline\hline, and (c) less-extravagant amounts of whitespace between pairs of rows; I suggest you use \\[1ex] instead of \\[1em].

enter image description here

\documentclass{article}
\usepackage{dcolumn,booktabs}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{document}
{\centering
\begin{tabular}{l*{2}{d{3.5}}} % use 'd' column type instead of 'c'
\toprule % don't use `\hline\hline` and `\hline`
& \mc{(1)} & \mc{(2)}\\
& \mc{inc\_margin} & \mc{inc\_margin}\\
\midrule
incterms  &      -3.115    &      -2.967\sym{*}  \\
          &     (-2.03)    &     (-2.54)         \\[1ex]
RDI\_1    &     -0.0457    &                     \\
          &     (-0.07)    &                     \\[1ex]
RDI\_2    &       0.115    &                     \\
          &      (0.15)    &                     \\[1ex]
RDI\_3    &       0.374    &       0.438         \\
          &      (0.35)    &      (0.51)         \\[1ex]
RDI\_4    &       4.104\sym{***}&       4.095\sym{***}\\
          &      (5.07)         &      (5.73)         \\[1ex]
\_cons    &      -1.143         &      -1.332         \\
          &     (-0.25)         &     (-0.33)         \\
\midrule
\(N\)     &        \mc{17}      &     \mc{17}    \\
\bottomrule
\addlinespace
\multicolumn{3}{l}{\footnotesize \textit{t}-statistics in parentheses}\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
\par % <--- this is needed
}
\end{document}
0

You can use the environment \begin{center}...\end{center} or leave a blank line after \centering (that must be outside the tabular environment).

\documentclass{article}

\begin{document}

\begin{center}

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{2}{c}}
\hline\hline
            &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
            &\multicolumn{1}{c}{inc\_margin}&\multicolumn{1}{c}{inc\_margin}\\
\hline
incterms    &      -3.115         &      -2.967\sym{*}  \\
            &     (-2.03)         &     (-2.54)         \\
[1em]
RDI\_1       &     -0.0457         &                     \\
            &     (-0.07)         &                     \\
[1em]
RDI\_2       &       0.115         &                     \\
            &      (0.15)         &                     \\
[1em]
RDI\_3       &       0.374         &       0.438         \\
            &      (0.35)         &      (0.51)         \\
[1em]
RDI\_4       &       4.104\sym{***}&       4.095\sym{***}\\
            &      (5.07)         &      (5.73)         \\
[1em]
\_cons      &      -1.143         &      -1.332         \\
            &     (-0.25)         &     (-0.33)         \\
\hline
\(N\)       &          17         &          17         \\
\hline\hline
\multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}

\end{center}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.