[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

@ifcommanddefined, etc.

From: Karl Berry
Subject: @ifcommanddefined, etc.
Date: Tue, 3 Jul 2012 23:36:08 GMT

Patrice and all,

We talked about giving documents a way to test if a given Texinfo
command was defined, so they could provide replacements for newer
commands.  (Which, for the record, I'm still unconvinced is worthwhile,
but never mind.)

So what I think I've implemented in texinfo.tex are two new
@ifcommanddefined CMDNAME
@end ifcommanddefined

and the `not' form,
@ifcommandnotdefined CMDNAME
@end ifcommandnotdefined

In both cases, the CMDNAME is written without the @.  (Much safer in TeX.)

Finally, the variable `txicommandconditionals' is now implicitly
defined, so the documents can know whether this feature is itself

Before I write the documentation ... does this look like the right
interface to you?  Any ideas/suggestions/whatever?  Below is a test

Again for the record ... the last case below (the spurious mathcode)
shows that the texinfo.tex is actually testing whether the TeX control
sequence is defined, and TeX + plain TeX + texinfo.tex define hundreds
of control sequences that are not Texinfo commands.  It's theoretically
wrong, but since the problem has existed since day one (of @macro, at
least) and no one has ever reported a bug against it, I don't plan to
worry about it now.  It would be a great deal of laborious work to
rectify it, and I don't want to take the time.


\input texinfo
@setfilename cmddef.info

@ifset txicommandconditionals
Good, the txicommandconditionals variable was set.
@end ifset

@ifcommanddefined nodexyz
Bad, @@nodexyz is defined.
@end ifcommanddefined
@ifcommandnotdefined nodexyz
Good, @@nodexyz is not defined.
@end ifcommandnotdefined

@ifcommanddefined node
Good, @@node is defined.
@end ifcommanddefined
@ifcommandnotdefined node
Bad, @@node is not defined.
@end ifcommandnotdefined

@ifcommanddefined mathcode
Unfortunately, @@mathcode is defined.
@end ifcommanddefined
@ifcommandnotdefined mathcode
Happily, @@mathcode is not defined.
@end ifcommandnotdefined


reply via email to

[Prev in Thread] Current Thread [Next in Thread]