0

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?

ronno
  • 1,325
  • The work around is the same, use environ, because the problem is still the same, tabularx's behaviour… – TeXnician Jul 26 '18 at 05:56
  • The error vanishes if I change \end{tabularx} in the definition of \TX@endtabularx with \endtabularx\endgroup, but I don't know whether this has side effects. – egreg Jul 26 '18 at 09:42
  • @TeXnician Do you mean something like https://tex.stackexchange.com/questions/172398/collecting-environment-content-with-support-for-xparse-arguments? – ronno Jul 26 '18 at 15:04

0 Answers0