I would like to include a multicolumn-row in a tabular environment if \lehrertrue
. Otherwise nothing should happen. I tried newcommand
, newenvironment
and NewEnviron
and always end up with a "misplaced \omit
". Apparently I am unable to convince \multicolumn
that it is starting a new row.
My last try:
\documentclass[a4paper]{article}
\usepackage{environ}
\usepackage{t1enc}
\usepackage[cp437de]{inputenc}
\newif\iflehrer
\lehrertrue
\NewEnviron{lehrer}{\iflehrer{\multicolumn{5}{l}{\parbox{17cm}{\BODY}}}{{}}/fi}
\begin{document}
\begin{tabular}{rlccl}
1 & 2 & 3 & 4 & 5 \\
\begin{lehrer}
just a test\\
\end{lehrer}
1 & 2 & 3 & 4 & 5
\end{tabular}
\end{document}
Any helpful suggestions please?
P.S. I was unable to include something like "misplaced \omit
" tag.
P.P.S. So far I have also been unable to find out whether nicematrix
could solve the problem. "! LaTeX Error: Command \iint
already defined. Or name \end... illegal, see p.192 of the manual."
\begingroup
and this stops the lookup for\omit
, so\multicolumn
appears when the table cell has already started.nicematrix
, your remark is rather strange because\nicematrix
does not define any command\iint
...