[texhax] tabularx inside a newenvironment with hline

Ulrike Fischer news3 at nililand.de
Tue Jul 7 11:11:40 CEST 2009


Am Sat, 4 Jul 2009 12:37:13 -1000 schrieb Scott Hyde:

> I'd like to make a custom environment that will replicate the following code
> without the \hline and the tabularx
> 
> \begin{tabularx}{|rX|}
>   \hline
>    stuff...
>    last line \\ \hline
> \end{tabularx}
> 
> Suppose the environment is called testbox.  Then the code above could be
> written as:
> 
> \begin{testbox}
>   stuff...
> \end{testbox}
> 
> 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. 

> Can you help me?

It won't work. The documentation says explicitly that \endtabularx
must be the first token in the end code. 

-- 
Ulrike Fischer 



More information about the texhax mailing list