Next: , Previous: , Up: Defining New Texinfo Commands   [Contents][Index]


16.5 @definfoenclose: Customized Highlighting

An @definfoenclose command may be used to define a highlighting command for all the non-TeX output formats. A command defined using @definfoenclose marks text by enclosing it in strings that precede and follow the text.

In practice, there is little use for this command, and we do not recommend you use it. Support for @definfoenclose may be removed in future releases of Texinfo.

Write a @definfoenclose command at the beginning of a line followed by three comma-separated arguments. The first argument to @definfoenclose is the @-command name (without the @); the second argument is the start delimiter string; and the third argument is the end delimiter string. The latter two arguments enclose the highlighted text in the output.

A delimiter string may contain spaces. Neither the start nor end delimiter is required. If you do not want a start delimiter but do want an end delimiter, you must follow the command name with two commas in a row; otherwise, the end delimiter string you intended will naturally be (mis)interpreted as the start delimiter string.

An enclosure command defined this way takes one argument in braces, since it is intended for new markup commands (see Marking Text, Words and Phrases).

For example, you can write:

@definfoenclose phoo,//,\\

near the beginning of a Texinfo file to define @phoo as an Info formatting command that inserts ‘//’ before and ‘\\’ after the argument to @phoo. You can then write @phoo{bar} wherever you want ‘//bar\\’ highlighted in Info.

For TeX formatting, you could write

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

to define @phoo as a command that causes TeX to typeset the argument to @phoo in italics.

Each definition applies to its own formatter: one for TeX, the other for everything else. The raw TeX commands need to be in ‘@iftex’. @definfoenclose command need not be within ‘@ifinfo’ unless you want to use different definitions for different output formats.

Here is another example: write

@definfoenclose headword, , :

near the beginning of the file, to define @headword as an Info formatting command that inserts nothing before and a colon after the argument to @headword.

@definfoenclose’ definitions must not be recursive, directly or indirectly.


Next: External Macro Processors: Line Directives, Previous: @alias new=existing, Up: Defining New Texinfo Commands   [Contents][Index]