0

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}
  • Does it work with \tabularx instead of \begin{tabularx} and \endtabularx instead of \end{tabularx}? – Qrrbrbirlbel Oct 17 '13 at 17:59
  • Possible duplicate: tabularx inside a \newenvironment – Werner Oct 17 '13 at 18:02
  • I've seen the other question. However, the error message is different, and also I would like to understand the why. – feklee Oct 17 '13 at 18:06
  • With \tabularx and \endtabularx it works. – feklee Oct 17 '13 at 18:07
  • 1
    as written there would be a space after the table as well, but if you have already changed to \endtabularx then white space is ignored after a command name – David Carlisle Oct 17 '13 at 18:49

Browse other questions tagged or ask your own question.