Marking up Text for troff and nroff
Except for a few conveniences thrown in, nroff mode is just like text mode. For the purposes of this discussion, there is no difference between nroff and its relatives troff and groff; the commands discussed here work for the entire troff family.
To enter nroff mode, type ESC x nroff-mode RETURN. Nroff
appears
on the mode line. The nroff mode provides four substantial features:
It redefines the meaning of a paragraph by changing the regular expression for the paragraph-separate variable. With this setting, the fill-paragraph command (ESC q) works correctly.
It provides some special commands for navigating in a troff document. Using these commands, you can move forward and backward, jumping over all troff commands.
A special “electric nroff mode” (a minor mode associated with nroff mode) automatically supplies matching pairs of certain formatting commands.
It provides some features for inserting comments.
Paragraph Formatting
We’ll take these features one at a time. First, paragraph separation: if you do a lot of text editing and get used to typing ESC q (for fill-paragraph), troff documents will cause you misery. Emacs usually determines when a paragraph ends by looking for blank lines. troff documents usually don’t have any blank lines, so Emacs tries to reformat the entire file, creating a big mess. (Luckily, in Emacs 19, the undo command, C-x u, is powerful enough to clean up the mess.)
All troff formatting commands (usually called requests ...
Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.