-
The most general method is to include the following 3 comment
lines at the end of the file.
Comment] Local Variables:
Comment] mode: nroff
Comment] End:
-
There is a set of file name extensions, e.g. the man pages that
trigger the automatic activation of the nroff mode.
-
Theoretically, it is possible to write the sequence
Comment] -*- nroff -*-
as the first line of a file to have it started in nroff mode
when loaded. Unfortunately, some applications such as the
man program are confused by this; so this is
deprecated. All roff formatters provide automated line breaks
and horizontal and vertical spacing. In order to not disturb
this, the following tips can be helpful.
-
Never include empty or blank lines in a roff document. Instead,
use the empty request (a line consisting of a dot only) or a
line comment Comment] if a structuring element
is needed.
-
Never start a line with whitespace because this can lead to
unexpected behavior. Indented paragraphs can be constructed in
a controlled way by roff requests.
-
Start each sentence on a line of its own, for the spacing after
a dot is handled differently depending on whether it terminates
an abbreviation or a sentence. To distinguish both cases, do a
line break after each sentence.
-
To additionally use the auto-fill mode in Emacs, it is best to
insert an empty roff request (a line consisting of a dot only)
after each sentence. The following example shows how optimal
roff editing could look.
-
This is an example for a roff document.
This is the next sentence in the same paragraph.
This is a longer sentence stretching over several
lines; abbreviations like `cf.' are easily
identified because the dot is not followed by a
line break.
In the output, this will still go to the same
paragraph.
Besides Emacs, some other editors provide nroff style files too,
e.g.
vim(1), an extension of the vi(1)
program.