When I use NewDocumentEnvironment of xparse and place a table to be inside this environment, I get an extra row at the end. Same code does not cause extra row in standard newenvironment. Is there a solution to this problem? I have tried using \ignorespaces and made entire thing single line without spaces, still the same result. I have compiled a MWE below:
\documentclass{article}
\usepackage{xparse}
\NewDocumentEnvironment{test}{}{%
\begin{tabular}{|l|l|l|}\hline%
A & B & C \\\hline%
}{%
\end{tabular}%
}
\newenvironment{testtwo}{%
\begin{tabular}{|l|l|l|}\hline%
A & B & C \\\hline%
}{%
\end{tabular}%
}
\begin{document}
\begin{test}
This & does not & work\\\hline
\end{test}
~\\~\\
\begin{testtwo}
This & does & work\\\hline
\end{testtwo}
\end{document}
Result:

\NewDocumentEnvironment. Is there a way around it? – Cem Kalyoncu Jan 06 '16 at 08:48