I'm trying to wrap long tabularx tables from ltablex into a new environment (which would do more stuff, but not in the mwe below). However, this gives me an error
\begin{wraptable} on input line 15 ended by \end{tabularx}.
MWE:
\documentclass{article}
\usepackage{xparse}
\usepackage{ltablex}
\NewDocumentEnvironment{wraptable}{}{\tabularx{\linewidth}{XX}}{\endtabularx}
\begin{document}
\begin{wraptable}
foo & bar\\
\end{wraptable}
\end{document}
The question new table environment based on ltablex's tabularx deals with the case of \newenvironment using the environ package. How do I work around this error for \NewDocumentEnvironment?
\end{tabularx}in the definition of\TX@endtabularxwith\endtabularx\endgroup, but I don't know whether this has side effects. – egreg Jul 26 '18 at 09:42