0

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."

5

0

You must log in to answer this question.

Browse other questions tagged .