The following example gives:
! Package array Error: Illegal pream-token (\AtEndOfPackage): `c' used.
What is wrong?
\documentclass{article}
\usepackage{tabularx}
\newenvironment{mytab}{
\begin{tabularx}{5cm}{l}
}{
\end{tabularx}
}
\begin{document}
\begin{mytab}
foo \\
bar
\end{mytab}
\end{document}
\tabularxinstead of\begin{tabularx}and\endtabularxinstead of\end{tabularx}? – Qrrbrbirlbel Oct 17 '13 at 17:59tabularxinside a\newenvironment– Werner Oct 17 '13 at 18:02\tabularxand\endtabularxit works. – feklee Oct 17 '13 at 18:07%at the ends of lines{mytab}{%%%and\end{tabularx}%%%%otherwise you will get extra white space around the table. As documented in the package documentation this is same as AMSalignetc the environment needs to look ahead and grab the whole environment, so the end code can not be hidden in a macro. – David Carlisle Oct 17 '13 at 18:10}{%is enough to get rid of extra white space. – feklee Oct 17 '13 at 18:22\endtabularxthen white space is ignored after a command name – David Carlisle Oct 17 '13 at 18:49