Could anyone help me figure out what's the real problem here? I'm creating a table with some data exported from Stata, but I can't seem to get the input
command to work properly. If I paste the code from the input file, then everything works properly. The code
\documentclass{article}
\usepackage{booktabs}
\newcommand{\sym}[1]{\rlap{$#1$}} % for symbols in Table
\begin{document}
\begin{table*}\centering
\begin{tabular}{@{}cccccccc@{}}\toprule
& \multicolumn{3}{c}{A} & \phantom{abc}& \multicolumn{3}{c}{B}\\ \cmidrule{2-4} \cmidrule{6-8}
& 1 & 2 & 3 && 1 & 2 & 3\\
\midrule
C & 0.60 & 0.951 & 0.245 & & 1.151 & 1.563 & 0.586 \\
& (0.262) & (0.364) & (0.310) & & (0.620) & (0.905) & (0.696) \\
\midrule
\(N\) & 919629 & 468093 & 451536 & & 186271 & 94771 & 91500 \\
\bottomrule
\end{tabular}
\end{table*}
\end{document}
generates the following pretty table.
But if I use the Stata-generated file ("minimal_data") as is
\midrule
C & 0.606 & 0.951 & 0.245 & & 1.151 & 1.563 & 0.586 \\
& (0.262) & (0.364) & (0.310) & & (0.620) & (0.905) & (0.696) \\
\midrule
\(N\) & 919629 & 468093 & 451536 & & 186271 & 94771 & 91500 \\
together with
\documentclass{article}
\usepackage{booktabs}
\newcommand{\sym}[1]{\rlap{$#1$}} % for symbols in Table
\begin{document}
\begin{table*}\centering
\begin{tabular}{@{}cccccccc@{}}\toprule
& \multicolumn{3}{c}{A} & \phantom{abc}& \multicolumn{3}{c}{B}\\ \cmidrule{2-4} \cmidrule{6-8}
& 1 & 2 & 3 && 1 & 2 & 3\\
\input{minimal_data}
\bottomrule
\end{tabular}
\end{table*}
\end{document}
then I encounter all kinds of errors.
\@@input minimal_data
and put\makeatletter
before thetabular
\input
is not expandadable so starts the first cell, so you can not have\midrule
as the first thing in the file. The\@@input
form with no braces is the tex primitivetabular
environment in the "minimal_data" file.frmttable
command. The only drawback is that it doesn't work withbooktabs
-style rules. Perhaps one could hack the command though.