Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Real bug in e-TeX ?

7 views
Skip to first unread message

GL

unread,
Jan 28, 2011, 9:47:47 AM1/28/11
to
Hello:


\def\macro{\ifincsname relax\else Hello\fi}
\def\MACRO{\csname macro\endcsname}

\csname\macro\endcsname
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
{\csname}

\macro ->\ifincsname relax\else Hello\fi
{\ifincsname: (level 1) entered on line 34}
{true} < -------------------- O.K.
{\else: \ifincsname (level 1) entered on line 34}
{\fi: \ifincsname (level 1) entered on line 34}
{\relax} < -------------------- O.K.
{\par}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\csname\MACRO\endcsname
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
{\csname}

\MACRO ->\csname macro\endcsname
{\csname}

\macro ->\ifincsname relax\else Hello\fi
{\ifincsname: (level 1) entered on line 37}
{false} < --------- Feature or bug ???
{\else: \ifincsname (level 1) entered on line 37}
{\fi: \ifincsname (level 1) entered on line 37}
{changing \Hello=undefined}
{into \Hello=\relax} < ------------------- ??
{\relax}
{\par}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thanks.
(I'm embarrassed by this behaviour ...)

GL

unread,
Jan 28, 2011, 9:54:22 AM1/28/11
to
Le 28/01/2011 15:47, GL a �crit :

I check the eTeX manual, and \ifincsname is provided by XeTeX and pdfTeX...


\def\macro{\ifincsname relax\else Hello\fi}
\def\MACRO{\csname macro\endcsname}

\def\MaCrO{\macro}


\csname\macro\endcsname -> \relax
\csname\MaCrO\endcsname -> \Hello
\csname\MACRO\endcsname -> \Hello

???

Yours sincerely.

GL

unread,
Jan 28, 2011, 10:03:13 AM1/28/11
to

This appears to be a real bug in \ifincsname:

\def\macro{\ifincsname relax\else Hello\fi}

since :

\def\MaCrO{\ifincsname\macro\else\macro\fi}%
\def\MACRO{\%
ifincsname \csname macro\endcsname
\else \csname macro\endcsname\fi
}%

behave differently: \MaCrO has the expected behaviour:

{\csname}

\MaCrO ->\ifincsname \macro \else \macro \fi
{\ifincsname: (level 1) entered on line 38}
{true} <------------ O.K.

\macro ->\ifincsname relax\else Hello\fi

{\ifincsname: (level 2) entered on line 38}
{true} < ---------- O.K.
{\else: \ifincsname (level 2) entered on line 38}
{\fi: \ifincsname (level 2) entered on line 38}
{\else: \ifincsname (level 1) entered on line 38}
{\fi: \ifincsname (level 1) entered on line 38}
{\relax}
{\par}

while \MACRO finally expands \csname Hello\endcsname.

This gives a turn around, not difficult to write:
\ifincsname\macro\else\macro\fi
works ! ;-)

zappathustra

unread,
Jan 28, 2011, 10:05:41 AM1/28/11
to
Le 28/01/2011 16:03, GL a �crit :

The bug had been spotted this summer on the XeTeX list, and Will
Robertson reported it on the pdfTeX list, but I don't know if any
correction was made.

Best,
Paul

zappathustra

unread,
Jan 28, 2011, 10:08:27 AM1/28/11
to
Le 28/01/2011 16:05, zappathustra a écrit :

Correction: it was fixed in December (see pdfTeX's svn), and I suppose
it'll be included in TL2011 and the next MikTeX.

Best,
Paul

GL

unread,
Jan 28, 2011, 10:23:59 AM1/28/11
to
Le 28/01/2011 16:08, zappathustra a �crit :
> Le 28/01/2011 16:05, zappathustra a �crit :
>> Le 28/01/2011 16:03, GL a �crit :

>
> Correction: it was fixed in December (see pdfTeX's svn), and I suppose
> it'll be included in TL2011 and the next MikTeX.

Yes thanks !

\def\macro{\ifincsname relax\else Hello\fi}

\def\MaCrO{\expandafter\@firstofone\csname macro\endcsname}

Does not work either: it appears that \ifincsname is redefined
each time it sees a \csname, while the switch should be global,
set to true while entering the first \csname until the matching
\endcsname...

Anyway, i'm getting on with \ifincsname\macro\else\macro\fi !
Just this is a bit silly ;-)

Thanks again.
>
> Best,
> Paul

David Kastrup

unread,
Jan 28, 2011, 10:31:50 AM1/28/11
to
GL <goua...@gmail.com> writes:

> Le 28/01/2011 16:08, zappathustra a écrit :
>> Le 28/01/2011 16:05, zappathustra a écrit :


>>> Le 28/01/2011 16:03, GL a écrit :
>>
>> Correction: it was fixed in December (see pdfTeX's svn), and I suppose
>> it'll be included in TL2011 and the next MikTeX.
>
> Yes thanks !
>
> \def\macro{\ifincsname relax\else Hello\fi}
> \def\MaCrO{\expandafter\@firstofone\csname macro\endcsname}
>
> Does not work either: it appears that \ifincsname is redefined
> each time it sees a \csname, while the switch should be global,
> set to true while entering the first \csname until the matching
> \endcsname...

Do you think it should be true in

\csname\number\ifincsname

I am not all too convinced of that. I am not all too convinced there is
a good consistent definition and behavior, either...

--
David Kastrup
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>

GL

unread,
Jan 28, 2011, 10:45:10 AM1/28/11
to

My position is: TeX makes things in a sequence, one after another. Thus,
at any point of the compilation, you can say if you are building a cs
name of not, \ie if you are in a \csname ... \endcsname "group".

\csname \number\ifincsname is true, otherwise what whould be the meaning
of \ifincsname ???

GL

unread,
Jan 30, 2011, 7:34:05 AM1/30/11
to
Le 28/01/2011 16:31, David Kastrup a �crit :

> GL<goua...@gmail.com> writes:
>
> Do you think it should be true in
>
> \csname\number\ifincsname
>
> I am not all too convinced of that. I am not all too convinced there is
> a good consistent definition and behavior, either...

And I have another example of absolutely no interest:

\ifcsname \ifincsname relax\else @undefined\fi\endcsname
ifincsname returned true
\else
ifincsname returned false
\fi

=> returned false, which is normal...

Regards.


0 new messages