Graphics, Figures & Tablesbooktabs error

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
AAAA
Posts: 1
Joined: Tue Oct 30, 2018 4:56 pm

booktabs error

Post by AAAA »

Hi!

I'm writing my bachelor thesis in stata and I'm trying to export the regression tables to latex.
I do this in the common way: eststo

But if do:
esttab using table1.tex, booktab

I get the error:
./template.tex:82: Undefined control sequence.
l.82 \toprule

?
My code look as follows:
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{c}}
\toprule
            &\multicolumn{1}{c}{(1)}\\
            &\multicolumn{1}{c}{\_\_000001}\\
\midrule
post        &      -1.308\sym{***}\\
            &    (-11.74)         \\
\addlinespace
treatment   &     -0.0783         \\
            &     (-1.70)         \\
\addlinespace
\_diff       &      0.0593         \\
            &      (0.38)         \\
\addlinespace
\_cons      &       7.932\sym{***}\\
            &    (232.89)         \\
\midrule
\(N\)       &        3931         \\
\bottomrule
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}
What is wrong here? Do I have to change anything? Is it Stata or Latex that's not working?
Thank you so much for the help!

A.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

booktabs error

Post by Stefan Kottwitz »

Hi A.

welcome to the forum!

You need to load the booktabs package:

\usepackage{booktabs}

Note, it's not called booktab.

Stefan
LaTeX.org admin
Post Reply