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

Philip Taylor P.Taylor at Rhul.Ac.Uk
Sat Dec 19 12:27:05 CET 2015


Shouldn't \undefined be \relax, Adrian ?  \csname ...\endcsname sets its
expansion to \relax if the resulting csname was previously undefined.

** Phil.
--------
Adrian F. Clark wrote:
> Hello,
> 
> I'm trying to do something literate with listings.sty.  I'm using
> \lstnewenvironment to define a new environment which receives a name as
> an argument, which is passed on via "\lstset{name=}".  I would like to
> do something slightly different in a continued listing of the name and
> the first time it appears.  I have tried things along the lines of
> 
> \expandafter
> \ifx
>   \csname \@lst @SaveFirstNumber\endcsname
>   \undefined
>   it's a new listing
> \else
>   it's a continued listing
> \fi
> 
> but none of my attempts have worked.  Can anyone point me in the right
> direction?  I've attached a minimal example.
> 
> ..Adrian


More information about the texhax mailing list