LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Subject:
From:
"Julien RIVAUD (_FrnchFrgg_)" <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Mon, 4 Apr 2016 19:15:48 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (88 lines)
Le 04/04/2016 18:54, Frank Mittelbach a écrit :
> 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}%
> }

Sure, but even if \newenvironment had the bug, I would have considered
it a problem in xparse.

>
> 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.

And in fact it hides any \crcr we could put in our closing code... I
thought that it had to do with protection (this mail is a spin-off from
a P.S. in the other thread), because I had to unprotect some of my
commands in my table stuff.

BTW, I wrote a package that parse CSS-like syntax to define properties
of table cells, like real padding or min-width/height/depth (it also
fixes the vertical alignment problem by taking the *real* height of the
first row or the *real* depth of the last row into account, not just the
strut box). It uses mdwtab as a base. For now it computes each cell
#row-#col values, but doesn't support :nth-child() selectors (or any
other selector than "td") so it is unfinished. Quite useful as a
replacement for extrarowheight and/or vgap to get better table output
(and I just found that it also affects amsmath's |cases|, so the parent
selector needs to be handled soon).

I really need to learn to write proper .dtx files, and submit my stuff
on CTAN.

Cheers,

Julien

ATOM RSS1 RSS2