I am having difficulties with what I assume to be a simple issue. I'm in the process of learning LaTeX, and currently having STATA output most of my LaTeX code, which I then insert into TeXworks in order to generate PDFs.
Whenever I try to output this specific code, I receive the error:
"File ended while scanning use of \multicolumn."
Here is the code I am using:
\documentclass{article}
\begin{document}
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Closing Date Effects}
\begin{tabular}{l*{1}{cc}}
\hline\hline
&\multicolumn{2}{c}{(1)} \\
&\multicolumn{2}{c}{Voter Turnout (%)}\\
\hline
Registration Closing Date& -0.226\sym{**} & (0.001)\\
Southern State & -8.900 & (0.142)\\
Close x South (Interaction)& 0.0928 & (0.674)\\
Constant & 77.20\sym{***}& (0.000)\\
\hline
Observations & 51 & \\
\hline\hline
\multicolumn{3}{l}{\footnotesize \textit{p}-values in parentheses}\\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \ (p<0.001\)}\\
\end{tabular}
\end{table}
\end{document}
My best guess has been that I'm missing some braces in the \multicolumn
sections, but I can't find where. I thought perhaps on the last line:
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \ (p<0.001\)}\\
But no matter the number of braces I use, it still errors out.
Best Answer
There errors were:
%
,\\\
instead of\\
at the end of some lines, and a single\
one on the last line.\textit{}
you should be using$p$
asp
is math variable.Note:
$...$
for math mode instead of the\(
and\)
. BUT, the latter is recommended as per Are \( and \) preferable to dollar signs for math mode?Code: