5.7 Comments

One of the most common forms of escape sequence is the comment.48

Escape sequence: \"

Start a comment. Everything up to the next newline is ignored.

This may sound simple, but it can be tricky to keep the comments from interfering with the appearance of the output. If the escape sequence is to the right of some text or a request, that portion of the line is ignored, but spaces preceding it are processed normally by GNU troff. This affects only the ds and as requests and their variants.

One possibly irritating idiosyncrasy is that tabs should not be used to vertically align comments in the source document. Tab characters are not treated as separators between a request name and its first argument, nor between arguments.

A comment on a line by itself is treated as a blank line, because after eliminating the comment, that is all that remains.

Test
\" comment
Test
    ⇒ Test
    ⇒
    ⇒ Test

To avoid this, it is common to combine the empty request with the comment escape sequence as ‘.\"’, causing the input line to be ignored.

Another commenting scheme sometimes seen is three consecutive single quotes (''') at the beginning of a line. This works, but GNU troff emits a warning diagnostic (if enabled) about an undefined macro (namely ‘''’).

Escape sequence: \#

Start a comment; everything up to and including the next newline is ignored. This groff extension was introduced to avoid the problems described above.

Test
\# comment
Test
    ⇒ Test Test
Request: .ig [end]

Ignore input until, in the current conditional block (if any),49 the macro end is called at the start of a control line, or the control line ‘..’ is encountered if end is not specified. ig is parsed as if it were a macro definition, but its contents are discarded, not stored.50

hand\c
.de TX
fasting
..
.ig TX
This is part of a large block of input that has been
temporarily(?) commented out.
We can restore it simply by removing the .ig request and
the call of its end macro.
.TX
    ⇒ handfasting