[texhax] Trying to find if a listing is continued with listings package
Philip Taylor
P.Taylor at Rhul.Ac.Uk
Tue Dec 22 09:27:31 CET 2015
P.S. I think the following demonstrates why \@undefined is markedly
inferior to \ifcsname :
> \documentclass {minimal}
> \catcode `\@ = \catcode `\a
> \begin {document}
> \ifcsname 42\endcsname \message {42: Known csname}\else \message {42: UNKnown csname}\fi
> \message {; }
> \@ifundefined {42}{\message {42: UNdefined}}{\message {42: defined}}
> \message {; }
> \ifcsname 42\endcsname \message {42: Known csname}\else \message {42: UNKnown csname}\fi
> \message {.}
> \end {document}
This outputs
42: UNKnown csname;
42: UNdefined;
42: Known csname.
whereas the following (using \ifcsname)
> \documentclass {minimal}
> \catcode `\@ = \catcode `\a
> \begin {document}
> \ifcsname 42\endcsname \message {42: Known csname}\else \message {42: UNKnown csname}\fi
> \message {; }
> \unless \ifcsname 42\endcsname \message {42: UNdefined}\else \message {42: defined}\fi
> \message {; }
> \ifcsname 42\endcsname \message {42: Known csname}\else \message {42: UNKnown csname}\fi
> \message {.}
> \end {document}
outputs
> 42: UNKnown csname;
> 42: UNdefined;
> 42: UNKnown csname.
Thus \@undefined causes something that was previously undefined to
become defined; \ifcsname does not.
** Phil.
More information about the texhax
mailing list