16.7 External Macro Processors: Line Directives

Texinfo macros (and its other text substitution facilities) work fine in straightforward cases. If your document needs unusually complex processing, however, their fragility and limitations can be a problem. In this case, you may want to use a different macro processor altogether, such as M4 (see M4) or CPP (see The C Preprocessor).

With one exception, Texinfo does not need to know whether its input is “original” source or preprocessed from some other source file. Therefore, you can arrange your build system to invoke whatever programs you like to handle macro expansion or other preprocessing needs. Texinfo does not offer built-in support for any particular preprocessor, since no one program seemed likely to suffice for the requirements of all documents.

The one exception is line numbers in error messages. In that case, the line number should refer to the original source file, whatever it may be. There’s a well-known mechanism for this: the so-called ‘#line’ directive. Texinfo supports this.