Set a leading spaces trap.
gtroffexecutes macro when it encounters leading spaces in an input line; the implicit line break which normally happens in this case is suppressed. A line consisting of spaces only, however, is treated as an empty line, possibly subject to an empty line macro set with theblmrequest.Leading spaces are removed from the input line before calling the leading spaces macro. The number of removed spaces is stored in register
lsn; the horizontal space which would be emitted if there was no leading space macro is stored in registerlss. Note thatlsnandlssare available even if no leading space macro has been set.The first thing a leading space macro sees is a token. However, some escapes like
\for\mare handled on the fly (see Gtroff Internals, for a complete list) without creating a token at all. Consider that a line starts with two spaces followed by\fIfoo. While skipping the spaces\fIis handled too so that groff's current font is properly set to ‘I’, but the leading space macro only seesfoo, without the preceding\fI. If the macro should see the font escape you have to `protect' it with something which creates a token, for example with\&\fIfoo.