Graphics, Figures & Tablesbeamer | Problems with Stata Output

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
wonder
Posts: 3
Joined: Sat Feb 11, 2012 7:52 am

beamer | Problems with Stata Output

Post by wonder »

Hi all,

I am creating a table in Beamer, and there is one question that really bothers me. The following code works well in MiKTeX, but it does not work in Beamer. Anyone could tell me why? By the way, these codes are generated by Stata. Thank you.

My code looks like this:

Code: Select all

\documentclass[12pt]{beamer} 
\usetheme{CambridgeUS}
\usefonttheme{professionalfonts} 
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{ctable}

\begin{document}
\begin{frame}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\ctable[
caption=2000 Black Results from  Second Step of Residential Sorting Model,
nosuper,
notespar,
label=secondstep2000b
]
{@{} l*{9}{c} @{}}
{\tnote[Notes:]{P value of Hansen’s J Statistics tests the overidentifying restrictions in the presence of heterogeneity. F statistics test the joint significance of excluded instruments in the first stage under the assumption of heterogeneity. Robust Standard errors adjusted for heterogeneity in parentheses\\
 \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<.01\)
}}
{
\toprule
                &\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)}&\multicolumn{1}{c}{(9)}\\
                &\multicolumn{1}{c}{OLS}&\multicolumn{1}{c}{OLS}&\multicolumn{1}{c}{Fiscal 2SLS}&\multicolumn{1}{c}{Fiscal 2SLS}&\multicolumn{1}{c}{Topographic 2SLS}&\multicolumn{1}{c}{Topographic 2SLS}&\multicolumn{1}{c}{RDI 2SLS}&\multicolumn{1}{c}{RDI 2SLS}&\multicolumn{1}{c}{Preferred 2SLS}\\
\midrule
ln(dissimilarity index)&   -1.161\sym{***}&   -0.899\sym{***}&   -2.197\sym{***}&   -2.234\sym{***}&   -1.039         &   -2.609\sym{*}  &   -0.196         &   -0.546         &   -2.241\sym{***}\\
                &  (0.204)         &  (0.161)         &  (0.372)         &  (0.372)         &  (1.243)         &  (1.348)         &  (1.059)         &  (1.100)         &  (0.372)         \\
\addlinespace
ln(population)  &    0.919\sym{***}&    1.051\sym{***}&    0.992\sym{***}&    1.094\sym{***}&    0.919\sym{***}&    1.088\sym{***}&    1.111\sym{***}&    1.106\sym{***}&    1.094\sym{***}\\
                & (0.0474)         & (0.0449)         & (0.0564)         & (0.0522)         & (0.0849)         & (0.0638)         & (0.0501)         & (0.0698)         & (0.0522)         \\
\addlinespace
ln(black share) &    0.874\sym{***}&    0.806\sym{***}&    0.885\sym{***}&    0.871\sym{***}&    0.810\sym{***}&    0.907\sym{***}&    0.239         &    0.497\sym{*}  &    0.871\sym{***}\\
                & (0.0661)         & (0.0555)         & (0.0772)         & (0.0725)         &  (0.113)         &  (0.123)         &  (0.265)         &  (0.270)         & (0.0726)         \\
\addlinespace
ln(population density)&                  &   -0.190\sym{***}&                  &  -0.0755         &                  &  -0.0753         &                  &   -0.128         &  -0.0749         \\
                &                  & (0.0679)         &                  & (0.0871)         &                  &  (0.119)         &                  &  (0.158)         & (0.0868)         \\
\addlinespace
ln(college share)&                  &    1.570\sym{***}&                  &    1.357\sym{***}&                  &    1.440\sym{***}&                  &    1.049\sym{***}&    1.357\sym{***}\\
                &                  &  (0.202)         &                  &  (0.249)         &                  &  (0.259)         &                  &  (0.345)         &  (0.249)         \\
\addlinespace
ln(gini)        &                  &   -2.527\sym{***}&                  &   -1.627         &                  &   -1.449         &                  &   -2.068         &   -1.624         \\
                &                  &  (0.792)         &                  &  (0.997)         &                  &  (1.196)         &                  &  (2.002)         &  (0.998)         \\
\addlinespace
ln(median household income)&                  &   -2.513\sym{***}&                  &   -2.248\sym{***}&                  &   -2.168\sym{***}&                  &   -0.777         &   -2.248\sym{***}\\
                &                  &  (0.418)         &                  &  (0.514)         &                  &  (0.554)         &                  &  (0.826)         &  (0.515)         \\
\addlinespace
ln(manufacturing share)&                  &    0.110         &                  &    0.350\sym{***}&                  &    0.359         &                  &   0.0316         &    0.351\sym{***}\\
                &                  & (0.0893)         &                  &  (0.120)         &                  &  (0.226)         &                  &  (0.241)         &  (0.120)         \\
\addlinespace
Constant        &    3.364\sym{***}&    28.45\sym{***}&    6.564\sym{***}&    30.89\sym{***}&    2.764         &    31.97\sym{***}&   -4.796         &    6.088         &    30.92\sym{***}\\
                &  (0.841)         &  (4.106)         &  (1.333)         &  (5.066)         &  (4.244)         &  (6.349)         &  (4.991)         &  (10.65)         &  (5.058)         \\
\midrule
Observations    &      210         &      210         &      184         &      184         &      198         &      198         &       60         &       60         &      184         \\
Adjusted \(R^{2}\)&    0.699         &    0.790         &    0.667         &    0.726         &    0.719         &    0.714         &    0.771         &    0.797         &    0.725         \\
P\_value\_of\_Hansen\_J&                  &                  &  0.00147         &    0.240         &   0.0104         &    0.299         &                  &                  &    0.447         \\
F\_statistics    &                  &                  &    29.98         &    26.17         &    2.946         &    2.363         &    5.635         &    3.744         &    13.48         \\
\bottomrule
} 
\end{frame}
\end{document}
Last edited by localghost on Sat Feb 11, 2012 10:15 am, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

beamer | Problems with Stata Output

Post by localghost »

Your table is simply too big to fit on a single frame. So beamer complaints and presumably expects at least the »fragile« option on the concerned frame (though this won't help). Possibly there are some modifications necessary.
  • Decreasing of the font size.
  • Horizontal compression of the table by reorganization of some cells contents or scaling.
  • Split of the table in two (or more) parts two show it on several consecutive frames.
By the way, the code for table compiles in other classes like »article«. So this is not the problem.


Best regards and welcome to the board
Thorsten
wonder
Posts: 3
Joined: Sat Feb 11, 2012 7:52 am

Re: beamer | Problems with Stata Output

Post by wonder »

Hi Thorsten:
Thank you for your reply. When I compile these codes, the error message is "! Illegal parameter number in definition of \test.". I guess there may be something wrong with "\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}", but I did not know what it is.

Best Wishes
Post Reply