Next: @definfoenclose
, Previous: Macro Details, Up: Defining New Texinfo Commands [Contents][Index]
The ‘@alias’ command defines a new command to be just like an existing one. This is useful for defining additional markup names, thus preserving additional semantic information in the input even though the output result may be the same.
Write the ‘@alias’ command on a line by itself, followed by the new command name, an equals sign, and the existing command name. Whitespace around the equals sign is optional and ignored if present. Thus:
@alias new = existing
For example, if your document contains citations for both books and
some other media (movies, for example), you might like to define a
macro @moviecite{}
that does the same thing as an ordinary
@cite{}
but conveys the extra semantic information as well.
You’d do this as follows:
@alias moviecite = cite
Macros do not always have the same effect as aliases, due to vagaries of argument parsing. Also, aliases are much simpler to define than macros. So the command is not redundant.
Unfortunately, it’s not possible to alias Texinfo environments; for
example, @alias lang=example
is an error.
Aliases must not be recursive, directly or indirectly.
It is not advisable to redefine any TeX primitive, plain TeX, or Texinfo command name as an alias. Unfortunately this is a very large set of names, and the possible resulting errors from TeX are unpredictable.
makeinfo
will accept the same identifiers for aliases as it
does for macro names, that is, alphanumerics and (except as the first
character) ‘-’.
Next: @definfoenclose
, Previous: Macro Details, Up: Defining New Texinfo Commands [Contents][Index]