groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / man / roff.man
CommitLineData
4d3e9548 1'\" t
92d0a6a6
JR
2.ig
3roff.man
4
92d0a6a6
JR
5This file is part of groff, the GNU roff type-setting system.
6
4d3e9548
JL
7Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009
8Free Software Foundation, Inc.
92d0a6a6
JR
9written by Bernd Warken <bwarken@mayn.de>
10maintained by Werner Lemberg <wl@gnu.org>
11
12Permission is granted to copy, distribute and/or modify this document
4d3e9548 13under the terms of the GNU Free Documentation License, Version 1.3 or
92d0a6a6
JR
14any later version published by the Free Software Foundation; with the
15Invariant Sections being this .ig-section and AUTHORS, with no
16Front-Cover Texts, and with no Back-Cover Texts.
17
18A copy of the Free Documentation License is included as a file called
19FDL in the main directory of the groff source package.
20..
21.
92d0a6a6
JR
22.
23.\" --------------------------------------------------------------------
4d3e9548 24.\" Local macros
92d0a6a6
JR
25.
26.de Esc
4d3e9548 27. ds @1 \\$1
92d0a6a6 28. shift
4d3e9548 29. nop \f[B]\[rs]\\*[@1]\f[]\\$*
92d0a6a6
JR
30. rm @1
31..
32.
4d3e9548 33.
92d0a6a6 34.de QuotedChar
4d3e9548 35. ds @1 \\$1
92d0a6a6 36. shift
4d3e9548 37. nop `\f[B]\\*[@1]\f[]'\\$*
92d0a6a6
JR
38. rm @1
39..
40.
92d0a6a6
JR
41.
42.\" --------------------------------------------------------------------
43.\" Title
44.\" --------------------------------------------------------------------
45.
46.TH ROFF @MAN7EXT@ "@MDATE@" "Groff Version @VERSION@"
47.SH NAME
48roff \- concepts and history of roff typesetting
49.
50.
51.\" --------------------------------------------------------------------
52.SH DESCRIPTION
53.\" --------------------------------------------------------------------
54.
55.I roff
4d3e9548 56is the general name for a set of text formatting programs, known under
92d0a6a6 57names like
4d3e9548
JL
58.BR troff ,
59.BR nroff ,
60.BR ditroff ,
61.BR groff ,
92d0a6a6
JR
62etc.
63.
4d3e9548
JL
64A
65.I roff
66system consists of an extensible text formatting language and a set of
67programs for printing and converting to other text formats.
92d0a6a6 68.
4d3e9548
JL
69Unix-like operating systems distribute a
70.I roff
71system as a core package.
92d0a6a6
JR
72.
73.P
4d3e9548
JL
74The most common
75.I roff
76system today is the free software implementation \f[CR]GNU\f[]
77.IR roff ,
92d0a6a6
JR
78.BR groff (@MAN1EXT@).
79.
92d0a6a6 80.I groff
4d3e9548
JL
81implements the look-and-feel and functionality of its ancestors, with many
82extensions.
92d0a6a6
JR
83.
84.P
4d3e9548
JL
85The ancestry of
86.I roff
87is described in section
92d0a6a6 88.BR HISTORY .
92d0a6a6 89.
4d3e9548 90In this document, the term
92d0a6a6 91.I roff
4d3e9548
JL
92always refers to the general class of roff programs, not to the
93.B roff
94command provided in early UNIX systems.
92d0a6a6
JR
95.
96.P
4d3e9548
JL
97In spite of its age,
98.I roff
99is in wide use today, for example, the manual pages on UNIX systems
92d0a6a6
JR
100.RI ( man\~pages\/ ),
101many software books, system documentation, standards, and corporate
102documents are written in roff.
103.
4d3e9548
JL
104The
105.I roff
106output for text devices is still unmatched, and its graphical output
107has the same quality as other free type-setting programs and is better
108than some of the commercial systems.
92d0a6a6
JR
109.
110.P
4d3e9548
JL
111.I roff
112is used to format UNIX
113.IR "manual pages" ,
114(or
115.IR "man pages" ),
116the standard documentation system on many UNIX-derived operating systems.
92d0a6a6
JR
117.
118.P
4d3e9548 119This document describes the history of the development of the
92d0a6a6 120.IR "roff system" ;
4d3e9548
JL
121some usage aspects common to all
122.I roff
123versions, details on the
124.I roff
92d0a6a6
JR
125pipeline, which is usually hidden behind front-ends like
126.BR groff (@MAN1EXT@);
4d3e9548
JL
127a general overview of the formatting language; some tips for editing
128.I roff
129files; and many pointers to further readings.
92d0a6a6
JR
130.
131.
132.\" --------------------------------------------------------------------
133.SH "HISTORY"
134.\" --------------------------------------------------------------------
135.
4d3e9548
JL
136Document formatting by computer dates back to the 1960s.
137.
92d0a6a6
JR
138The
139.I roff
4d3e9548
JL
140system itself is intimately connected to the Unix operating system, but its
141roots go back to the earlier operating systems CTSS and Multics.
92d0a6a6
JR
142.
143.
144.\" --------------------------------------------------------------------
4d3e9548 145.SS "The Predecessor RUNOFF"
92d0a6a6
JR
146.\" --------------------------------------------------------------------
147.
4d3e9548
JL
148.BR roff 's
149ancestor
150.B RUNOFF
151was written in the MAD language by
152.I Jerry Saltzer
153for the
154.IR "Compatible Time Sharing System (CTSS)" ,
155a project of the Massachusetts Institute of Technology (MIT), in 1963 and
1561964 \[en] note that CTSS commands were all uppercase.
157.
92d0a6a6 158.P
4d3e9548
JL
159In 1965, MIT's Project MAC teamed with Bell Telephone Laboratories (BTL)
160and General Electric to begin the
161.UR http://\:www.multicians.org
162.I Multics
163system
164.UE .
92d0a6a6 165.
4d3e9548 166A command called
92d0a6a6 167.B runoff
4d3e9548
JL
168was written for Multics in the late 60s in the BCPL language, by
169.IR "Bob Morris" ,
170.IR "Doug McIlroy" ,
171and other members of the Multics team.
92d0a6a6
JR
172.
173.P
4d3e9548
JL
174Like its CTSS ancestor, Multics
175.B runoff
176formatted an input file consisting of text and command lines; commands began
177with a period and were two letters.
92d0a6a6 178.
4d3e9548
JL
179Output from these commands was to terminal devices such as IBM Selectric
180terminals.
92d0a6a6 181.
4d3e9548
JL
182Multics
183.B runoff
184had additional features added, such as the ability to do two-pass
185formatting; it became the main format for Multics documentation and text
186processing.
92d0a6a6
JR
187.
188.P
4d3e9548
JL
189BCPL and
190.B runoff
191were ported to the GCOS system at Bell Labs when BTL left the development of
192Multics.
92d0a6a6
JR
193.
194.
195.\" --------------------------------------------------------------------
196.SS "The Classical nroff/troff System"
197.\" --------------------------------------------------------------------
198.
4d3e9548 199At BTL, there was a need to drive the
92d0a6a6 200.I Graphic Systems CAT
4d3e9548 201typesetter, a graphical output device from a PDP-11 computer running Unix.
92d0a6a6 202.
4d3e9548
JL
203As
204.B runoff
205was too limited for this task it was further developed into a more
206powerful text formatting system by
207.IR "Joseph F.\& Ossanna" ,
208who already programmed several runoff ports.
92d0a6a6
JR
209.
210.P
211The name
212.I runoff
213was shortened to
214.IR roff .
4d3e9548
JL
215.
216The greatly enlarged language of Ossanna's version already included all
92d0a6a6
JR
217elements of a full
218.IR "roff system" .
219.
4d3e9548
JL
220All modern
221.I roff
222systems try to implement compatibility to this system.
92d0a6a6 223.
4d3e9548
JL
224So Joe Ossanna can be called the father of all
225.I roff
226systems.
92d0a6a6
JR
227.
228.P
229This first
230.I roff system
231had three formatter programs.
232.
233.TP
234.B troff
235.RI ( "typesetter roff\/" )
236generated a graphical output for the
237.I CAT
238typesetter as its only device.
239.
240.TP
241.B nroff
242produced text output suitable for terminals and line printers.
243.
244.TP
245.B roff
4d3e9548
JL
246was the reimplementation of the former
247.B runoff
248program with its limited features; this program was abandoned in later
249versions.
92d0a6a6
JR
250.
251Today, the name
252.I roff
4d3e9548
JL
253is used to refer to a
254.I troff/\:nroff
255sytem as a whole.
92d0a6a6
JR
256.
257.P
4d3e9548 258Ossanna's first version was written in the PDP-11 assembly language and
92d0a6a6
JR
259released in 1973.
260.
261.I Brian Kernighan
262joined the
263.I roff
264development by rewriting it in the C\~programming language.
265.
266The C\~version was released in 1975.
267.
268.P
269The syntax of the formatting language of the
4d3e9548 270.BR nroff /\: troff
92d0a6a6
JR
271programs was documented in the famous
272.IR "Troff User's Manual [CSTR\~#54]" ,
273first published in 1976, with further revisions up to 1992 by Brian
274Kernighan.
275.
276This document is the specification of the
277.IR "classical troff" .
4d3e9548 278.
92d0a6a6
JR
279All later
280.I roff
281systems tried to establish compatibility with this specification.
282.
283.P
4d3e9548
JL
284After Ossanna's death in 1977, Kernighan went on with developing
285.IR troff .
92d0a6a6 286.
4d3e9548
JL
287In the late 1970s, Kernighan equipped
288.I troff
289with a general interface to support more devices, the intermediate
290output format, and the postprocessor system.
92d0a6a6
JR
291.
292This completed the structure of a
293.I "roff system"
294as it is still in use today; see section
295.BR "USING ROFF" .
296.
297In 1979, these novelties were described in the paper
298.IR "[CSTR\~#97]" .
4d3e9548
JL
299.
300This new
301.I troff
302version is the basis for all existing newer troff systems, including
92d0a6a6
JR
303.IR groff .
304.
305On some systems, this
306.I device independent troff
307got a binary of its own, called
308.BR ditroff (@MAN7EXT@).
309.
310All modern
311.B troff
4d3e9548
JL
312programs already provide the full
313.B ditroff
314capabilities automatically.
92d0a6a6
JR
315.
316.
317.\" --------------------------------------------------------------------
4d3e9548 318.SS "Availability"
92d0a6a6
JR
319.\" --------------------------------------------------------------------
320.
4d3e9548
JL
321The source code of both the ancient Unix and classical
322.I troff
323weren't available for two decades.
92d0a6a6 324.
4d3e9548
JL
325Meanwhile, it is accessible again (on-line) for non-commercial use,
326cf.\& section
92d0a6a6
JR
327.BR "SEE ALSO" .
328.
329.
330.\" --------------------------------------------------------------------
331.SS "Free roff"
332.\" --------------------------------------------------------------------
333.
4d3e9548
JL
334The most important free
335.I roff
336project was the \f[CR]GNU\f[] implementation of
337.IR troff ,
338written from scratch by
339.I James Clark
340and put under the
341.UR http://\:www.gnu.org/\:copyleft
342GNU Public License
343.UE .
92d0a6a6
JR
344.
345It was called
346.I groff
4d3e9548
JL
347(\f[CR]GNU\f[]
348.IR roff ).
349.
92d0a6a6
JR
350See
351.BR groff (@MAN1EXT@)
352for an overview.
353.
354.P
4d3e9548
JL
355The
356.I groff
357system is still actively developed.
358.
359It is compatible to the classical
360.IR troff ,
361but many extensions were added.
92d0a6a6 362.
4d3e9548
JL
363It is the first
364.I roff
365system that is available on almost all operating systems \[en] and it is
366free.
92d0a6a6 367.
4d3e9548
JL
368This makes
369.I groff
370the de-facto
371.I roff
372standard today.
92d0a6a6 373.
4d3e9548
JL
374.P
375An alternative is
376.IR "Gunnar Ritter" 's
377.UR http://\:heirloom.sf.net
378Heirloom Documentation Tools
379.UE
380project, started in 2005, which provides enhanced versions of the various
381roff tools found in the OpenSolaris and Plan\~9 operating systems, now
382available under free licenses.
92d0a6a6
JR
383.
384.
385.\" --------------------------------------------------------------------
386.SH "USING ROFF"
387.\" --------------------------------------------------------------------
388.
4d3e9548
JL
389Most people won't even notice that they are actually using
390.IR roff .
92d0a6a6 391.
4d3e9548
JL
392When you read a system manual page (man page)
393.I roff
394is working in the background.
92d0a6a6 395.
4d3e9548
JL
396.I roff
397documents can be viewed with a native viewer called
465b256c 398.BR \%xditview (1x),
92d0a6a6
JR
399a standard program of the X window distribution, see
400.BR X (7x).
401.
4d3e9548
JL
402But using
403.I roff
404explicitly isn't difficult either.
92d0a6a6
JR
405.
406.P
4d3e9548
JL
407Some
408.I roff
409implementations provide wrapper programs that make it easy to use the
410.I roff
411system on the shell command line.
92d0a6a6 412.
4d3e9548
JL
413For example, the \f[CR]GNU\f[]
414.I roff
415implementation
92d0a6a6
JR
416.BR groff (@MAN1EXT@)
417provides command line options to avoid the long command pipes of
4d3e9548
JL
418classical
419.IR troff ;
420a program
92d0a6a6
JR
421.BR grog (@MAN1EXT@)
422tries to guess from the document which arguments should be used for a
4d3e9548
JL
423run of
424.BR groff ;
425people who do not like specifying command line options should try the
92d0a6a6 426.BR groffer (@MAN1EXT@)
4d3e9548
JL
427program for graphically displaying
428.I groff
429files and man pages.
92d0a6a6
JR
430.
431.
432.\" --------------------------------------------------------------------
433.SS "The roff Pipe"
434.\" --------------------------------------------------------------------
435.
4d3e9548
JL
436Each
437.I roff
438system consists of preprocessors,
439.I roff
440formatter programs, and a set of device postprocessors.
92d0a6a6
JR
441.
442This concept makes heavy use of the
443.I piping
444mechanism, that is, a series of programs is called one after the other,
445where the output of each program in the queue is taken as the input
446for the next program.
447.
4d3e9548
JL
448.RS
449.P
450cat \f[I]file\f[P] \
451| .\|.\|. \
452| \f[I]preproc\f[P] \
453| .\|.\|. \
454| troff \f[I]options\f[P] \
455| \f[I]postproc\f[P]
456.RE
92d0a6a6 457.
92d0a6a6 458.P
4d3e9548
JL
459The preprocessors generate
460.I roff
461code that is fed into a
462.I roff
463formatter (e.g.\&
464.BR troff ),
465which in turn generates
92d0a6a6
JR
466.I intermediate output
467that is fed into a device postprocessor program for printing or final
468output.
469.
470.P
471All of these parts use programming languages of their own; each
472language is totally unrelated to the other parts.
473.
4d3e9548
JL
474Moreover,
475.I roff
476macro packages that were tailored for special purposes can be
477included.
92d0a6a6
JR
478.
479.P
4d3e9548
JL
480Most
481.I roff
482documents use the macros of some package, intermixed with code for one
483or more preprocessors, spiced with some elements from the plain
484.I roff
485language.
92d0a6a6 486.
4d3e9548
JL
487The full power of the
488.I roff
489formatting language is seldom needed by users; only programmers of
490macro packages need to know about the gory details.
92d0a6a6
JR
491.
492.
493.
494.\" --------------------------------------------------------------------
495.SS "Preprocessors"
496.\" --------------------------------------------------------------------
497.
4d3e9548
JL
498A
499.I roff
500preprocessor is any program that generates output that syntactically
501obeys the rules of the
502.I roff
503formatting language.
92d0a6a6
JR
504.
505Each preprocessor defines a language of its own that is translated
4d3e9548
JL
506into
507.I roff
508code when run through the preprocessor program.
92d0a6a6 509.
4d3e9548
JL
510Parts written in these languages may be included within a
511.I roff
512document; they are identified by special
513.I roff
514requests or macros.
92d0a6a6
JR
515.
516Each document that is enhanced by preprocessor code must be run
517through all corresponding preprocessors before it is fed into the
4d3e9548
JL
518actual
519.I roff
520formatter program, for the formatter just ignores all alien code.
92d0a6a6
JR
521.
522The preprocessor programs extract and transform only the document
523parts that are determined for them.
524.
525.P
4d3e9548
JL
526There are a lot of free and commercial
527.I roff
528preprocessors.
92d0a6a6
JR
529.
530Some of them aren't available on each system, but there is a small
531set of preprocessors that are considered as an integral part of each
4d3e9548
JL
532.I roff
533system.
92d0a6a6
JR
534.
535The classical preprocessors are
536.
92d0a6a6 537.RS
4d3e9548
JL
538.TS
539tab (@);
540lb l.
541tbl@for tables.
542eqn@for mathematical formul\[ae].
543pic@for drawing diagrams.
544refer@for bibliographic references.
545soelim@for including macro files from standard locations.
546chem@for drawing chemical formul\[ae].
547.TE
92d0a6a6
JR
548.RE
549.
550.P
551Other known preprocessors that are not available on all systems
552include
553.
92d0a6a6 554.RS
4d3e9548
JL
555.TS
556tab (@);
557lb l.
558grap@for constructing graphical elements.
559grn@for including \fBgremlin\fR(1) pictures.
560.TE
92d0a6a6
JR
561.RE
562.
92d0a6a6
JR
563.\" --------------------------------------------------------------------
564.SS "Formatter Programs"
565.\" --------------------------------------------------------------------
566.
567A
568.I roff formatter
4d3e9548
JL
569is a program that parses documents written in the
570.I roff
571formatting language or uses some of the
572.I roff
573macro packages.
92d0a6a6
JR
574.
575It generates
576.IR "intermediate output" ,
577which is intended to be fed into a single device postprocessor that
578must be specified by a command-line option to the formatter program.
579.
580The documents must have been run through all necessary preprocessors
581before.
582.
583.P
4d3e9548
JL
584The output produced by a
585.I roff
586formatter is represented in yet another language, the
92d0a6a6
JR
587.IR "intermediate output format"
588or
589.IR "troff output" .
4d3e9548 590.
92d0a6a6
JR
591This language was first specified in
592.IR "[CSTR\~#97]" ;
4d3e9548 593its \f[CR]GNU\f[] extension is documented in
92d0a6a6
JR
594.BR groff_out (@MAN5EXT@).
595.
596The intermediate output language is a kind of assembly language
4d3e9548
JL
597compared to the high-level
598.I roff
599language.
92d0a6a6
JR
600.
601The generated intermediate output is optimized for a special device,
602but the language is the same for every device.
603.
604.P
4d3e9548
JL
605The
606.I roff
607formatter is the heart of the
608.I roff
609system.
92d0a6a6 610.
4d3e9548
JL
611The traditional
612.I roff
613had two formatters,
92d0a6a6
JR
614.B nroff
615for text devices and
616.B troff
617for graphical devices.
618.
619.P
620Often, the name
621.I troff
622is used as a general term to refer to both formatters.
623.
624.
625.\" --------------------------------------------------------------------
626.SS "Devices and Postprocessors"
627.\" --------------------------------------------------------------------
628.
629Devices are hardware interfaces like printers, text or graphical
630terminals, etc., or software interfaces such as a conversion into a
631different text or graphical format.
632.
633.P
4d3e9548
JL
634A
635.I roff
636postprocessor is a program that transforms
637.I troff
638output into a form suitable for a special device.
92d0a6a6 639.
4d3e9548
JL
640The
641.I roff
642postprocessors are like device drivers for the output target.
92d0a6a6
JR
643.
644.P
645For each device there is a postprocessor program that fits the device
646optimally.
647.
648The postprocessor parses the generated intermediate output and
649generates device-specific code that is sent directly to the device.
650.
651.P
652The names of the devices and the postprocessor programs are not fixed
653because they greatly depend on the software and hardware abilities of
654the actual computer.
655.
656For example, the classical devices mentioned in
657.I [CSTR\~#54]
658have greatly changed since the classical times.
659.
660The old hardware doesn't exist any longer and the old graphical
661conversions were quite imprecise when compared to their modern
662counterparts.
663.
664.P
665For example, the Postscript device
666.I post
4d3e9548
JL
667in classical
668.I troff
669had a resolution of 720 units per inch, while
670.IR groff 's
92d0a6a6
JR
671.I ps
672device has 72000, a refinement of factor 100.
673.
674.P
675Today the operating systems provide device drivers for most
676printer-like hardware, so it isn't necessary to write a special
677hardware postprocessor for each printer.
678.
679.
680.\" --------------------------------------------------------------------
681.SH "ROFF PROGRAMMING"
682.\" --------------------------------------------------------------------
683.
4d3e9548
JL
684Documents using
685.I roff
686are normal text files decorated by
687.I roff
92d0a6a6
JR
688formatting elements.
689.
4d3e9548
JL
690The
691.I roff
692formatting language is quite powerful; it is almost a full programming
693language and provides elements to enlarge the language.
92d0a6a6
JR
694.
695With these, it became possible to develop macro packages that are
696tailored for special applications.
697.
4d3e9548
JL
698Such macro packages are much handier than plain
699.IR roff .
92d0a6a6
JR
700.
701So most people will choose a macro package without worrying about the
4d3e9548
JL
702internals of the
703.I roff
704language.
92d0a6a6
JR
705.
706.
707.\" --------------------------------------------------------------------
708.SS "Macro Packages"
709.\" --------------------------------------------------------------------
710.
711Macro packages are collections of macros that are suitable to format a
712special kind of documents in a convenient way.
713.
4d3e9548
JL
714This greatly eases the usage of
715.IR roff .
92d0a6a6
JR
716.
717The macro definitions of a package are kept in a file called
718.IB name .tmac
719(classically
720.BI tmac. name\c
721).
722.
723All tmac files are stored in one or more directories at standardized
724positions.
725.
726Details on the naming of macro packages and their placement is found
727in
728.BR groff_tmac (@MAN5EXT@).
729.
730.P
731A macro package that is to be used in a document can be announced to
732the formatter by the command line option
4d3e9548 733.BR \-m ,
92d0a6a6
JR
734see
735.BR troff (@MAN1EXT@),
736or it can be specified within a document using the file inclusion
4d3e9548
JL
737requests of the
738.I roff
739language, see
92d0a6a6
JR
740.BR groff (@MAN7EXT@).
741.
742.P
743Famous classical macro packages are
744.I man
745for traditional man pages,
746.I mdoc
4d3e9548 747for \f[CR]BSD\f[]-style manual pages;
92d0a6a6
JR
748the macro sets for books, articles, and letters are
749.I me
750(probably from the first name of its creator
751.I Eric
752Allman),
753.I ms
754(from
755.IR "Manuscript Macros\/" ),
756and
757.I mm
758(from
759.IR "Memorandum Macros\/" ).
760.
761.
762.\" --------------------------------------------------------------------
763.SS "The roff Formatting Language"
764.\" --------------------------------------------------------------------
765.
4d3e9548
JL
766The classical
767.I roff
768formatting language is documented in the
92d0a6a6
JR
769.I Troff User's Manual
770.IR "[CSTR\~#54]" .
771.
4d3e9548
JL
772The
773.I roff
774language is a full programming language providing requests, definition
775of macros, escape sequences, string variables, number or size
776registers, and flow controls.
92d0a6a6
JR
777.
778.P
779.I Requests
780are the predefined basic formatting commands similar to the commands
781at the shell prompt.
782.
4d3e9548
JL
783The user can define request-like elements using predefined
784.I roff
92d0a6a6
JR
785elements.
786.
787These are then called
788.IR macros .
789.
790A document writer will not note any difference in usage for requests
791or macros; both are written on a line on their own starting with a dot.
792.
793.P
794.I Escape sequences
4d3e9548
JL
795are
796.I roff
797elements starting with a backslash
92d0a6a6 798.QuotedChar \[rs] .
4d3e9548 799.
92d0a6a6
JR
800They can be inserted anywhere, also in the midst of text in a line.
801.
802They are used to implement various features, including the insertion of
4d3e9548 803non-\f[CR]ASCII\f[] characters with
92d0a6a6
JR
804.Esc ( ,
805font changes with
806.Esc f ,
807in-line comments with
808.Esc \[dq] ,
809the escaping of special control characters like
810.Esc \[rs] ,
811and many other features.
812.
813.P
814.I Strings
815are variables that can store a string.
816.
817A string is stored by the
818.B .ds
819request.
820.
821The stored string can be retrieved later by the
822.B \[rs]*
823escape sequence.
824.
825.P
826.I Registers
827store numbers and sizes.
828.
829A register can be set with the request
830.B .nr
831and its value can be retrieved by the escape sequence
832.BR "\[rs]n" .
833.
834.
835.\" --------------------------------------------------------------------
836.SH "FILE NAME EXTENSIONS"
837.\" --------------------------------------------------------------------
838.
839Manual pages (man pages) take the section number as a file name
840extension, e.g., the filename for this document is
841.IR roff.7 ,
842i.e., it is kept in section\~7
843of the man pages.
844.
845.P
4d3e9548 846The classical macro packages take the package name as an extension, e.g.\&
92d0a6a6
JR
847.IB file. me
848for a document using the
849.I me
850macro package,
851.IB file. mm
852for
853.IR mm ,
854.IB file. ms
855for
856.IR ms ,
857.IB file. pic
858for
859.I pic
860files,
861etc.
862.
863.P
4d3e9548
JL
864But there is no general naming scheme for
865.I roff
866documents, though
92d0a6a6
JR
867.IB file. tr
868for
869.I troff file
870is seen now and then.
871.
872Maybe there should be a standardization for the filename extensions of
4d3e9548
JL
873.I roff
874files.
92d0a6a6
JR
875.
876.P
877File name extensions can be very handy in conjunction with the
878.BR less (1)
879pager.
880.
881It provides the possibility to feed all input into a command-line pipe
882that is specified in the shell environment variable
883.BR LESSOPEN .
4d3e9548 884.
92d0a6a6
JR
885This process is not well documented, so here an example:
886.
4d3e9548
JL
887.RS
888.P
889.EX
890LESSOPEN='|lesspipe %s'
891.EE
892.RE
92d0a6a6 893.
4d3e9548 894.P
92d0a6a6
JR
895where
896.B lesspipe
897is either a system supplied command or a shell script of your own.
898.
899.
900.\" --------------------------------------------------------------------
901.SH "EDITING ROFF"
902.\" --------------------------------------------------------------------
903.
4d3e9548
JL
904The best program for editing a
905.I roff
906document is Emacs (or Xemacs), see
92d0a6a6 907.BR emacs (1).
4d3e9548 908.
92d0a6a6
JR
909It provides an
910.I nroff
4d3e9548
JL
911mode that is suitable for all kinds of
912.I roff
913dialects.
92d0a6a6
JR
914.
915This mode can be activated by the following methods.
916.
917.P
918When editing a file within Emacs the mode can be changed by typing
919.RI ` "M-x nroff-mode" ',
920where
921.B M-x
922means to hold down the
923.B Meta
924key (or
925.BR Alt )
926and hitting the
927.BR x\~ key
928at the same time.
929.
930.P
931But it is also possible to have the mode automatically selected when
932the file is loaded into the editor.
933.
4d3e9548 934.IP \(bu
92d0a6a6
JR
935The most general method is to include the following 3 comment lines at
936the end of the file.
937.
4d3e9548
JL
938.RS
939.IP
940.EX
941\&.\[rs]" Local Variables:
942\&.\[rs]" mode: nroff
943\&.\[rs]" End:
944.EE
945.RE
92d0a6a6 946.
4d3e9548
JL
947.IP \(bu
948There is a set of file name extensions, e.g.\& the man pages that
949trigger the automatic activation of the
950.I nroff
951mode.
92d0a6a6 952.
4d3e9548 953.IP \(bu
92d0a6a6 954Theoretically, it is possible to write the sequence
4d3e9548
JL
955.
956.RS
957.IP
958.EX
959\&.\[rs]" \%-*-\ nroff\ -*-
960.EE
961.RE
962.
963.IP
964as the first line of a file to have it started in
965.I nroff
966mode when loaded.
92d0a6a6
JR
967.
968Unfortunately, some applications such as the
969.B man
970program are confused by this; so this is deprecated.
971.
972.P
4d3e9548
JL
973All
974.I roff
975formatters provide automated line breaks and horizontal and vertical
976spacing.
92d0a6a6
JR
977.
978In order to not disturb this, the following tips can be helpful.
979.
4d3e9548
JL
980.IP \(bu
981Never include empty or blank lines in a
982.I roff
983document.
92d0a6a6
JR
984.
985Instead, use the empty request (a line consisting of a dot only) or a
986line comment
4d3e9548 987.B .\[rs]"
92d0a6a6
JR
988if a structuring element is needed.
989.
4d3e9548 990.IP \(bu
92d0a6a6
JR
991Never start a line with whitespace because this can lead to
992unexpected behavior.
993.
4d3e9548
JL
994Indented paragraphs can be constructed in a controlled way by
995.I roff
92d0a6a6
JR
996requests.
997.
4d3e9548 998.IP \(bu
92d0a6a6
JR
999Start each sentence on a line of its own, for the spacing after a dot
1000is handled differently depending on whether it terminates an
1001abbreviation or a sentence.
1002.
1003To distinguish both cases, do a line break after each sentence.
1004.
4d3e9548 1005.IP \(bu
92d0a6a6 1006To additionally use the auto-fill mode in Emacs, it is best to insert
4d3e9548
JL
1007an empty
1008.I roff
1009request (a line consisting of a dot only) after each sentence.
92d0a6a6
JR
1010.
1011.P
4d3e9548
JL
1012The following example shows how optimal
1013.I roff
1014editing could look.
92d0a6a6 1015.
4d3e9548
JL
1016.RS
1017.P
1018.EX
1019This is an example for a
1020\&.I roff
1021document.
1022\&.
92d0a6a6 1023This is the next sentence in the same paragraph.
4d3e9548 1024\&.
92d0a6a6
JR
1025This is a longer sentence stretching over several
1026lines; abbreviations like `cf.' are easily
1027identified because the dot is not followed by a
1028line break.
4d3e9548 1029\&.
92d0a6a6
JR
1030In the output, this will still go to the same
1031paragraph.
4d3e9548
JL
1032.EE
1033.RE
92d0a6a6
JR
1034.
1035.P
4d3e9548
JL
1036Besides Emacs, some other editors provide
1037.I nroff
1038style files too, e.g.\&
92d0a6a6
JR
1039.BR vim (1),
1040an extension of the
1041.BR vi (1)
1042program.
1043.
1044.
1045.\" --------------------------------------------------------------------
92d0a6a6
JR
1046.SH "SEE ALSO"
1047.\" --------------------------------------------------------------------
1048.
4d3e9548
JL
1049There is a lot of documentation on
1050.IR roff .
92d0a6a6 1051.
4d3e9548
JL
1052The original papers on classical
1053.I troff
1054are still available, and all aspects of
1055.I groff
1056are documented in great detail.
92d0a6a6
JR
1057.
1058.
1059.\" --------------------------------------------------------------------
1060.SS "Internet sites"
1061.\" --------------------------------------------------------------------
1062.
1063.TP
1064troff.org
4d3e9548
JL
1065.UR http://\:www.troff.org
1066The historical troff site
1067.UE
1068provides an overview and pointers to all historical aspects of
1069.IR roff .
92d0a6a6
JR
1070.
1071.TP
1072Multics
4d3e9548
JL
1073.UR http://\:www.multicians.org
1074The Multics site
1075.UE
92d0a6a6
JR
1076contains a lot of information on the MIT projects, CTSS, Multics,
1077early Unix, including
4d3e9548 1078.IR runoff ;
92d0a6a6
JR
1079especially useful are a glossary and the many links to ancient
1080documents.
1081.
1082.TP
1083Unix Archive
4d3e9548
JL
1084.UR http://\:www.tuhs.org/\:Archive/
1085The Ancient Unixes Archive
1086.UE
92d0a6a6
JR
1087.
1088provides the source code and some binaries of the ancient Unixes
4d3e9548
JL
1089(including the source code of
1090.I troff
1091and its documentation) that were made public by Caldera since 2001,
1092e.g.\& of the famous Unix version\~7 for PDP-11 at the
1093.UR http://\:www.tuhs.org/\:Archive/\:PDP-11/\:Trees/\:V7
1094Unix V7 site
1095.UE .
92d0a6a6
JR
1096.
1097.TP
1098Developers at AT&T Bell Labs
4d3e9548
JL
1099.UR http://\:www.bell-labs.com/
1100Bell Labs Computing and Mathematical Sciences Research
1101.UE
92d0a6a6
JR
1102.
1103provides a search facility for tracking information on the early
1104developers.
1105.
1106.TP
1107Plan 9
4d3e9548
JL
1108.UR http://\:plan9.bell-labs.com
1109The Plan\~9 operating system
1110.UE
92d0a6a6
JR
1111.
1112by AT&T Bell Labs.
1113.
1114.TP
1115runoff
4d3e9548
JL
1116.UR http://\:web.mit.edu/\:Saltzer/\:www/\:publications/\:pubs.html
1117Jerry Saltzer's home page
1118.UE
92d0a6a6 1119.
4d3e9548 1120stores some documents using the ancient RUNOFF formatting language.
92d0a6a6
JR
1121.
1122.TP
1123CSTR Papers
4d3e9548
JL
1124.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr.html
1125The Bell Labs CSTR site
1126.UE
92d0a6a6 1127.
4d3e9548
JL
1128stores the original
1129.I troff
1130manuals (CSTR #54, #97, #114, #116, #122) and famous historical
1131documents on programming.
92d0a6a6
JR
1132.
1133.TP
4d3e9548
JL
1134\f[CR]GNU\f[] \f[I]roff\f[]
1135.UR http://\:www.gnu.org/\:software/\:groff
1136The groff web site
1137.UE
1138provides the free
1139.I roff
1140implementation
1141.IR groff ,
1142the actual standard
1143.IR roff .
92d0a6a6
JR
1144.
1145.
1146.\" --------------------------------------------------------------------
1147.SS "Historical roff Documentation"
1148.\" --------------------------------------------------------------------
1149.
1150Many classical
1151.B troff
1152documents are still available on-line.
1153.
4d3e9548
JL
1154The two main manuals of the
1155.I troff
1156language are
92d0a6a6
JR
1157.
1158.TP
1159[CSTR\~#54]
4d3e9548
JL
1160J. F. Ossanna,
1161.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:54.ps.gz
1162.I "Nroff/\:Troff User's Manual"
1163.UE ;
92d0a6a6
JR
1164.
1165Bell Labs, 1976; revised by Brian Kernighan, 1992.
92d0a6a6
JR
1166.
1167.TP
1168[CSTR\~#97]
1169Brian Kernighan,
4d3e9548
JL
1170.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:97.ps.gz
1171.I "A Typesetter-independent TROFF"
1172.UE ,
92d0a6a6
JR
1173.
1174Bell Labs, 1981, revised March 1982.
1175.
1176.P
4d3e9548
JL
1177The \[lq]little language\[rq]
1178.I roff
1179papers are
92d0a6a6
JR
1180.
1181.TP
1182[CSTR\~#114]
1183Jon L. Bentley and Brian W. Kernighan,
4d3e9548
JL
1184.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:114.ps.gz
1185.I "GRAP \[en] A Language for Typesetting Graphs"
1186.UE ;
92d0a6a6
JR
1187.
1188Bell Labs, August 1984.
1189.
1190.TP
1191[CSTR\~#116]
1192Brian W. Kernighan,
4d3e9548
JL
1193.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:116.ps.gz
1194.I "PIC \[en] A Graphics Language for Typesetting"
1195.UE ;
92d0a6a6
JR
1196.
1197Bell Labs, December 1984.
1198.
1199.TP
1200[CSTR\~#122]
1201J. L. Bentley, L. W. Jelinski, and B. W. Kernighan,
4d3e9548
JL
1202.UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:122.ps.gz
1203.I "CHEM \[en] A Program for Typesetting Chemical Structure Diagrams,"
1204.I "Computers and Chemistry"
1205.UE ;
92d0a6a6
JR
1206.
1207Bell Labs, April 1986.
1208.
1209.
1210.\" --------------------------------------------------------------------
1211.SS "Manual Pages"
1212.\" --------------------------------------------------------------------
1213.
4d3e9548
JL
1214Due to its complex structure, a full
1215.I roff
1216system has many man pages, each describing a single aspect of
1217.IR roff .
92d0a6a6 1218.
4d3e9548
JL
1219Unfortunately, there is no general naming scheme for the documentation
1220among the different
1221.I roff
1222implementations.
92d0a6a6
JR
1223.
1224.P
1225In
1226.IR groff ,
1227the man page
1228.BR groff (@MAN1EXT@)
4d3e9548
JL
1229contains a survey of all documentation available in
1230.IR groff .
92d0a6a6
JR
1231.
1232.P
1233On other systems, you are on your own, but
1234.BR troff (1)
1235might be a good starting point.
1236.
1237.
1238.\" --------------------------------------------------------------------
1239.SH AUTHORS
1240.\" --------------------------------------------------------------------
1241.
4d3e9548
JL
1242Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009
1243Free Software Foundation, Inc.
92d0a6a6
JR
1244.
1245.P
4d3e9548
JL
1246This document is distributed under the terms of the \f[CR]FDL\f[]
1247(\f[CR]GNU Free Documentation License\f[]) version 1.3 or later.
92d0a6a6 1248.
4d3e9548
JL
1249You should have received a copy of the \f[CR]FDL\f[] on your system,
1250it is also available on-line at the
1251.UR http://\:www.gnu.org/\:copyleft/\:fdl.html
1252GNU copyleft site
1253.UE .
92d0a6a6
JR
1254.
1255.P
1256This document is part of
1257.IR groff ,
4d3e9548
JL
1258the \f[CR]GNU\f[]
1259.I roff
1260distribution.
92d0a6a6
JR
1261.
1262It was written by
4d3e9548
JL
1263.MT bwarken@mayn.de
1264Bernd Warken
1265.ME ;
92d0a6a6 1266it is maintained by
4d3e9548
JL
1267.MT wl@gnu.org
1268Werner Lemberg
1269.ME .
92d0a6a6
JR
1270.
1271.\" --------------------------------------------------------------------
1272.\" Emacs setup
1273.\" --------------------------------------------------------------------
1274.
1275.\" Local Variables:
1276.\" mode: nroff
1277.\" End: