My question concerns the combination of the tabular environment and the \DeclareDocumentEnvironment
command (from the xparse package).
How do I set up an environment that contains in its code some of the operators of the tabular environment, such as &
or \\
?
Here is my minimal (not) working example of what I thought I could do, but I get an error :
\documentclass{article}
\usepackage{xparse,booktabs}
\DeclareDocumentEnvironment{env}{mm}{\toprule #1 & #2 &}{\\ \bottomrule}
\begin{document}
\begin{tabular}{lll}
\begin{env}{one}{two}
three
\end{env}
\end{tabular}
\end{document}
Any idea of what I could do to have this environment working Inside the tabular environment?
Thank you in advance,
Pierric
\begin{env}
expands to\env
which is\protected
, so expansion ends here as far as\halign
is concerned for finding\noalign
, so\toprule
shows up too late, when a cell has already been started.