LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Date: Mon, 4 Apr 2016 18:54:27 +0200
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Message-ID: <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]>
Content-Type: text/plain; charset=utf-8; format=flowed
From: Frank Mittelbach <[log in to unmask]>
Parts/Attachments: text/plain (65 lines)
guess this is a case of \protected being harmful

Am 04.04.2016 um 18:16 schrieb Julien RIVAUD (_FrnchFrgg_):

> \NewDocumentEnvironment{foo}{m}{%
>      \begin{tabular}{#1}%
> }{%
>      \end{tabular}%
> }
>
> \begin{document}
>
> \fbox{
>      \begin{foo}{ccc}
>          \hline
>          Test & a & b \\
>          \hline
>      \end{foo}
> }
>
> \fbox{
>      \begin{tabular}{ccc}
>          \hline
>          Test & a & b \\
>          \hline
>      \end{tabular}
> }
>
> \end{document}
>
> The first and second \fbox-es should produce the same output, but don't:
> the foo environment starts a second line at closing time, before the
> control is passed to the author-supplied closing code.

actually that's not equiv, equiv would be something like defining "baz"

\newenvironment{baz}[1]{%
     \begin{tabular}{#1}%
}{%
     \end{tabular}%
}

but yes, same difference

reason is the following difference in processing:

\show\endfoo
\show\endbaz

 > \endfoo=\protected macro:
->\environment foo end aux .
l.10 \show\endfoo

?
 > \endbaz=\long macro:
->\end {tabular}.
l.17 \show\endbaz

the  \protected hides the \crcr inside \endtabular.

Now it may be that the protected is needed for other reasons (hope not) 
but perhaps it is just overprotection .. let Joseph say :-)

frank

ATOM RSS1 RSS2