[texhax] Trying to find if a listing is continued with listings package

Philip Taylor P.Taylor at Rhul.Ac.Uk
Sun Dec 20 10:50:10 CET 2015

Reinhard Kotucha wrote:

> Adrian is using listings.sty, hence I assume that he's using LaTeX.
> LaTeX users should better use \@ifundefined instead of TeX primitives
> or plain TeX macros.

Adrian may well be using "listings.sty", but there is very little
LaTeX-ish about his code :

> \expandafter
> \ifx
>   \csname \@lst @SaveFirstNumber\endcsname
>   \undefined
>   it's a new listing
> \else
>   it's a continued listing
> \fi 

so suggesting the use of \relax in this context would seem quite
reasonable to me ...  And does \@undefined map to \relax in such a
context, as it would need to if his test were to perform as intended ?

** Phil.

More information about the texhax mailing list