[texhax] tabularx inside a newenvironment with hline

Scott Hyde hydes at byuh.edu
Sun Jul 5 00:37:13 CEST 2009

I'd like to make a custom environment that will replicate the following code
without the \hline and the tabularx

   last line \\ \hline

Suppose the environment is called testbox.  Then the code above could be
written as:


This is what I've come up with for the newenvironment code:
\newenvironment{testbox}[1][rX]{\tabularx{\columnwidth}{|#1|} \hline}{
\hline \endtabularx }

However, the \hline in the end declaration causes a "misplace noalign"
error.  If the \hline is removed the end definition, the code compiles with
no errors (except no bottom line).

Here is the smallest code that I can give that causes the error:


  \tabularx{\columnwidth}{|#1|} \hline}{ \hline \endtabularx }

  3 & c \\
  4 & c \\

Can you help me?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20090704/600ad178/attachment.html>

More information about the texhax mailing list