Debian Codegraph @

upstream/fedora-rawhide/man7/roff.groff.7

raw
1 '\" t
2 .TH roff 7 "2026-03-03" "groff 1.24.0"
3 .SH Name
4 roff \- concepts and history of
5 .I roff
6 typesetting
7 .
8 .
9 .\" TODO: Synchronize this material with introductory section(s) of our
10 .\" Texinfo manual, and then keep it that way.
11 .
12 .\" ====================================================================
13 .\" Legal Terms
14 .\" ====================================================================
15 .\"
16 .\" Copyright 2000-2024 Free Software Foundation, Inc.
17 .\" 2017-2025 G. Branden Robinson
18 .\"
19 .\" This file is part of groff, the GNU roff typesetting system.
20 .\"
21 .\" Permission is granted to copy, distribute and/or modify this
22 .\" document under the terms of the GNU Free Documentation License,
23 .\" Version 1.3 or any later version published by the Free Software
24 .\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
25 .\" and with no Back-Cover Texts.
26 .\"
27 .\" A copy of the Free Documentation License is included as a file
28 .\" called FDL in the main directory of the groff source package.
29 .
30 .
31 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
32 .do nr *groff_roff_7_man_C \n[.cp]
33 .cp 0
34 .
35 .\" Define fallback for groff 1.23's MR macro if the system lacks it.
36 .nr do-fallback 0
37 .if !\n(.f .nr do-fallback 1 \" mandoc
38 .if \n(.g .if !d MR .nr do-fallback 1 \" older groff
39 .if !\n(.g .nr do-fallback 1 \" non-groff *roff
40 .if \n[do-fallback] \{\
41 . de MR
42 . ie \\n(.$=1 \
43 . I \%\\$1
44 . el \
45 . IR \%\\$1 (\\$2)\\$3
46 . .
47 .\}
48 .rr do-fallback
49 .
50 .\" define a string tx for the TeX logo
51 .ie t .ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
52 .el .ds tx TeX
53 .
54 .
55 .\" ====================================================================
56 .SH Description
57 .\" ====================================================================
58 .
59 The term
60 .I roff
61 denotes a family of document formatting systems known by names like
62 .IR troff ,
63 .IR nroff ,
64 and
65 .IR ditroff .
66 .
67 A
68 .I roff
69 system consists of an interpreter for an extensible text formatting
70 language and a set of programs for preparing output for various devices
71 and file formats.
72 .
73 Unix-like operating systems often distribute a
74 .I roff
75 system.
76 .
77 The manual pages on Unix systems
78 (\[lq]man\~pages\[rq])
79 and bestselling books on software engineering,
80 including Brian Kernighan and Dennis Ritchie's
81 .I "The C Programming Language"
82 and W.\& Richard Stevens's
83 .IR "Advanced Programming in the Unix Environment" ,
84 have been written using
85 .I roff
86 systems.
87 .
88 GNU
89 .IR roff \[em] groff \[em]is
90 arguably the most widespread
91 .I roff
92 implementation.
93 .
94 .
95 .P
96 Below we present
97 typographical concepts foundational to understanding any
98 .I roff
99 implementation,
100 narrate the development history of some
101 .I roff
102 systems,
103 detail the command pipeline managed by
104 .MR groff 1 ,
105 survey the formatting language,
106 suggest tips for editing
107 .I roff
108 input,
109 and recommend further reading materials.
110 .
111 .
112 .\" ====================================================================
113 .SH Concepts
114 .\" ====================================================================
115 .
116 .\" BEGIN Keep roughly parallel with groff.texi nodes "Text" through
117 .\" "Tabs and Leaders".
118 AT&T
119 .I troff \" AT&T
120 was designed to take input as it would be composed on a typewriter,
121 including the teletypewriters used as early computer terminals,
122 and relieve the user drafting a document of concern with details like
123 line length maintenance,
124 hyphenation breaking,
125 and consistent paragraph indentation.
126 .
127 Early in its development,
128 the program gained the ability to prepare output for a phototypesetter;
129 a document could then be prepared for output to a teletypewriter,
130 a phototypesetter,
131 or both.
132 .
133 GNU
134 .I troff \" GNU
135 continues this tradition of permitting an author
136 to compose a single master version of a document
137 which can then be rendered upon a variety of output formats or devices,
138 including PDF,
139 HTML,
140 laser printers,
141 and terminal displays.
142 .
143 .
144 .P
145 .I roff
146 input contains text interspersed with instructions to control the
147 formatter.
148 .
149 Even in the absence of such instructions,
150 a
151 .I roff
152 formatter still processes its input in several ways,
153 by filling,
154 hyphenating,
155 breaking,
156 and adjusting it,
157 and supplementing it with inter-sentence space.
158 .
159 These processes are basic to typesetting,
160 and can be controlled at the input document's discretion.
161 .
162 .
163 .\" This paragraph and the subsequent example are unique to roff(7); in
164 .\" Texinfo we introduce escape sequences and requests more gently.
165 .P
166 Instructions to
167 .I roff
168 take two forms.
169 .
170 One is the
171 .IR request ,
172 which occupies an input line and starts with the
173 .IR "control character" ,
174 a dot
175 .RB \[lq] . \[rq].
176 .
177 The other is the
178 .IR "escape sequence" ,
179 which can occur almost anywhere and starts with the
180 .IR "escape character" ,
181 a backslash
182 .RB \[lq] \[rs] \[rq].
183 .
184 Both characters are configurable.
185 .
186 .
187 .RS
188 .PP
189 .EX
190 \&.br \[rs]" break the output line
191 .EE
192 .RE
193 .
194 .
195 .P
196 When a device-independent
197 .I roff
198 formatter starts up,
199 it obtains information about the device for which it is preparing
200 output from the latter's description file
201 (see
202 .MR groff_font 5 ).
203 .
204 An essential property is the length of the output line,
205 such as \[lq]6.5 inches\[rq].
206 .
207 .
208 .P
209 The formatter interprets plain text files employing the Unix line-ending
210 convention.
211 .
212 It reads input a character at a time,
213 collecting words as it goes,
214 and fits as many words together on an output line as it can\[em]this
215 is known as
216 .I filling.
217 .
218 To a
219 .I roff
220 system,
221 a
222 .I word
223 is any sequence of one or more characters that aren't spaces or
224 newlines.
225 .
226 The exceptions separate words.
227 .
228 .
229 .P
230 A
231 .I roff
232 formatter attempts to detect boundaries between sentences,
233 and supplies supplemental inter-sentence space between them.
234 .
235 It flags certain characters
236 (normally
237 .RB \[lq] !\& \[rq],
238 .RB \[lq] ?\& \[rq],
239 and
240 .RB \[lq] .\& \[rq])
241 as potentially ending a sentence.
242 .
243 When the formatter encounters one of these
244 .I end-of-sentence characters
245 at the end of an input line,
246 or one of them is followed by two (unescaped) spaces on the same input
247 line,
248 it appends an inter-word space
249 followed by an inter-sentence space in the output.
250 .
251 The dummy character escape sequence
252 .B \[rs]&
253 can be used after an end-of-sentence character to defeat end-of-sentence
254 detection on a per-instance basis.
255 .
256 Normally,
257 the occurrence of a visible non-end-of-sentence character
258 (as opposed to a space or tab)
259 immediately after an end-of-sentence
260 character cancels detection of the end of a sentence.
261 .
262 However,
263 the formatter treats several characters
264 .I transparently
265 after the occurrence of an end-of-sentence character\[em]it does not
266 cancel end-of-sentence status upon encountering them.
267 .
268 Such characters are often used as footnote marks
269 or to close quotations and parentheticals.
270 .
271 The default set is
272 .BR \[dq] ,
273 .BR \[aq] ,
274 .BR ) ,
275 .BR ] ,
276 .BR * ,
277 .BR \[rs][dg] ,
278 .BR \[rs][dd] ,
279 .BR \[rs][rq] ,
280 and
281 .BR \[rs][cq] .
282 .
283 The last four are examples of
284 .I special characters,
285 escape sequences whose purpose is to obtain glyphs that are not easily
286 typed at the keyboard,
287 or which have special meaning to the formatter
288 (like
289 .B \[rs]
290 itself).
291 .
292 .
293 .P
294 When an output line is nearly full,
295 it is uncommon for the next word collected from the input
296 to exactly fill it\[em]often,
297 there is room left over for only part of the next word.
298 .
299 .I Hyphenation
300 is the process of splitting a word so that it appears partially on one
301 line,
302 followed by a hyphen to indicate to the reader that the word has been
303 broken,
304 and that its remainder lies on the next.
305 .
306 Hyphenation break points can be manually specified;
307 GNU
308 .I troff
309 also uses a hyphenation algorithm and language-specific pattern files
310 (based on
311 \*[tx]'s)
312 to decide which words can be hyphenated and where.
313 .
314 Hyphenation does not always occur even when the hyphenation rules for a
315 word allow it;
316 it can be disabled,
317 and when not disabled there are several parameters that can prevent it
318 in certain circumstances.
319 .
320 .
321 .P
322 Once an output line is full,
323 the formatter places the next word
324 (or remainder of a hyphenated one)
325 on a different output line;
326 this is called a
327 .I break.
328 .
329 In this document and in
330 .I roff
331 discussions generally,
332 a \[lq]break\[rq] if not further qualified
333 always refers to the termination of an output line.
334 .
335 When the formatter is filling text,
336 it introduces breaks automatically to keep output lines from exceeding
337 the configured line length.
338 .
339 After an automatic break,
340 the formatter
341 .I adjusts
342 the line if applicable
343 (see below),
344 and then resumes collecting and filling text on the next output line.
345 .
346 .
347 .br
348 .ne 2v
349 .P
350 Sometimes,
351 a line cannot be broken automatically.
352 .
353 This usually does not happen with natural language text unless the
354 output line length has been manipulated to be extremely short,
355 but it can with specialized text like program source code.
356 .
357 .I groff
358 provides a means of telling the formatter where the line may be broken
359 without hyphens.
360 .
361 This is done with the non-printing break point escape sequence
362 .BR \[rs]: .
363 .
364 .
365 .P
366 .\" What if the document author wants to stop filling lines temporarily,
367 .\" for instance to start a new paragraph? There are several solutions.
368 There are several ways to cause a break at a predictable location.
369 .
370 A blank input line not only causes a break,
371 but by default it also outputs a one-line vertical space
372 (effectively a blank output line).
373 .
374 Macro packages may discourage or disable this \[lq]blank line
375 method\[rq] of paragraphing in favor of their own macros.
376 .
377 A line that begins with one or more spaces causes a break.
378 .
379 The spaces are output at the beginning of the next line without being
380 .I adjusted
381 (see below).
382 .
383 Again,
384 macro packages may provide other methods of producing indented
385 paragraphs.
386 .
387 Trailing spaces on
388 .I text lines
389 (see below)
390 are discarded.
391 .
392 The formatter breaks the pending output line without adjustment
393 upon encountering the end of input.
394 .
395 .
396 .P
397 After performing an automatic break,
398 the formatter may then
399 .I adjust
400 the line,
401 widening inter-word spaces until the text reaches the right margin.
402 .
403 Extra spaces between words are preserved.
404 .
405 Leading and trailing spaces are handled as noted above.
406 .
407 You can align text to the left or right margin only,
408 or center it,
409 using
410 .I requests.
411 .
412 .
413 .P
414 A
415 .I roff
416 formatter translates horizontal tab characters,
417 also called simply \[lq]tabs\[rq],
418 in the input into movements to the next tab stop.
419 .
420 Tab stops are by default located every half inch measured from the
421 drawing position corresponding to the beginning of the input line;
422 see subsection \[lq]Page geometry\[rq] below.
423 .
424 With them,
425 simple tables can be made.
426 .
427 However,
428 this method can be deceptive,
429 as the appearance
430 (and width)
431 of the text in an editor and the results from the formatter can vary
432 greatly,
433 particularly when proportional typefaces are used.
434 .
435 A tab character does not cause a break and therefore does not interrupt
436 filling.
437 .
438 The formatter provides facilities for sophisticated table composition;
439 there are many details to track
440 when using the \[lq]tab\[rq] and \[lq]field\[rq] low-level features,
441 so most users turn to the
442 .MR \%tbl 1
443 preprocessor to lay out tables.
444 .\" END Keep roughly parallel with groff.texi nodes "Text" through "Tabs
445 .\" and Leaders".
446 .
447 .
448 .\" ====================================================================
449 .SS "Requests and macros"
450 .\" ====================================================================
451 .
452 .\" BEGIN Keep roughly parallel with groff.texi node "Requests and
453 .\" Macros".
454 .\" We have now encountered almost all of the syntax there is in the
455 .\" @code{roff} language, with an exception already noted in
456 .\" passing.@footnote{The backspace character is another; see
457 .\" @ref{Page Motions}.}
458 A
459 .I request
460 is an instruction to the formatter that occurs after a
461 .I control character,
462 which is recognized at the beginning of an input line.
463 .
464 The regular control character is a dot
465 .RB \[lq] .\& \[rq].
466 .
467 Its counterpart,
468 the
469 .I no-break control character,
470 a neutral apostrophe
471 .RB \[lq] \|\[aq]\| \[rq],
472 suppresses the break
473 .\" slack wording: that is
474 implied by some requests.
475 .
476 These characters were chosen because it is uncommon for lines of text in
477 natural languages to begin with them.
478 .
479 If you require a formatted period or apostrophe
480 (closing single quotation mark)
481 where
482 the formatter expects a control character,
483 prefix the dot or neutral apostrophe
484 with the dummy character escape sequence,
485 .RB \[lq] \[rs]& \[rq].
486 .
487 .
488 .P
489 An input line beginning with a control character is called a
490 .I control line.
491 .
492 Every line of input that is not a control line is a
493 .I text line.
494 .
495 .
496 .P
497 Requests often take
498 .I arguments,
499 words
500 (separated from the request name and each other by spaces)
501 that specify details of the action you expect the formatter to perform.
502 .
503 If a request is meaningless without arguments,
504 it is typically ignored.
505 .
506 .\" TODO: We haven't introduced escape sequences yet.
507 Requests and escape sequences comprise the control language
508 of the formatter.
509 .
510 Of key importance are the requests that define macros.
511 .
512 Macros are invoked like requests,
513 enabling the request repertoire to be extended or overridden.
514 .
515 (Argument handling in macros is more flexible but also more complex.)
516 .\" @xref{Calling Macros}.
517 .
518 .
519 .P
520 A
521 .I macro
522 can be thought of as an abbreviation you can define for a
523 collection of control and text lines.
524 .
525 When the macro is
526 .I called
527 by giving its name after a control character,
528 it is replaced with what it stands for.
529 .
530 The process of textual replacement is known as
531 .I interpolation.
532 .\" @footnote{Some escape sequences undergo interpolation as well.}
533 Interpolations are handled as soon as they are recognized,
534 and once performed,
535 a
536 .I roff
537 formatter scans the replacement for further requests,
538 macro calls,
539 and escape sequences.
540 .
541 In
542 .I roff
543 systems,
544 the
545 .RB \[lq] de \[rq]
546 request defines a macro.
547 .\" @footnote{GNU @code{troff} offers additional ones. @xref{Writing
548 .\" Macros}.}
549 .\" END Keep roughly parallel with groff.texi node "Requests and
550 .\" Macros".
551 .
552 .
553 .\" ====================================================================
554 .SS "Page geometry"
555 .\" ====================================================================
556 .
557 .\" BEGIN Keep parallel with groff.texi node "Page Geometry".
558 .I roff
559 systems format text under certain assumptions about the size of the
560 output medium,
561 or page.
562 .
563 For the formatter to correctly break a line it is filling,
564 it must know the line length,
565 which it derives from the page width.
566 .\" (@pxref{Line Layout}).
567 .
568 For it to decide whether to write an output line to the current page or
569 wait until the next one,
570 it must know the page length.
571 .\" (@pxref{Page Layout}).
572 .
573 .
574 A device's
575 .I resolution
576 converts practical units like inches or centimeters to
577 .I basic units,
578 a convenient length measure for the output device or file format.
579 .
580 The formatter and output driver use basic units to reckon page
581 measurements.
582 .
583 The device description file defines its resolution and page dimensions
584 (see
585 .MR groff_font 5 ).
586 .\" (@pxref{DESC File Format}).
587 .
588 .
589 .P
590 A
591 .I page
592 is a two-dimensional structure upon which a
593 .I roff
594 system imposes a rectangular coordinate system with its its origin near
595 the upper left corner.
596 .
597 Coordinate values are in basic units and increase down and to the right.
598 Useful ones are typically positive and within numeric ranges
599 corresponding to the page boundaries.
600 .\" You could draw an arc of a circle whose center is off the page.
601 .
602 .
603 .P
604 Text is arranged on a one-dimensional lattice of text baselines from the
605 top to the bottom of the page.
606 .
607 A
608 .I "text baseline"
609 is a
610 (usually invisible)
611 line upon which the glyphs of a typeface are aligned.
612 .
613 .I "Vertical spacing"
614 is the distance between adjacent text baselines.
615 .
616 Typographic tradition sets this quantity to 120% of the type size.
617 .
618 The initial vertical drawing position is one unit of vertical spacing
619 below the page top.
620 .
621 Typographers term this unit a
622 .I vee.
623 .
624 .
625 .P
626 While the formatter
627 (and,
628 later,
629 output driver)
630 is processing a page,
631 it keeps track of its
632 .I "drawing position,"
633 which is the location at which the next glyph will be written,
634 from which the next motion will be measured,
635 or where a geometric object will commence rendering.
636 .
637 Notionally,
638 glyphs are drawn from the text baseline upward and to the right.
639 .RI ( groff
640 does not yet support right-to-left scripts.)
641 .
642 A glyph therefore \[lq]starts\[rq] at its bottom-left corner.
643 .
644 The formatter's origin is one vee below the page top
645 to prevent a glyph from lying partially or wholly off the page.
646 .
647 .
648 .P
649 Further,
650 it is conventional not to write or draw
651 at the extreme edges of the page.
652 .
653 Typesetters configure a
654 .I "page offset,"
655 a rightward shift from the left edge
656 that defines the zero point
657 from which the formatter reckons the line indentation
658 and length.
659 .
660 .RI ( groff 's
661 terminal output devices have page offsets of zero.)
662 .
663 .
664 .P
665 Combining the foregoing facts results in an origin that lies
666 at the page offset in the horizontal dimension
667 and at the text baseline (using the default vertical spacing)
668 in the vertical dimension.
669 A document can change these prior to its first written or drawn output.
670 .\" see @ref{Line Layout} and
671 .\" @ref{Manipulating Type Size and Vertical Spacing}.
672 .\" This origin isn't necessarily--and generally is not--the one used by
673 .\" the device-independent output, but that coordinate system is not
674 .\" exposed in the *roff language, though it can be expressed in
675 .\" formatter instructions that construct device-independent output
676 .\" commands (`\!`, `\X`, `.output`, `.device`).
677 .
678 .
679 .P
680 Vertical spacing has an impact on page-breaking decisions.
681 .
682 Generally,
683 when a break occurs,
684 the formatter automatically moves the drawing position
685 to the next text baseline.
686 .
687 If the formatter were already writing
688 to the last line that fits on the page,
689 advancing by one vee would place the next text baseline off the page.
690 .
691 To avoid that,
692 .I roff
693 formatters instruct the output driver to eject the page,
694 start a new one,
695 and again place the drawing position
696 at the page offset one vee below the page top;
697 this is a
698 .I "page break."
699 .
700 .
701 .P
702 When the last line of input text
703 corresponds to the last output line that fits on the page,
704 the break caused by the end of input also breaks the page,
705 producing a useless blank one.
706 .
707 Macro packages keep users from having to confront this difficulty
708 by setting \[lq]traps\[rq];
709 .\" (@pxref{Traps});
710 moreover,
711 all but the simplest page layouts tend to have headers and footers,
712 or at least bear vertical margins of at least one vee.
713 .\" END Keep parallel with groff.texi node "Page Geometry".
714 .
715 .
716 .\" ====================================================================
717 .SS "Other language elements"
718 .\" ====================================================================
719 .
720 .I Escape sequences
721 start with the
722 .I escape character,
723 a backslash
724 .BR \[rs] ,
725 and are followed by at least one additional character.
726 .
727 They can appear anywhere in the input.
728 .
729 .
730 .P
731 With requests,
732 the escape and control characters can be changed;
733 further,
734 escape sequence recognition can be turned off and back on.
735 .
736 .
737 .P
738 .I Strings
739 store character sequences.
740 .
741 In
742 .IR groff ,
743 they can be parameterized
744 (given arguments)
745 as macros can.
746 .
747 .
748 .P
749 .I Registers
750 store numerical values,
751 including measurements.
752 .
753 The latter are generally in basic units;
754 .I scaling units
755 can be appended to numeric expressions to clarify their meaning when
756 stored or interpolated.
757 .
758 Each register can be assigned a
759 .I format,
760 causing its value to interpolate with leading zeroes,
761 in Roman numerals,
762 or alphabetically.
763 .
764 Some read-only registers are string-valued,
765 meaning that they interpolate text and lack a format.
766 .
767 .
768 .P
769 .I Fonts
770 are identified either by a name or by a
771 .I "mounting position"
772 (a non-negative number).
773 .
774 Four styles are available on all devices.
775 .
776 .B R
777 is \[lq]roman\[rq]:
778 normal,
779 upright text.
780 .
781 .B B
782 is
783 .BR bold ,
784 an upright typeface with a heavier weight.
785 .
786 .B I
787 is
788 .IR italic ,
789 a face that is oblique on typesetter output devices and usually
790 underlined instead on terminal devices.
791 .
792 .B BI
793 is \f[BI]bold-italic\f[]\/, \" indulging a bit of man(7) evil here
794 combining both of the foregoing style variations.
795 .
796 Typesetting devices group these four styles into
797 .I families
798 of text fonts;
799 they also typically offer one or more
800 .I special
801 fonts that provide unstyled glyphs;
802 see
803 .MR groff_char 7 .
804 .
805 .
806 .P
807 .I groff
808 supports named
809 .I colors
810 for glyph rendering and drawing of geometric objects.
811 .
812 Stroke and fill colors are distinct;
813 the stroke color is used for glyphs.
814 .
815 .
816 .P
817 .I Glyphs
818 are visual representation forms of
819 .I characters.
820 .
821 In
822 .I groff,
823 the distinction between those two elements is not always obvious
824 (and a full discussion is beyond our scope).
825 .
826 In brief,
827 \[lq]A\[rq] is a character when we consider it in the abstract:
828 to make it a glyph,
829 we must select a typeface with which to render it,
830 and determine its type size and color.
831 .
832 The formatting process turns input characters into output glyphs.
833 .
834 A few characters commonly seen on keyboards are treated
835 specially by the
836 .I roff
837 language and may not look correct in output if used unthinkingly;
838 they are
839 the (double) quotation mark
840 .RB ( \|\[dq]\| ),
841 the neutral apostrophe
842 .RB ( \|\[aq]\| ),
843 the minus sign
844 .RB ( \- ),
845 the backslash
846 .RB ( \|\[rs]\| ),
847 the caret or circumflex accent
848 .RB ( \[ha] ),
849 the grave accent
850 .RB ( \|\[ga]\| ),
851 and the tilde
852 .RB ( \[ti] ).
853 .
854 All of these and more can be produced with
855 .I special character
856 escape sequences;
857 see
858 .MR groff_char 7 .
859 .
860 .
861 .P
862 .I groff
863 offers
864 .IR streams ,
865 identifiers for writable files,
866 but for security reasons this feature is disabled by default.
867 .
868 .
869 .\" BEGIN Keep roughly parallel with first paragraphs of groff.texi node
870 .\" "Deferring Output".
871 .P
872 A further few language elements arise as page layouts become more
873 sophisticated and demanding.
874 .
875 .I Environments
876 collect formatting parameters like line length and typeface.
877 .
878 A
879 .I diversion
880 stores formatted output for later use.
881 .
882 A
883 .I trap
884 is a condition on the input or output,
885 tested automatically by the formatter,
886 that is associated with a macro:
887 fulfilling the condition
888 .I springs
889 the trap\[em]calls the macro.
890 .
891 .
892 .P
893 Footnote support often exercises all three of the foregoing features.
894 .
895 A simple implementation might work as follows.
896 .
897 The author writes a pair of macros:
898 one starts a footnote and the other ends it.
899 .
900 They further set a trap a small distance above the page bottom,
901 reserving a footnote area.
902 .
903 The author calls the first macro where a footnote mark is desired.
904 .
905 The macro establishes a diversion so that the footnote text is collected
906 at the place in the body text where its corresponding mark appears.
907 .
908 It further creates an environment for the footnote so that it sets
909 at a smaller typeface.
910 .
911 The footnote text is formatted in the diversion using that environment,
912 but it does not yet appear in the output.
913 .
914 The document author calls the footnote end macro,
915 which returns to the previous environment and ends the diversion.
916 .
917 Later,
918 after body text nearly fills the page,
919 the trap springs.
920 .
921 The macro called by the trap draws a line across the page
922 and emits the stored diversion by calling it like a macro.
923 .
924 Thus,
925 the footnote is rendered.
926 .\" END Keep roughly parallel with first paragraphs of groff.texi node
927 .\" "Deferring Output".
928 .
929 .
930 .\" ====================================================================
931 .SH History
932 .\" ====================================================================
933 .
934 Computer-driven document formatting dates back to the 1960s.
935 .\" John Labovitz points out that Peter Samson's TJ-2 dates to 1963,
936 .\" but since this is a *roff man page, we do not begin our story there.
937 .\" https://johnlabovitz.com/publications/\
938 .\" The-electric-typesetter--The-origins-of-computing-in-typography.pdf
939 .
940 The
941 .I roff
942 system is intimately connected with Unix,
943 but its origins lie with the earlier operating systems CTSS,
944 GECOS,
945 and Multics.
946 .
947 .
948 .\" ====================================================================
949 .SS "The predecessor\[em]\f[I]RUNOFF\f[]"
950 .\" ====================================================================
951 .
952 .IR roff 's
953 ancestor
954 .I RUNOFF
955 was written in the MAD language by Jerry Saltzer
956 to prepare his Ph.D.\& thesis on the Compatible Time Sharing System
957 (CTSS),
958 a project of the Massachusetts Institute of Technology (MIT).
959 .
960 This program is referred to in full capitals,
961 both to distinguish it from its many descendants,
962 and because bits were expensive in those days;
963 five- and six-bit character encodings were still in widespread usage,
964 and mixed-case alphabetics in file names seen as a luxury.
965 .
966 .I RUNOFF
967 introduced a syntax of inlining formatting directives amid document
968 text,
969 by beginning a line with a period
970 (an unlikely occurrence in human-readable material)
971 followed by a \[lq]control word\[rq].
972 .
973 Control words with obvious meaning like \[lq].line length
974 .IR n \[rq]
975 were supported as well as an abbreviation system;
976 the latter came to overwhelm the former in popular usage and later
977 derivatives of the program.
978 .
979 A sample of control words from a
980 .UR http://\:web\:.mit\:.edu/\:Saltzer/\:www/\:publications/\:ctss/\:AH\
981 \:.9\:.01\:.html
982 .I RUNOFF
983 manual of December 1966
984 .UE
985 was documented as follows
986 (with the parameter notation slightly altered).
987 .
988 The abbreviations will be familiar to
989 .I roff
990 veterans.
991 .
992 .
993 .br
994 .if t .ne 10v
995 .if n .ne 11v
996 .P
997 .TS
998 center;
999 R L
1000 Rb L.
1001 Abbreviation Control word
1002 _
1003 \&.ad .adjust
1004 \&.bp .begin page
1005 \&.br .break
1006 \&.ce .center
1007 \&.in .indent \f[I]n\f[]
1008 \&.ll .line length \f[I]n\f[]
1009 \&.nf .nofill
1010 \&.pl .paper length \f[I]n\f[]
1011 \&.sp .space [\f[I]n\f[]]
1012 .TE
1013 .
1014 .
1015 .P
1016 In 1965,
1017 MIT's Project MAC teamed with Bell Telephone Laboratories and General
1018 Electric (GE) to inaugurate the
1019 .UR http://\:www\:.multicians\:.org
1020 Multics
1021 .UE
1022 project.
1023 .
1024 After a few years,
1025 Bell Labs discontinued its participation in Multics,
1026 famously prompting the development of Unix.
1027 .
1028 Meanwhile,
1029 Saltzer's
1030 .I RUNOFF
1031 proved influential,
1032 seeing many ports and derivations elsewhere.
1033 .
1034 .
1035 .\" "Morris did one port and called it roff. I did the BCPL one, adding
1036 .\" registers, but not macros. Molly Wagner contributed a hyphenation
1037 .\" algorithm. Ken and/or Dennis redid roff in PDP-11 assembler. Joe
1038 .\" started afresh for the grander nroff, including macros. Then Joe
1039 .\" bought a phototypesetter ..."
1040 .\" -- https://minnie.tuhs.org/pipermail/tuhs/2018-November/017052.html
1041 .P
1042 In 1969,
1043 Doug McIlroy wrote one such reimplementation,
1044 adding extensions,
1045 in the BCPL language for a GE 645 running GECOS at the Bell Labs
1046 location in Murray Hill,
1047 New Jersey.
1048 .
1049 In its manual,
1050 the control commands were termed \[lq]requests\[rq],
1051 their two-letter names were canonical,
1052 and the control character was configurable with a
1053 .B .cc
1054 request.
1055 .
1056 Other familiar requests emerged at this time;
1057 no-adjust
1058 .RB ( .na ),
1059 need
1060 .RB ( .ne ),
1061 page offset
1062 .RB ( .po ),
1063 tab configuration
1064 .RB ( .ta ,
1065 though it worked differently),
1066 temporary indent
1067 .RB ( .ti ),
1068 character translation
1069 .RB ( .tr ),
1070 and automatic underlining
1071 .RB ( .ul ;
1072 on
1073 .I RUNOFF
1074 you had to backspace and underscore in the input yourself).
1075 .B .fi
1076 to enable filling of output lines got the name it retains to this day.
1077 .
1078 McIlroy's program also featured a heuristic system for automatically
1079 placing hyphenation points,
1080 designed and implemented by Molly Wagner.
1081 .
1082 It furthermore introduced numeric variables,
1083 termed registers.
1084 .
1085 By 1971,
1086 this program had been ported to Multics and was known as
1087 .IR roff ,
1088 a name McIlroy attributes to Bob Morris,
1089 to distinguish it from CTSS
1090 .IR RUNOFF .
1091 .
1092 .\" GBR can't find a source for this claim (of Bernd's).
1093 .\"Multics
1094 .\".I runoff
1095 .\"added features such as the ability to do two-pass formatting;
1096 .\"it became the main system for Multics documentation and text
1097 .\"processing.
1098 .
1099 .
1100 .\" ====================================================================
1101 .SS "Unix and \f[I]roff\f[]"
1102 .\" ====================================================================
1103 .
1104 McIlroy's
1105 .I roff
1106 was one of the first Unix programs.
1107 .
1108 In Ritchie's term,
1109 it was \[lq]transliterated\[rq] from BCPL to DEC PDP-7 assembly language
1110 .\" see "The Evolution of the Unix Time-Sharing System", Ritchie, 1984
1111 for the fledgling Unix operating system.
1112 .
1113 Automatic hyphenation was managed with
1114 .B .hc
1115 and
1116 .B .hy
1117 requests,
1118 line spacing control was generalized with the
1119 .B .ls
1120 request,
1121 and what later
1122 .IR roff s
1123 would call diversions were available via \[lq]footnote\[rq] requests.
1124 .\" The foregoing features may have been in McIlroy's Multics roff, but
1125 .\" he no longer has documentation for that--only the GECOS version.
1126 .\" GBR's guess is that they were, if we take Ritchie's choice of the
1127 .\" term "transliterated" seriously. GBR further speculates that there
1128 .\" is no reason to suppose that McIlroy's roff was stagnant from
1129 .\" 1969-1971, whereas we have no record of any significant
1130 .\" post-transliteration development of Unix roff. Its request list did
1131 .\" not appear until the 3rd edition manual, and did not change
1132 .\" thereafter. In 7th edition, roff was characterized as "utterly
1133 .\" frozen".
1134 .
1135 This
1136 .I roff
1137 indirectly funded operating systems research at Murray Hill;
1138 AT&T prepared patent applications to the U.S.\& government with it.
1139 .
1140 This arrangement enabled the group to acquire a PDP-11;
1141 .I roff
1142 promptly proved equal to the task of formatting the manual for what
1143 would become known as \[lq]First Edition Unix\[rq],
1144 dated November 1971.
1145 .
1146 .
1147 .P
1148 Output from all of the foregoing programs was limited to line printers
1149 and paper terminals such as the IBM 2471
1150 (based on the Selectric line of typewriters)
1151 and the Teletype Corporation Model 37.
1152 .
1153 Proportionally spaced type was unavailable.
1154 .
1155 .
1156 .\" ====================================================================
1157 .SS "New \f[I]roff\f[] and Typesetter \f[I]roff\f[]"
1158 .\" ====================================================================
1159 .
1160 The first years of Unix were spent in rapid evolution.
1161 .
1162 The practicalities of preparing standardized documents like patent
1163 applications
1164 (and Unix manual pages),
1165 combined with McIlroy's enthusiasm for macro languages,
1166 perhaps created an irresistible pressure to make
1167 .I roff
1168 extensible.
1169 .
1170 Joe Ossanna's
1171 .IR nroff ,
1172 literally a \[lq]new roff\[rq],
1173 was the outlet for this pressure.
1174 .
1175 .\" nroff is listed in the table of contents of the Version 2 manual,
1176 .\" but no man page is present.
1177 By the time of Unix Version\~3
1178 (February 1973)\[em]and still in PDP-11 assembly language\[em]it sported
1179 a swath of features now considered essential to
1180 .I roff
1181 systems:
1182 .
1183 definition of macros
1184 .RB ( .de ),
1185 diversion of text thither
1186 .RB ( .di ),
1187 and removal thereof
1188 .RB ( .rm );
1189 .
1190 trap planting
1191 .RB ( .wh ;
1192 \[lq]when\[rq])
1193 and relocation
1194 .RB ( .ch ;
1195 \[lq]change\[rq]);
1196 .
1197 conditional processing
1198 .RB ( .if );
1199 .
1200 and environments
1201 .RB ( .ev ).
1202 .
1203 Incremental improvements included
1204 .
1205 assignment of the next page number
1206 .RB ( .pn );
1207 .
1208 no-space mode
1209 .RB ( .ns )
1210 and restoration of vertical spacing
1211 .RB ( .rs );
1212 .
1213 the saving
1214 .RB ( .sv )
1215 and output
1216 .RB ( .os )
1217 of vertical space;
1218 .
1219 specification of replacement characters for tabs
1220 .RB ( .tc )
1221 and leaders
1222 .RB ( .lc );
1223 .
1224 configuration of the no-break control character
1225 .RB ( .c2 );
1226 .
1227 shorthand to disable automatic hyphenation
1228 .RB ( .nh );
1229 .
1230 a condensation of what were formerly six different requests for
1231 configuration of page \[lq]titles\[rq]
1232 (headers and footers)
1233 into one
1234 .RB ( .tl )
1235 with a length controlled separately from the line length
1236 .RB ( .lt );
1237 .
1238 automatic line numbering
1239 .RB ( .nm );
1240 .
1241 interactive input
1242 .RB ( .rd ),
1243 which necessitated buffer-flushing
1244 .RB ( .fl ),
1245 and was made convenient with early program cessation
1246 .RB ( .ex );
1247 .
1248 source file inclusion in its modern form
1249 .RB ( .so ;
1250 though
1251 .I RUNOFF
1252 had an \[lq].append\[rq] control word for a similar purpose)
1253 and early advance to the next file argument
1254 .RB ( .nx );
1255 .
1256 ignorable content
1257 .RB ( .ig );
1258 .
1259 and programmable abort
1260 .RB ( .ab ).
1261 .
1262 .
1263 .P
1264 Third Edition Unix also brought the
1265 .MR pipe 2
1266 system call,
1267 the explosive growth of a componentized system based around it,
1268 and a \[lq]filter model\[rq] that remains perceptible today.
1269 .
1270 Equally importantly,
1271 the Bell Labs site in Murray Hill acquired a Graphic Systems C/A/T
1272 phototypesetter,
1273 and with it came the necessity of expanding the capabilities of a
1274 .I roff
1275 system to cope with a variety of proportionally spaced typefaces at
1276 multiple sizes.
1277 .
1278 Ossanna wrote a parallel implementation of
1279 .I nroff
1280 for the C/A/T,
1281 dubbing it
1282 .I troff
1283 (for \[lq]typesetter roff\[rq]).
1284 .
1285 Unfortunately,
1286 surviving documentation does not illustrate what requests were
1287 implemented at this time for C/A/T support;
1288 the
1289 .MR troff 1 \" AT&T
1290 man page in Fourth Edition Unix
1291 (November 1973)
1292 does not feature a request list, \" nor does Unix V6 troff(1) (1975)
1293 unlike
1294 .MR nroff 1 . \" AT&T
1295 .
1296 Apart from typesetter-driven features,
1297 Unix Version\~4
1298 .IR roff s
1299 added string definitions
1300 .RB ( .ds );
1301 made the escape character configurable
1302 .RB ( .ec );
1303 and enabled the user to write diagnostics to the standard error stream
1304 .RB ( .tm ).
1305 .
1306 Around 1974,
1307 empowered with multiple type sizes,
1308 italics,
1309 and a symbol font specially commissioned by Bell Labs from
1310 Graphic Systems,
1311 Kernighan and Lorinda Cherry implemented
1312 .I eqn \" AT&T
1313 for typesetting mathematics.
1314 .
1315 .
1316 In the same year,
1317 for Fifth Edition Unix,
1318 Ossanna combined and reimplemented the two
1319 .IR roff s
1320 in C,
1321 using that language's preprocessor to generate both from a single source
1322 tree.
1323 .
1324 .
1325 .P
1326 Ossanna documented the syntax of the input language to the
1327 .I nroff
1328 and
1329 .I troff
1330 programs in the \[lq]Troff User's Manual\[rq],
1331 first published in 1976,
1332 with further revisions as late as 1992 by Kernighan.
1333 .
1334 (The original version was entitled
1335 \[lq]Nroff/Troff User's Manual\[rq],
1336 which may partially explain why
1337 .I roff
1338 practitioners have tended to refer to it by its AT&T document
1339 identifier,
1340 \[lq]CSTR #54\[rq].)
1341 .
1342 Its final revision serves as the
1343 .I de facto
1344 specification of AT&T
1345 .IR troff , \" AT&T
1346 and all subsequent implementors of
1347 .I roff
1348 systems have done so in its shadow.
1349 .
1350 .
1351 .P
1352 A small and simple set of
1353 .I roff
1354 macros was first used for the manual pages of Unix Version\~4 and
1355 persisted for two further releases,
1356 but the first macro package to be formally described and installed was
1357 .I ms
1358 by Michael Lesk in Version\~6.
1359 .
1360 He also wrote a manual,
1361 \[lq]Typing Documents on the Unix System\[rq],
1362 describing
1363 .I ms
1364 and basic
1365 .IR nroff / troff
1366 usage,
1367 updating it as the package accrued features.
1368 .
1369 Sixth Edition (1975) additionally saw the debut of the
1370 .I tbl \" AT&T
1371 preprocessor for formatting tables,
1372 also by Lesk.
1373 .
1374 .
1375 .br
1376 .ne 3v
1377 .P
1378 For Unix Version\~7
1379 (January 1979),
1380 McIlroy designed,
1381 implemented,
1382 and documented the
1383 .I man
1384 macro package,
1385 introducing most of the macros described in
1386 .MR groff_man 7
1387 today,
1388 and edited volume 1 of the Version 7 manual using it.
1389 .
1390 Documents composed using
1391 .I ms
1392 featured in volume 2,
1393 edited by Kernighan.
1394 .
1395 .
1396 .\" Thanks to Clem Cole for the following account.
1397 .\" https://minnie.tuhs.org/pipermail/tuhs/2022-January/025143.html
1398 .P
1399 Meanwhile,
1400 .I troff
1401 proved popular even at Unix sites that lacked a C/A/T device.
1402 .
1403 Tom Ferrin of the University of California at San Francisco combined it
1404 with Allen Hershey's popular vector fonts to produce
1405 .IR vtroff ,
1406 which translated
1407 .IR troff 's
1408 output to the command language used by Versatec and Benson-Varian
1409 plotters.
1410 .
1411 .
1412 .P
1413 Ossanna had passed away unexpectedly in 1977,
1414 and after the release of Version 7,
1415 with the C/A/T typesetter becoming supplanted by alternative devices
1416 such as the Mergenthaler Linotron 202,
1417 Kernighan undertook a revision and rewrite of
1418 .I troff
1419 to generalize its design.
1420 .
1421 To implement this revised architecture,
1422 he developed the font and device description file formats and the
1423 page description language that remain in use today.
1424 .
1425 He described these novelties in the article
1426 \[lq]A Typesetter-independent TROFF\[rq],
1427 last revised in 1982,
1428 and like the
1429 .I troff
1430 manual itself,
1431 it is widely known by a shorthand,
1432 \[lq]CSTR #97\[rq].
1433 .\" Further entertaining reading can be found at:
1434 .\" <https://www.cs.princeton.edu/~bwk/202/summer.reconstructed.pdf>.
1435 .
1436 .
1437 .P
1438 Kernighan's innovations prepared
1439 .I troff
1440 well for the introduction of the Adobe PostScript language in 1982 and a
1441 vibrant market in laser printers with built-in interpreters for it.
1442 .
1443 An output driver for PostScript,
1444 .IR dpost ,
1445 was swiftly developed.
1446 .
1447 However,
1448 AT&T's software licensing practices kept
1449 Ossanna's
1450 .IR troff ,
1451 with its tight coupling to the C/A/T's capabilities,
1452 in parallel distribution with device-independent
1453 .I troff
1454 throughout the 1980s.
1455 .
1456 Today,
1457 however,
1458 all actively maintained
1459 .IR troff s
1460 follow Kernighan's device-independent design.
1461 .
1462 .
1463 .\" ====================================================================
1464 .SS "\f[I]groff\f[]\[em]a free \f[I]roff\f[] from GNU"
1465 .\" ====================================================================
1466 .
1467 The most important free
1468 .I roff
1469 project historically has been
1470 .IR groff ,
1471 the GNU implementation of
1472 .IR troff ,
1473 developed by James Clark starting in 1989 and distributed under
1474 .UR http://\:www\:.gnu\:.org/\:copyleft
1475 copyleft
1476 .UE
1477 licenses,
1478 ensuring to all the availability of source code and the freedom to
1479 modify and redistribute it,
1480 properties unprecedented in
1481 .I roff
1482 systems to that point.
1483 .
1484 .I groff
1485 rapidly attracted contributors,
1486 and has served as a replacement for almost all applications of AT&T
1487 .I troff
1488 (exceptions include
1489 .IR mv ,
1490 a macro package for preparation of viewgraphs and slides,
1491 and the
1492 .I ideal
1493 preprocessor,
1494 which produces diagrams from mathematical constraints).
1495 .
1496 Beyond that,
1497 it has added numerous features;
1498 see
1499 .MR groff_diff 7 .
1500 .
1501 Since its inception and for at least the following three decades,
1502 it has been used by practically all GNU/Linux and BSD operating systems.
1503 .
1504 .
1505 .P
1506 .I groff
1507 continues to be developed,
1508 is available for almost all operating systems in common use
1509 (along with several obscure ones),
1510 and is free.
1511 .
1512 These factors make
1513 .I groff
1514 the
1515 .I de facto
1516 .I roff
1517 standard today.
1518 .
1519 .
1520 .\" ====================================================================
1521 .SS "Other free \f[I]roff\f[]s"
1522 .\" ====================================================================
1523 .
1524 In 2007, \" TODO: verify
1525 Caldera/SCO and Sun Microsystems,
1526 having acquired rights to AT&T Unix System\~V
1527 .IR troff ,
1528 which was based on Documenter's Workbench (\[lq]DWB\[rq]) 2.0,
1529 itself a descendant of Bell Labs device-independent
1530 .IR troff ,
1531 released it under a free but GPL-incompatible license. \" CDDL
1532 .
1533 Gunnar Ritter and later Carsten Kunze then enhanced it to produce
1534 .UR https://github.com/n\-t\-roff/heirloom\-doctools
1535 Heirloom Doctools
1536 .I troff
1537 .UE .
1538 .
1539 Sometime later, \" TODO: when?
1540 AT&T Software Technology made available
1541 a subsequent revision of Documenter's Workbench
1542 .IR troff ,
1543 .UR https://\:github\:.com/\:n\-t\-roff/\:DWB3.3
1544 DWB 3.3
1545 .UE ,
1546 under yet another free but GPL-incompatible license. \" EPL
1547 .
1548 Kunze again ported the software to modern POSIX systems.
1549 .
1550 .
1551 .P
1552 .\" https://lists.gnu.org/archive/html/groff/2013-07/msg00001.html
1553 In July 2013,
1554 Ali Gholami Rudi announced
1555 .UR https://\:github\:.com/\:aligrudi/\:neatroff
1556 .I neatroff
1557 .UE ,
1558 a permissively licensed new implementation.
1559 .
1560 .
1561 .P
1562 Another descendant of DWB
1563 .I troff \" DWB
1564 is part of
1565 .UR https://\:9fans\:.github\:.io/\:plan9port/
1566 Plan\~9 from User Space
1567 .UE .
1568 .
1569 Since 2021,
1570 this
1571 .I troff \" Plan 9 from User Space
1572 has been available under permissive terms.
1573 .
1574 .
1575 .\" ====================================================================
1576 .SH "Using \f[I]roff\f[]"
1577 .\" ====================================================================
1578 .
1579 When you read a man page,
1580 often a
1581 .I roff
1582 is the program rendering it.
1583 .
1584 Some
1585 .I roff
1586 implementations provide wrapper programs that make it easy to use the
1587 .I roff
1588 system from the shell's command line.
1589 .
1590 These can be specific to a macro package,
1591 like
1592 .MR mmroff 1 ,
1593 or more general.
1594 .
1595 .MR groff 1
1596 provides command-line options sparing the user from constructing the
1597 long,
1598 order-dependent pipelines familiar to AT&T
1599 .I troff
1600 users.
1601 .
1602 Further,
1603 a heuristic program,
1604 .MR grog 1 ,
1605 is available to infer from a document's contents which
1606 .I groff
1607 arguments should be used to process it.
1608 .
1609 .
1610 .\" ====================================================================
1611 .SS "The \f[I]roff\f[] pipeline"
1612 .\" ====================================================================
1613 .
1614 A typical
1615 .I roff
1616 document is prepared by running one or more processors in series,
1617 followed by a a formatter program and then an output driver
1618 (or \[lq]device postprocessor\[rq]).
1619 .
1620 Commonly,
1621 these programs are structured into a pipeline;
1622 that is,
1623 each is run in sequence such that the output of one is
1624 taken as the input
1625 to the next,
1626 without passing through secondary storage.
1627 .
1628 (Non-Unix systems may simulate pipelines with temporary files.)
1629 .
1630 .
1631 .RS
1632 .PP
1633 .EX
1634 .RI $\~ preproc1 \~\c
1635 .BI <\~ input-file \~|\~ preproc2 \~|\~\c
1636 .RB .\|.\|.\&\~ "| troff\~"\c
1637 .RI [ option ]\~\c
1638 .RB .\|.\|.\&\~ \[rs]
1639 .BI " |\~" output-driver \" 4 leading spaces
1640 .EE
1641 .RE
1642 .
1643 .
1644 .P
1645 Once all preprocessors have run,
1646 they deliver pure
1647 .I roff
1648 language input to the formatter,
1649 which in turn generates a document in a page description language that
1650 is then interpreted by a postprocessor for viewing,
1651 printing,
1652 or further handling.
1653 .
1654 .
1655 .P
1656 Each program interprets input in a language that is independent of the
1657 others;
1658 some are purely descriptive,
1659 as with
1660 .MR \%tbl 1
1661 and
1662 .I roff
1663 output,
1664 and some permit the definition of macros,
1665 as with
1666 .MR \%eqn 1
1667 and
1668 .I roff
1669 input.
1670 .
1671 .
1672 Most
1673 .I roff
1674 input employs the macros of a document formatting package,
1675 intermixed with instructions for one or more preprocessors,
1676 and is seasoned with escape sequences and requests from the
1677 .I roff
1678 language.
1679 .
1680 Some documents are simpler still,
1681 since their formatting packages discourage direct use of
1682 .I roff
1683 requests;
1684 man pages are a prominent example.
1685 .
1686 Many features of the
1687 .I roff
1688 language are seldom needed by users;
1689 only authors of macro packages require a substantial command of them.
1690 .
1691 .
1692 .\" ====================================================================
1693 .SS Preprocessors
1694 .\" ====================================================================
1695 .
1696 A
1697 .I roff
1698 preprocessor is a program that,
1699 directly or ultimately,
1700 generates output in the
1701 .I roff
1702 language.
1703 .
1704 Typically, \" preconv is an exception.
1705 each preprocessor defines a language of its own that transforms its
1706 input into that for
1707 .I roff
1708 or another preprocessor.
1709 .
1710 As an example of the latter,
1711 .I chem \" generic
1712 produces
1713 .I pic \" generic
1714 input.
1715 .
1716 Preprocessors must consequently be run in an appropriate order;
1717 .MR groff 1
1718 handles this automatically for all preprocessors supplied by the GNU
1719 .I roff
1720 system.
1721 .
1722 .
1723 .P
1724 Portions of the document written in preprocessor languages are usually
1725 .\" preconv is the exception again.
1726 bracketed by tokens that look like
1727 .I roff
1728 macro calls.
1729 .
1730 .I roff
1731 preprocessor programs transform only the regions of the document
1732 intended for them.
1733 .\" In preconv's case, that's the whole document.
1734 .
1735 When a preprocessor language is used by a document,
1736 its corresponding program must process it before the input is seen by
1737 the formatter,
1738 or incorrect rendering is almost guaranteed.
1739 .
1740 .
1741 .P
1742 GNU
1743 .I roff
1744 provides several preprocessors,
1745 including
1746 .IR \%eqn ,
1747 .IR \%grn ,
1748 .IR \%pic ,
1749 .IR \%tbl ,
1750 .IR \%refer ,
1751 and
1752 .IR \%soelim .
1753 .
1754 See
1755 .MR groff 1
1756 for a complete list.
1757 .
1758 Other preprocessors for
1759 .I roff
1760 systems are known.
1761 .
1762 .
1763 .P
1764 .RS
1765 .TS
1766 tab (@);
1767 Li L.
1768 dformat@depicts data structures;
1769 grap@constructs statistical charts; and
1770 ideal@draws diagrams using a constraint-based language.
1771 .TE
1772 .RE
1773 .
1774 .
1775 .\" ====================================================================
1776 .SS "Formatter programs"
1777 .\" ====================================================================
1778 .
1779 A
1780 .I roff
1781 formatter transforms
1782 .I roff
1783 language input into a single file in a page description language,
1784 described in
1785 .MR groff_out 5 ,
1786 intended for processing by a selected device.
1787 .
1788 This page description language is specialized in its parameters,
1789 but not its syntax,
1790 for the selected device;
1791 the format is
1792 .RI device- independent ,
1793 but not
1794 .RI device- agnostic .
1795 .
1796 The parameters the formatter uses to arrange the document are stored in
1797 .I device
1798 and
1799 .IR "font description files" ;
1800 see
1801 .MR groff_font 5 .
1802 .
1803 .
1804 .P
1805 AT&T Unix
1806 had two formatters\[em]\c
1807 .I nroff
1808 for terminals,
1809 and
1810 .I troff
1811 for typesetters.
1812 .
1813 Often,
1814 the name
1815 .I troff
1816 is used loosely to refer to both.
1817 .
1818 When generalizing thus,
1819 .I groff
1820 documentation prefers the term
1821 .RI \[lq] roff \[rq].
1822 .
1823 In GNU
1824 .IR roff ,
1825 the formatter program is always
1826 .MR \%troff 1 .
1827 .
1828 .
1829 .\" ====================================================================
1830 .SS "Devices and output drivers"
1831 .\" ====================================================================
1832 .
1833 To a
1834 .I roff
1835 system,
1836 a
1837 .I device
1838 is a hardware interface like a printer,
1839 a text or graphical terminal,
1840 or a standardized file format that unrelated software can interpret.
1841 .
1842 An
1843 .I output driver
1844 is a program that parses the output of
1845 .I troff \" generic
1846 and produces instructions or markup
1847 specific to the device or file format it supports.
1848 .
1849 An output driver might support multiple devices,
1850 particularly if they are similar.
1851 .
1852 .
1853 .P
1854 The names of the devices and their driver programs are not standardized.
1855 .
1856 Technological fashions evolve;
1857 the devices popular for document preparation when AT&T
1858 .I troff \" AT&T
1859 was first written in the 1970s are no longer used in production
1860 environments.
1861 .
1862 Device capabilities have tended to increase,
1863 improving resolution and font repertoire,
1864 and adding color output and hyperlinking.
1865 .
1866 Further,
1867 to reduce file size and processing time,
1868 AT&T
1869 .IR troff 's \" AT&T
1870 page description language placed low limits on the magnitudes of some
1871 quantities it could represent.
1872 .
1873 Its PostScript output driver,
1874 .MR dpost 1 ,
1875 had a resolution of 720 units per inch;
1876 .IR groff 's
1877 .MR grops 1
1878 uses 72,000.
1879 .
1880 .
1881 .\".P
1882 .\"Today the operating systems provide device drivers for most
1883 .\"printer-like hardware, so it isn't necessary to write a special
1884 .\"hardware postprocessor for each printer.
1885 .\" XXX? No they don't. Instead printers interpret PS or PDF directly.
1886 .\" With a TCP/IP protocol stack and an HTTP server to accept POSTed
1887 .\" documents for printing.
1888 .
1889 .
1890 .\" ====================================================================
1891 .SH "\f[I]roff\f[] programming"
1892 .\" ====================================================================
1893 .
1894 Documents using
1895 .I roff
1896 are normal text files interleaved with
1897 .I roff
1898 formatting elements.
1899 .
1900 The
1901 .I roff
1902 language is powerful enough to support arbitrary computation and
1903 it supplies facilities that encourage extension.
1904 .
1905 The primary such facility is macro definition;
1906 with this feature,
1907 macro packages have been developed that are tailored for particular
1908 applications.
1909 .
1910 .
1911 .\" ====================================================================
1912 .SS "Macro packages"
1913 .\" ====================================================================
1914 .
1915 Macro packages can have a much smaller vocabulary than
1916 .I roff
1917 itself;
1918 this trait combined with their domain-specific nature can make them easy
1919 to acquire and master.
1920 .
1921 The implementation of a package
1922 .I name
1923 is typically kept in a file called
1924 .RI \[lq]name .tmac \[rq]
1925 (historically,
1926 .RI \[lq] tmac. name\[rq]).
1927 .
1928 Find details on the naming and placement of macro packages in
1929 .MR groff_tmac 5 .
1930 .
1931 .
1932 .P
1933 A macro package anticipated for use in a document can be declared to
1934 the formatter by the command-line option
1935 .BR \-m ;
1936 see
1937 .MR \%troff 1 .
1938 .
1939 It can alternatively be specified within a document using the
1940 .B mso
1941 request of the
1942 .I groff
1943 language;
1944 see
1945 .MR groff 7 .
1946 .
1947 .
1948 .P
1949 Well-known packages include
1950 .I man
1951 for traditional man pages and
1952 .I mdoc
1953 for BSD-style manual pages.
1954 .
1955 Packages for typesetting books,
1956 articles,
1957 and letters include
1958 .I ms
1959 (from \[lq]manuscript macros\[rq]),
1960 .I me
1961 (named by a system administrator from the first name of its creator,
1962 Eric Allman),
1963 .I mm
1964 (from \[lq]memorandum macros\[rq]),
1965 and
1966 .IR mom ,
1967 a punningly named package exercising many
1968 .I groff
1969 extensions.
1970 .
1971 See
1972 .MR groff_tmac 5
1973 for more.
1974 .
1975 .
1976 .\" ====================================================================
1977 .SS "The \f[I]roff\f[] formatting language"
1978 .\" ====================================================================
1979 .
1980 .\" TODO: Integrate this subsection with subsection "Other language
1981 .\" elements".
1982 The
1983 .I roff
1984 language provides requests,
1985 escape sequences,
1986 macro definition facilities,
1987 string variables,
1988 registers for storage of numbers or dimensions,
1989 and control of execution flow.
1990 .
1991 The theoretically minded will observe that a
1992 .I roff
1993 is not a mere markup language,
1994 but Turing-complete.
1995 .
1996 It has storage
1997 (registers),
1998 it can perform tests
1999 (as in conditional expressions like
2000 .RB \[lq] "(\[rs]n[i] >= 1)" \[rq]),
2001 its
2002 .\" Kerning between bold "i" and "f" and roman \[lq], \[rq] is tight.
2003 .RB \[lq] \|if\| \[rq]
2004 and related requests alter the flow of control,
2005 and macro definition permits unbounded recursion.
2006 .
2007 .
2008 .P
2009 .I Requests
2010 and
2011 .I escape sequences
2012 are instructions,
2013 predefined parts of the language,
2014 that perform formatting operations,
2015 interpolate stored material,
2016 or otherwise change the state of the parser.
2017 .
2018 The user can define their own request-like elements by composing
2019 together text,
2020 requests,
2021 and escape sequences
2022 .I "ad libitum."
2023 .
2024 .
2025 A document writer will not (usually) note any difference in usage for
2026 requests or macros;
2027 both are found on control lines.
2028 .
2029 However,
2030 there is a distinction;
2031 requests take either a fixed number of arguments
2032 (sometimes zero),
2033 silently ignoring any excess,
2034 or consume the rest of the input line,
2035 whereas macros can take a variable number of arguments.
2036 .
2037 Since arguments are separated by spaces,
2038 macros require a means of embedding a space in an argument;
2039 in other words,
2040 of quoting it.
2041 .
2042 This then demands a mechanism of embedding the quoting character itself,
2043 in case
2044 .I it
2045 is needed literally in a macro argument.
2046 .
2047 AT&T
2048 .I troff
2049 had complex rules involving the placement and repetition of the double
2050 quote to achieve both aims.
2051 .
2052 .I groff
2053 cuts this knot by supporting a special character escape sequence for the
2054 neutral double quote,
2055 .\" The kerning between a roman \[lq] and a bold backslash is tight.
2056 .RB \[lq] \|\[rs][dq] \[rq],
2057 which never performs quoting in the typesetting language,
2058 but is simply a glyph,
2059 .RB \[oq] \[dq] \[cq].
2060 .
2061 .
2062 .P
2063 .I Escape sequences
2064 start with a backslash,
2065 .RB \[lq] \|\[rs] \[rq].
2066 .
2067 They can appear almost anywhere,
2068 even in the midst of text on a line,
2069 and implement various features,
2070 including the insertion of special characters with
2071 .RB \[lq] \|\[rs](\f[BI]xx\f[] \[rq]
2072 or
2073 .RB \[lq] \|\[rs][\f[BI]xxx\f[]] \[rq],
2074 break suppression at input line endings with
2075 .RB \[lq] \|\[rs]c \[rq],
2076 font changes with
2077 .RB \[lq] \|\[rs]f\| \[rq],
2078 type size changes with
2079 .RB \[lq] \|\[rs]s \[rq],
2080 in-line comments with
2081 .RB \[lq] \|\[rs]\[dq] \[rq],
2082 and many others.
2083 .
2084 .
2085 .P
2086 .I Strings
2087 store text.
2088 .
2089 They are populated with the
2090 .B ds
2091 request and interpolated using the
2092 .B \[rs]*
2093 escape sequence.
2094 .
2095 .
2096 .P
2097 .I Registers
2098 store numbers and measurements.
2099 .
2100 A register can be set with the request
2101 .B nr
2102 and its value can be retrieved by the escape sequence
2103 .BR "\[rs]n" .
2104 .
2105 .
2106 .\" ====================================================================
2107 .SH "File naming conventions"
2108 .\" ====================================================================
2109 .
2110 The structure or content of a file name,
2111 beyond its location in the file system,
2112 is not significant to
2113 .I roff
2114 tools.
2115 .
2116 .I roff
2117 documents employing \[lq]full-service\[rq] macro packages
2118 (see
2119 .MR groff_tmac 5 )
2120 tend to be named with a suffix identifying the package;
2121 we thus see file names ending in
2122 .IR .man ,
2123 .IR .ms ,
2124 .IR .me ,
2125 .IR .mm ,
2126 and
2127 .IR .mom ,
2128 for instance.
2129 .
2130 When installed,
2131 man pages tend to be named with the manual's section number as the
2132 suffix.
2133 .
2134 For example,
2135 the file name for this document is
2136 .IR roff.7 .
2137 .
2138 Practice for
2139 \[lq]raw\[rq]
2140 .I roff
2141 documents is less consistent;
2142 they
2143 are sometimes seen with a
2144 .I .t
2145 suffix.
2146 .
2147 .
2148 .\" BEGIN Keep parallel with groff.texi node "Input Conventions".
2149 .\" ====================================================================
2150 .SH "Input conventions"
2151 .\" ====================================================================
2152 .
2153 Since a
2154 .I roff
2155 formatter fills text automatically,
2156 its experienced users tend to avoid visual composition
2157 of text in input files:
2158 the esthetic appeal of the formatted output is what matters.
2159 .
2160 Therefore,
2161 .I roff
2162 input should be arranged such that it is easy for authors and
2163 maintainers to compose and develop the document,
2164 understand the syntax of
2165 .I roff
2166 requests,
2167 macro calls,
2168 and preprocessor languages used,
2169 and predict the behavior of the formatter.
2170 .
2171 Several traditions have accrued in service of these goals.
2172 .
2173 .
2174 .IP \[bu] 3n
2175 Follow sentence endings in the input with newlines to ease their
2176 recognition.
2177 .\" Texinfo: (@pxref{Sentences}).
2178 It is frequently convenient to end text lines after colons and
2179 semicolons as well,
2180 as these typically precede independent clauses.
2181 .
2182 Consider doing so after commas;
2183 they often occur in lists that become easy to scan when itemized by
2184 line,
2185 or constitute supplements to the sentence that are added,
2186 deleted,
2187 or updated to clarify it.
2188 .
2189 Parenthetical and quoted phrases are also good candidates for placement
2190 on text lines by themselves.
2191 .
2192 .
2193 .IP \[bu]
2194 Set your text editor's line length to 72 characters or fewer;
2195 see the subsections below.
2196 .\" Texinfo:
2197 .\" @footnote{Emacs: @code{fill-column: 72}; Vim: @code{textwidth=72}}
2198 .
2199 This limit,
2200 combined with the previous item of advice,
2201 makes it less common that an input line will wrap in your text editor,
2202 and thus will help you perceive excessively long constructions in your
2203 text.
2204 .
2205 Recall that natural languages originate in speech,
2206 not writing,
2207 and that punctuation is correlated with pauses for breathing and changes
2208 in prosody.
2209 .
2210 .
2211 .IP \[bu]
2212 Use
2213 .B \[rs]&
2214 after
2215 .RB \[lq] !\& \[rq],
2216 .RB \[lq] ?\& \[rq],
2217 and
2218 .RB \[lq] .\& \[rq]
2219 if they are followed by space or newline characters
2220 and don't end a sentence.
2221 .
2222 .
2223 .IP \[bu]
2224 In filled text lines,
2225 use
2226 .B \[rs]&
2227 before
2228 .RB \[lq] .\& \[rq]
2229 and
2230 .RB \[lq] \[aq] \[rq]
2231 if they are preceded by space,
2232 so that revisions to the input don't turn them into control lines.
2233 .
2234 .
2235 .IP \[bu]
2236 Do not use spaces to perform indentation or align columns of a table.
2237 Leading spaces are reliable when text is not being filled.
2238 .
2239 (Exception:
2240 when laying out a table with
2241 GNU
2242 .IR tbl , \" GNU
2243 specifying the
2244 .B \%nospaces
2245 region option
2246 causes the program to ignore spaces at the boundaries of table cells.)
2247 .
2248 .
2249 .IP \[bu]
2250 Comment your document.
2251 .
2252 It is never too soon to apply comments
2253 to record information of use to future document maintainers
2254 (including your future self).
2255 .\" Texinfo: We thus introduce another escape sequence, @code{\"}, which
2256 The
2257 .B \[rs]\[dq]
2258 escape sequence
2259 causes the formatter to ignore the remainder of the input line.
2260 .
2261 .
2262 .IP \[bu]
2263 Use the empty request\[em]a control character followed immediately by a
2264 newline\[em]to visually manage separation of material in the input.
2265 .
2266 Many of the
2267 .I groff
2268 project's own documents use an empty request between sentences,
2269 after macro definitions,
2270 and where a break is expected,
2271 and two empty requests between paragraphs or other requests or macro
2272 calls that will introduce vertical space into the document.
2273 .
2274 You can combine the empty request with the comment escape sequence to
2275 include whole-line comments in your document,
2276 and even \[lq]comment out\[rq] sections of it.
2277 .
2278 .
2279 .P
2280 .\" Texinfo: We conclude this section with an example
2281 An example sufficiently long to illustrate most of the above suggestions
2282 in practice follows.
2283 .
2284 .\" Texinfo: For the purpose of fitting the example between the margins
2285 .\" of this manual with the font used for its typeset version,
2286 .\" we have shortened the input line length to 56
2287 .\" columns.
2288 .\" Texinfo: As before,
2289 .
2290 An arrow \[->] indicates a tab character.
2291 .
2292 .
2293 .P
2294 .RS
2295 .EX
2296 \&.\[rs]" nroff this_file.roff | less
2297 \&.\[rs]" groff \-T ps this_file.roff > this_file.ps
2298 \[->]The theory of relativity is intimately connected with
2299 the theory of space and time.
2300 \&.
2301 I shall therefore begin with a brief investigation of
2302 the origin of our ideas of space and time,
2303 although in doing so I know that I introduce a
2304 controversial subject.\& \[rs]" remainder of paragraph elided
2305 \&.
2306 .ne 3v \" Don't let a page break hide the blank line from the reader.
2307 \&.
2308 \&
2309 \[->]The experiences of an individual appear to us arranged
2310 in a series of events;
2311 in this series the single events which we remember
2312 appear to be ordered according to the criterion of
2313 \[rs][lq]earlier\[rs][rq] and \[rs][lq]later\[rs][rq], \[rs]" punct \
2314 swapped
2315 which cannot be analysed further.
2316 \&.
2317 There exists,
2318 therefore,
2319 for the individual,
2320 an I\-time,
2321 or subjective time.
2322 \&.
2323 This itself is not measurable.
2324 \&.
2325 I can,
2326 indeed,
2327 associate numbers with the events,
2328 in such a way that the greater number is associated with
2329 the later event than with an earlier one;
2330 but the nature of this association may be quite
2331 arbitrary.
2332 \&.
2333 This association I can define by means of a clock by
2334 comparing the order of events furnished by the clock
2335 with the order of a given series of events.
2336 \&.
2337 We understand by a clock something which provides a
2338 series of events which can be counted,
2339 and which has other properties of which we shall speak
2340 later.
2341 \&.\[rs]" Albert Einstein, _The Meaning of Relativity_, 1922
2342 .EE
2343 .RE
2344 .\" END Keep parallel with groff.texi node "Input Conventions".
2345 .
2346 .
2347 .\" ====================================================================
2348 .SS "Editing with Emacs"
2349 .\" ====================================================================
2350 .
2351 Official GNU doctrine holds that the best program for editing a
2352 .I roff
2353 document is Emacs; see
2354 .MR emacs 1 .
2355 .
2356 It provides an
2357 .I nroff
2358 major mode that is suitable for all kinds of
2359 .I roff
2360 dialects.
2361 .
2362 This mode can be activated by the following methods.
2363 .
2364 .
2365 .P
2366 When editing a file within Emacs the mode can be changed by typing
2367 .RI \[lq] M-x
2368 .BR nroff\-mode \[rq],
2369 where
2370 .I M-x
2371 means to hold down the meta key
2372 (often labelled \[lq]Alt\[rq])
2373 while pressing and releasing the \[lq]x\[rq] key.
2374 .\" Why is this sort of thing not in intro(1)?
2375 .
2376 .
2377 .P
2378 It is also possible to have the mode automatically selected when a
2379 .I roff
2380 file is loaded into the editor.
2381 .
2382 .
2383 .IP \[bu] 3n
2384 The most general approach includes file-local variables at the end of
2385 the file;
2386 we can also configure the fill column this way.
2387 .
2388 .
2389 .RS
2390 .RS
2391 .EX
2392 \&.\[rs]" Local Variables:
2393 \&.\[rs]" fill\-column: 72
2394 \&.\[rs]" mode: nroff
2395 \&.\[rs]" End:
2396 .EE
2397 .RE
2398 .RE
2399 .
2400 .
2401 .IP \[bu]
2402 Certain file name extensions,
2403 like those often
2404 used by man pages,
2405 activate
2406 .I nroff
2407 mode automatically.
2408 .
2409 .
2410 .br
2411 .ne 3v
2412 .IP \[bu]
2413 Loading a file with the sequence
2414 .
2415 .RS
2416 .RS
2417 .EX
2418 \&.\[rs]" \%\-*\- nroff \-*\-
2419 .EE
2420 .RE
2421 .
2422 in its first line into an Emacs buffer causes the editor to enter its
2423 .I nroff
2424 major mode.
2425 .
2426 Unfortunately,
2427 some implementations of the
2428 .MR man 1
2429 program are confused by this practice,
2430 so we discourage it.
2431 .RE
2432 .
2433 .
2434 .\" ====================================================================
2435 .SS "Editing with Vim"
2436 .\" ====================================================================
2437 .
2438 .\" TODO: elvis, vile. Nvi does not support highlighting at all, and
2439 .\" gedit does but has no rules for roff yet. Other editors TBD.
2440 Other editors provide support for
2441 .IR roff -style
2442 files too,
2443 such as
2444 .MR vim 1 ,
2445 an extension of the
2446 .MR vi 1
2447 program.
2448 .
2449 Vim's highlighting can be made to recognize
2450 .I roff
2451 files by setting the
2452 .B filetype
2453 option in a Vim
2454 .IR modeline .
2455 .
2456 For this feature to work,
2457 your copy of
2458 .I vim
2459 must be built with support for,
2460 and configured to enable,
2461 several features;
2462 consult the editor's online help topics
2463 \[lq]auto\-setting\[rq],
2464 \[lq]filetype\[rq],
2465 and \[lq]syntax\[rq].
2466 .
2467 Then put the following at the end of your
2468 .I roff
2469 files,
2470 after any Emacs configuration.
2471 .\" ...because Emacs pattern-matches against 3000 bytes from the end of
2472 .\" the buffer [or until hitting a 0x0C (FF, form-feed control)] for
2473 .\" "Local Variables:", but Vim only checks as many lines as its
2474 .\" 'modelines' variable tells it to. A common default is "5", but
2475 .\" Emacs settings can be longer than that.
2476 .
2477 .
2478 .RS
2479 .IP
2480 .EX
2481 \&.\[rs]" vim: set filetype=groff textwidth=72:
2482 .EE
2483 .RE
2484 .
2485 .
2486 .P
2487 Replace \[lq]groff\[rq] in the above with \[lq]nroff\[rq] if you want
2488 highlighting that does
2489 .I not
2490 recognize many of the GNU extensions to
2491 .IR roff ,
2492 such as request,
2493 register,
2494 and string names longer than two characters.
2495 .
2496 .
2497 .\" ====================================================================
2498 .SH Authors
2499 .\" ====================================================================
2500 .
2501 This document was written by
2502 .MT groff\-bernd\:.warken\-72@\:web\:.de
2503 Bernd Warken
2504 .ME
2505 and
2506 .MT g.branden\:.robinson@\:gmail\:.com
2507 G.\& Branden Robinson
2508 .ME .
2509 .
2510 .
2511 .\" ====================================================================
2512 .SH "See also"
2513 .\" ====================================================================
2514 .
2515 Much
2516 .I roff
2517 documentation is available.
2518 .
2519 The Bell Labs papers describing AT&T
2520 .I troff
2521 remain available,
2522 and
2523 .I groff
2524 is documented comprehensively. \" ...one hopes.
2525 .
2526 .
2527 .\" ====================================================================
2528 .SS "Internet sites"
2529 .\" ====================================================================
2530 .
2531 .P
2532 .UR https://\:github\:.com/\:larrykollar/\:Unix\-Text\-Processing
2533 .I Unix Text Processing
2534 .UE ,
2535 by Dale Dougherty and Tim O'Reilly,
2536 1987,
2537 Hayden Books.
2538 .
2539 This well-regarded text brings the reader from a state of no knowledge
2540 of Unix or text editing
2541 (if necessary)
2542 to sophisticated computer-aided typesetting.
2543 .
2544 It has been placed under a free software license by its authors and
2545 updated by a team of
2546 .I groff
2547 contributors and enthusiasts.
2548 .
2549 .
2550 .P
2551 .UR http://\:manpages\:.bsd\:.lv/\:history\:.html
2552 \[lq]History of Unix Manpages\[rq]
2553 .UE ,
2554 an online article maintained by the mdocml project,
2555 provides an overview of
2556 .I roff
2557 development from Saltzer's
2558 .I RUNOFF
2559 to 2008,
2560 with links to original documentation and recollections of the authors
2561 and their contemporaries.
2562 .
2563 .
2564 .P
2565 .UR http://\:www\:.troff\:.org/
2566 troff.org
2567 .UE ,
2568 Ralph Corderoy's
2569 .I troff
2570 site,
2571 provides an overview and pointers to much historical
2572 .I roff
2573 information.
2574 .
2575 .
2576 .P
2577 .UR http://\:www\:.multicians\:.org/
2578 Multicians
2579 .UE ,
2580 a site by Multics enthusiasts,
2581 contains a lot of information on the MIT projects CTSS and Multics,
2582 including
2583 .IR RUNOFF ;
2584 it is especially useful for its glossary and the many links to
2585 historical documents.
2586 .
2587 .
2588 .P
2589 .UR http://\:www\:.tuhs\:.org/\:Archive/
2590 The Unix Archive
2591 .UE ,
2592 curated by the Unix Heritage Society,
2593 provides the source code and some binaries of historical Unices
2594 (including the source code of some versions of
2595 .I troff
2596 and its documentation)
2597 contributed by their copyright holders.
2598 .
2599 .
2600 .P
2601 .UR http://\:web\:.mit\:.edu/\:Saltzer/\:www/\:publications/\
2602 \:pubs\:.html
2603 Jerry Saltzer's home page
2604 .UE
2605 stores some documents using the original
2606 .I RUNOFF
2607 formatting language.
2608 .
2609 .
2610 .P
2611 .UR http://\:www\:.gnu\:.org/\:software/\:groff
2612 .I groff
2613 .UE ,
2614 GNU
2615 .IR roff 's
2616 web site,
2617 provides convenient access to
2618 .IR groff 's
2619 source code repository,
2620 bug tracker,
2621 and mailing lists
2622 (including archives and the subscription interface).
2623 .
2624 .
2625 .\" ====================================================================
2626 .SS "Historical \f[I]roff\f[] documentation"
2627 .\" ====================================================================
2628 .
2629 Many AT&T
2630 .I troff
2631 documents are available online,
2632 and can be found at Ralph Corderoy's site
2633 (see above)
2634 or via Internet search.
2635 .
2636 Of foremost significance are those describing the language and its
2637 device-independent implementation.
2638 .
2639 .
2640 .P
2641 \[lq]Troff User's Manual\[rq]
2642 by Joseph F.\& Ossanna,
2643 1976
2644 (revised by Brian W.\& Kernighan,
2645 1992),
2646 AT&T Bell Laboratories Computing Science Technical Report No.\& 54.
2647 .
2648 .
2649 .P
2650 \[lq]A Typesetter-independent TROFF\[rq]
2651 by Brian W.\& Kernighan,
2652 1982,
2653 AT&T Bell Laboratories Computing Science Technical Report No.\& 97.
2654 .
2655 .
2656 .P
2657 You can obtain many relevant Bell Labs papers in PDF from
2658 .UR https://\:github\:.com/\:bwarken/\:roff_classical\:.git
2659 Bernd Warken's
2660 \[lq]roff classical\[rq]
2661 GitHub repository
2662 .UE .
2663 .
2664 .
2665 .\" ====================================================================
2666 .SS "Manual pages"
2667 .\" ====================================================================
2668 .
2669 A componentized system like
2670 .I roff
2671 potentially has many man pages,
2672 each describing an aspect of it.
2673 .
2674 Unfortunately,
2675 there is no consistent naming scheme for these pages among the various
2676 implementations.
2677 .
2678 .
2679 .P
2680 In GNU
2681 .IR roff ,
2682 the
2683 .MR groff 1
2684 man page enumerates all man pages distributed with the system,
2685 and individual pages frequently refer to external resources as well as
2686 manuals on a variety of topics
2687 imbricated with
2688 .IR groff .
2689 .
2690 .
2691 .P
2692 In other
2693 .IR roff s,
2694 you are on your own,
2695 but
2696 .MR troff 1 \" foreign troff
2697 might be a good starting point.
2698 .
2699 .
2700 .\" Clean up.
2701 .rm tx
2702 .
2703 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
2704 .cp \n[*groff_roff_7_man_C]
2705 .do rr *groff_roff_7_man_C
2706 .
2707 .
2708 .\" Local Variables:
2709 .\" fill-column: 72
2710 .\" mode: nroff
2711 .\" End:
2712 .\" vim: set filetype=groff textwidth=72: