Go to the first, previous, next, last section, table of contents.

Customized Highlighting

You can use regular TeX commands inside of @iftex ... @end iftex to create your own customized highlighting commands for Texinfo. The easiest way to do this is to equate your customized commands with pre-existing commands, such as those for italics. Such new commands work only with TeX.

You can use the @definfoenclose command inside of @ifinfo ... @end ifinfo to define commands for Info with the same names as new commands for TeX. @definfoenclose creates new commands for Info that mark text by enclosing it in strings that precede and follow the text. (7)

Here is how to create a new @-command called @phoo that causes TeX to typeset its argument in italics and causes Info to display the argument between `//' and `\\'.

For TeX, write the following to equate the @phoo command with the existing @i italics command:

@iftex
@global@let@phoo=@i
@end iftex

This defines @phoo as a command that causes TeX to typeset the argument to @phoo in italics. @global@let tells TeX to equate the next argument with the argument that follows the equals sign.

For Info, write the following to tell the Info formatters to enclose the argument between `//' and `\\':

@ifinfo
@definfoenclose phoo, //, \\
@end ifinfo

Write the @definfoenclose command on a line and follow it with three arguments separated by commas (commas are used as separators in an @node line in the same way).

The latter two arguments enclose the highlighted text in the Info file. A delimiter string may contain spaces. Neither the start nor end delimiter is required. However, if you do not provide a start delimiter, you must follow the command name with two commas in a row; otherwise, the Info formatting commands will misinterpret the end delimiter string as a start delimiter string.

After you have defined @phoo both for TeX and for Info, you can then write @phoo{bar} to see `//bar\\' in Info and see bar in italics in printed output.

Note that each definition applies to its own formatter: one for TeX, the other for Info.

Here is another example:

@ifinfo
@definfoenclose headword, , :
@end ifinfo
@iftex
@global@let@headword=@b
@end iftex

This defines @headword as an Info formatting command that inserts nothing before and a colon after the argument and as a TeX formatting command to typeset its argument in bold.


Go to the first, previous, next, last section, table of contents.