manpagez: man pages & more
info texinfo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

18.6 Testing for Texinfo Commands: @ifcommanddefined, @ifcommandnotdefined

Occasionally, you may want to arrange for your manual to test if a given Texinfo command is available and (presumably) do some sort of fallback formatting if not. There are conditionals @ifcommanddefined and @ifcommandnotdefined to do this. For example:

@ifcommanddefined node
Good, @samp{@@node} is defined.
@end ifcommanddefined

will output the expected ‘Good, ‘@node’ is defined.’.

This conditional will also consider true any new commands defined by the document via @macro, @alias, @definfoenclose, and @def(code)index (see section Defining New Texinfo Commands). Caveat: the TeX implementation reports internal TeX commands, in addition to all the Texinfo commands, as being “defined”; the makeinfo implementation is reliable in this regard, however.

You can check the ‘NEWS’ file in the Texinfo source distribution and linked from the Texinfo home page ( to see when a particular command was added.

These command-checking conditionals themselves were added in Texinfo 5.0, released in 2013—decades after Texinfo’s inception. In order to test if they themselves are available, the predefined flag txicommandconditionals can be tested, like this:

@ifset txicommandconditionals
@ifcommandnotdefined foobarnode
(Good, ‘@foobarnode’ is not defined.)
@end ifcommandnotdefined
@end ifset

Since flags (see the previous section) were added early in the existence of Texinfo, there is no problem with assuming they are available.

We recommend avoiding these tests whenever possible—which is usually the case. For many software packages, it is reasonable for all developers to have a given version of Texinfo (or newer) installed, and thus no reason to worry about older versions. (It is straightforward for anyone to download and install the Texinfo source; it does not have any problematic dependencies.)

The issue of Texinfo versions does not generally arise for end-users. With properly distributed packages, users need not process the Texinfo manual simply to build and install the package; they can use preformatted Info (or other) output files. This is desirable in general, to avoid unnecessary dependencies between packages (see Releases in GNU Coding Standards).

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on October 2, 2013 using texi2html 5.0.

© 2000-2021
Individual documents may contain additional copyright information.