16.6 @definfoenclose: Customized Highlighting

An @definfoenclose command may be used to define a highlighting command for online 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 and HTML formatting command that inserts ‘//’ before and ‘\\’ after the argument to @phoo. You can then write @phoo{bar} wherever you want ‘//bar\\’ highlighted in Info and HTML.

For TeX formatting, you could write

@iftex
@alias 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 online formats. The TeX definitions need to be in ‘@iftex’. @definfoenclose command need not be within ‘@ifinfo’ unless you want to use different definitions for different online output formats. @definfoenclose defined commands have no effect in DocBook and LaTeX output, their argument is output as-is. An @alias could also be used for these formats.

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