groff: Comments
5.5.3.1 Comments
................
Probably one of the most(1) (⇒Comments-Footnote-1) common forms
of escapes is the comment.
-- Escape: \"
Start a comment. Everything to the end of the input line is
ignored.
This may sound simple, but it can be tricky to keep the comments
from interfering with the appearance of the final output.
If the escape is to the right of some text or a request, that
portion of the line is ignored, but the space leading up to it is
noticed by 'gtroff'. This only affects the 'ds' and 'as' request
and its variants.
One possibly irritating idiosyncracy is that tabs must not be used
to line up comments. Tabs are not treated as whitespace between
the request and macro 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
produces
Test
Test
To avoid this, it is common to start the line with '.\"', which
causes the line to be treated as an undefined request and thus
ignored completely.
Another commenting scheme seen sometimes is three consecutive
single quotes (''''') at the beginning of a line. This works, but
'gtroff' gives a warning about an undefined macro (namely ''''),
which is harmless, but irritating.
-- Escape: \#
To avoid all this, 'gtroff' has a new comment mechanism using the
'\#' escape. This escape works the same as '\"' except that the
newline is also ignored:
Test
\# comment
Test
produces
Test Test
as expected.
-- Request: .ig [end]
Ignore all input until 'gtroff' encounters the macro named '.'END
on a line by itself (or '..' if END is not specified). This is
useful for commenting out large blocks of text:
text text text...
.ig
This is part of a large block
of text that has been
temporarily(?) commented out.
We can restore it simply by removing
the .ig request and the ".." at the
end of the block.
..
More text text text...
produces
text text text... More text text text...
Note that the commented-out block of text does not cause a break.
The input is read in copy-mode; auto-incremented registers _are_
affected (⇒Auto-increment).