I am building a table from several components that I automatically export from STATA. For this, I use \input{}
to input the components inside a table and tabular environment. This usually works well, but I now want to input a line that contains a \multicolumn
. This generates the LaTeX error !Misplaced \omit. \multispan ->\omit.
In addition, the line that I input starts further to the right of the table and not all the way to the left as it should.
Here is a minimal example of the code:
\documentclass[11pt,oneside]{amsart}
\usepackage{booktabs,multirow}
\usepackage{tabularx}
\begin{document}
\begin{table}
\caption{Table 1}
\begin{tabular}{llcc}
\toprule
\input{no_degree}
\midrule
\multicolumn{4}{l}{Vocational training}\\
& No training & 400 & 35 \\
\midrule
\end{tabular}
\end{table}
\end{document}
The table to input, no_degree has the following code:
\multicolumn{2}{l}{\textbf{No info on secondary degree}} & 214 & 20 \\
Running this generates the error. However, when I just copy and paste exactly the content of the inputted file, the code runs smoothly. This code is the following:
\documentclass[11pt,oneside]{amsart}
\usepackage{booktabs,multirow}
\usepackage{tabularx}
\begin{document}
\begin{table}
\caption{Table 1}
\begin{tabular}{llcc}
\toprule
\multicolumn{2}{l}{\textbf{No info on secondary degree}}&214& 20 \\
\midrule
\multicolumn{4}{l}{Vocational training}\\
& No training & 400 & 35 \\
\midrule
\end{tabular}
\end{table}
\end{document}
Thanks a lot!
\csname @@input\endcsname no_degree
– David Carlisle May 18 '18 at 15:10\end{table}
– Zarko May 18 '18 at 15:28\csname
works! Thank you! I forgot\end{table}
, but had it when I ran the code and it still gave me errors. I added\end{table}
in the example. – ZoeFrance May 18 '18 at 16:55\input{}
– David Carlisle May 18 '18 at 18:14