if I create a LaTeX-file like
--------8<---------------------------------------------
\documentclass{article}
\begin{document}
\begin{tabular}{cc}
\multicolumn{2}{c}{a}
\end{tabular}
\begin{tabular}{cc}
\input{mc}
\end{tabular}
\end{document}
--------8<---------------------------------------------
and a file mc.tex
--------8<---------------------------------------------
\multicolumn{2}{c}{a}
--------8<---------------------------------------------
the first tabular environment is formatted corrected, but the formatting
of the second tabular environment fails with an error message like
(./mc.tex
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.1 \multicolumn{2}{c}{a}
?
Is there someone who can explain the behaviour to me (btw. inputting
other things into tabular environment works fine) and give a hint to
avoid that error?
Thanks in advance!
Jobst
\multicolumn must be the very first thing in a cell. You can't put
commands like \input inbetween.
--
Ulrike Fischer
> > \begin{tabular}{cc}
> > \input{mc}
> > \end{tabular}
> > and a file mc.tex
> > --------8<---------------------------------------------
> > \multicolumn{2}{c}{a}
> > --------8<---------------------------------------------
> >
> > the first tabular environment is formatted corrected, but the formatting
> > of the second tabular environment fails with an error message like
> >
> > (./mc.tex
> > ! Misplaced \omit.
> > \multispan ->\omit
> > \@multispan
> > l.1 \multicolumn{2}{c}{a}
> >
> > ?
> >
> > Is there someone who can explain the behaviour to me (btw. inputting
> > other things into tabular environment works fine) and give a hint to
> > avoid that error?
>
> \multicolumn must be the very first thing in a cell. You can't put
> commands like \input inbetween.
Especially LaTeX's version of \input is not expandable and such
non-expandable stuff will be the first thing in the cell.
The original \input as TeX primitive is expandable. That can be used
(LaTeX stores it in \@@input). But the syntax is the syntax of the
original TeX primitive and it doesn't provide LaTeX's error handling
for non-existing files.
\begin{tabular}{cc}
\csname @@input\endcsname mc %
\end{tabular}
But I think, a better solution would be, if the \begin and \end stuff
is also put into the file mc.tex.
Yours sincerely
Heiko <ober...@uni-freiburg.de>
Thank you for your advices with \@@input, that's what I asked for. You
are right with the better solution but the original problem is much more
complicated and so this is not applicable.
Yours sincerely
Jobst