I am using another piece of software (STATA) to generate the tex code for my statistical tables. I am also using a LyX document with many Child documents to display all the tables in the one document. The tables are based on the booktabs package. I have
\usepackage{graphicx}
\usepackage{booktabs}
in my preamble followed by the code generated by STATA.
To resize each table, I need to insert the following code in the appropriate place:
\resizebox{14cm}{!} { \begin{tabular}... \end{tabular} }. Each individual table is fitted into the 14cm width and the table contents are scaled accordingly and the process is working well.
However, instead of manually inserting the same \resizebox{14cm}{!} { ... } EVERY TIME I produce a new version of the table, how can I automate resizing ALL tables in the LyX document regardless of when they were produced? What else could I add to the preamble to make this happen? I am still quite new to LaTeX and LyX.
Here is some sample code of what I am doing:
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{My TABLE TITLE}
\resizebox{14cm}{!} {
\begin{tabular}{l*{7}{c}}
\toprule
&\multicolumn{1}{c}{Model 1}&\multicolumn{1}{c}{Model 2}&\multicolumn{1}{c}{Model 3}&\multicolumn{1}{c}{Model 4}&\multicolumn{1}{c}{Model 5}&\multicolumn{1}{c}{Model 6}&\multicolumn{1}{c}{Model 7}\\
\midrule
lat & -0.0160\sym{***}& -0.00729\sym{***}& -0.00716\sym{***}& -0.00736\sym{***}& -0.00708\sym{***}& -0.00728\sym{***}& -0.00714\sym{***}\\
& (-73.62) & (-13.10) & (-12.72) & (-13.08) & (-12.65) & (-13.03) & (-13.12) \\
levratio & 0.0142\sym{***}& 0.0368\sym{***}& 0.0366\sym{***}& 0.0368\sym{***}& 0.0366\sym{***}& 0.0367\sym{***}& 0.0369\sym{***}\\
& (10.13) & (14.74) & (14.68) & (14.72) & (14.68) & (14.70) & (14.76) \\
roa & -0.0204\sym{***}& -0.121\sym{***}& -0.121\sym{***}& -0.121\sym{***}& -0.121\sym{***}& -0.120\sym{***}& -0.121\sym{***}\\
& (-14.83) & (-20.08) & (-20.11) & (-20.03) & (-20.11) & (-20.00) & (-20.09) \\
intcovratio & -0.00000100\sym{***}& 0.00000716 & 0.00000735 & 0.00000724 & 0.00000738 & 0.00000734 & 0.00000743 \\
& (-3.40) & (1.24) & (1.27) & (1.25) & (1.28) & (1.27) & (1.29) \\
spindx & -0.0000140 & -0.00000683 & -0.00000705 & -0.00000698 & -0.00000705 & -0.00000718 & -0.00000702 \\
& (-1.63) & (-0.49) & (-0.51) & (-0.51) & (-0.51) & (-0.52) & (-0.51) \\
rating & & -0.00211\sym{***}& -0.00218\sym{***}& -0.00210\sym{***}& -0.00219\sym{***}& -0.00208\sym{***}& -0.00212\sym{***}\\
& & (-14.65) & (-14.36) & (-14.56) & (-14.57) & (-14.08) & (-14.45) \\
al5yr & & 0.000284\sym{+} & -0.000395 & & & & \\
& & (1.86) & (-0.81) & & & & \\
ratXal5yr & & & 0.0000393 & & & & \\
& & & (1.47) & & & & \\
sa5yr & & & & 0.000107 & -0.000744 & & \\
& & & & (0.46) & (-1.29) & & \\
jv5yr & & & & 0.00133 & & 0.00219 & \\
& & & & (1.26) & & (0.74) & \\
lic5yr & & & & 0.000779 & & & 0.000750 \\
& & & & (0.86) & & & (0.39) \\
ratXsa5yr & & & & & 0.0000606\sym{+} & & \\
& & & & & (1.90) & & \\
ratXjv5yr & & & & & & -0.0000328 & \\
& & & & & & (-0.18) & \\
ratXlic5yr & & & & & & & 0.0000266 \\
& & & & & & & (0.25) \\
\_cons & 0.218\sym{***}& 0.172\sym{***}& 0.173\sym{***}& 0.172\sym{***}& 0.172\sym{***}& 0.172\sym{***}& 0.171\sym{***}\\
& (16.95) & (8.12) & (8.13) & (8.11) & (8.11) & (8.12) & (8.06) \\
\midrule
\(N\) & 34559 & 8675 & 8675 & 8675 & 8675 & 8675 & 8675 \\
\(R^{2}\) & 0.217 & 0.297 & 0.297 & 0.297 & 0.297 & 0.297 & 0.297 \\
\bottomrule
\multicolumn{8}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{8}{l}{\footnotesize ...}\\
\multicolumn{8}{l}{\footnotesize ...}\\
\multicolumn{8}{l}{\footnotesize ...}\\
\multicolumn{8}{l}{\footnotesize ...}\\
\multicolumn{8}{l}{\footnotesize ...}\\
\end{tabular}
}
\end{table}
Thanks.
topfand abotfoption for tables. See Publication quality tables in Stata: a tutorial for the tabout program, particularly p.33. – Mike Renfro Jul 13 '15 at 11:34I looked Mike Renfro's suggestion, but that is specific to Stata. I was hoping for a TeX solution.
– iank131 Jul 13 '15 at 13:01