3 .\" Copyright (C) Caldera International Inc. 2001-2002.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code and documentation must retain the above
10 .\" copyright notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed or owned by Caldera
17 .\" International, Inc.
18 .\" 4. Neither the name of Caldera International, Inc. nor the names of other
19 .\" contributors may be used to endorse or promote products derived from
20 .\" this software without specific prior written permission.
22 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 .\" IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
27 .\" INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 .\" POSSIBILITY OF SUCH DAMAGE.
35 .\" @(#)ms 8.2 (Berkeley) 6/1/94
41 .EH 'USD:17-%''Using the \-ms Macros with Troff and Nroff'
42 .OH 'Using the \-ms Macros with Troff and Nroff''USD:17-%'
44 .\" ....TM 76-1274-16 39199 39199-11
45 .\" ....ND October 8, 1976
49 Typing Documents on the UNIX System:
52 Using the \-ms Macros with Troff and Nroff
61 This document describes a set of easy-to-use macros
62 for preparing documents on the UNIX system.
63 Documents may be produced on either the
64 phototypesetter or on a computer terminal,
65 without changing the input.
67 The macros provide facilities for paragraphs, sections (optionally
68 with automatic numbering), page titles, footnotes,
70 tables, two-column format, and
71 cover pages for papers.
73 This memo includes, as an appendix,
74 the text of the ``Guide to Preparing
76 which contains additional examples
79 This manual is a revision of, and replaces,
80 ``Typing Documents on UNIX,''
81 dated November 22, 1974.
89 This memorandum describes a package of commands to produce
98 formatting programs on the
106 text is prepared interspersed with formatting commands.
107 However, this package,
108 which itself is written in
111 provides higher-level commands
112 than those provided with the basic
115 The commands available in this package are listed in
122 Type normally, except that instead of indenting for paragraphs,
123 place a line reading ``.PP'' before each paragraph.
124 This will produce indenting and extra space.
126 Alternatively, the command .LP that was used here will produce
127 a left-aligned (block) paragraph.
128 The paragraph spacing can be changed: see below under ``Registers.''
133 For a document with a paper-type cover sheet, the input should start as follows:
135 [optional overall format .RP \- see below]
137 Title of document (one or more lines)
139 Author(s) (may also be several lines)
141 Author's institution(s)
143 Abstract; to be placed on the cover sheet of a paper.
144 Line length is 5/6 of normal; use .ll here to change.
146 text ... (begins with .PP, which see)
148 To omit some of the standard headings
149 (e.g. no abstract, or no author's institution) just
150 omit the corresponding fields and command lines.
155 can be suppressed by writing ``.AB no'' for ``.AB''.
156 Several interspersed .AU and .AI lines can be used for multiple authors.
157 The headings are not compulsory: beginning
158 with a .PP command is perfectly OK and will just
159 start printing an ordinary paragraph.
161 You can't just begin a document with a line of text.
162 Some \-ms command must
163 precede any text input. When in doubt, use .LP
164 to get proper initialization, although any of
165 the commands .PP, .LP, .TL, .SH, .NH is good enough.
166 Figure 1 shows the legal arrangement of commands at the
170 Cover Sheets and First Pages.
173 of a document signals the general format of the first page.
174 In particular, if it is ".RP" a cover sheet with title and
175 abstract is prepared.
177 is useful for scanning drafts.
179 In general \-ms is arranged so that only one form
180 of a document need be stored, containing all
181 information; the first command gives the format,
182 and unnecessary items for that format are ignored.
184 Warning: don't put extraneous material
185 between the .TL and .AE commands. Processing
186 of the titling items is
187 special, and other data placed in them may not behave
189 Don't forget that some \-ms command must precede any input text.
194 The \-ms macros, by default, will print a page heading containing
195 a page number (if greater than 1).
196 A default page footer is provided only in
198 where the date is used.
199 The user can make minor adjustments to the page headings/footings
203 which are the left, center and right portions of the page headings,
204 respectively; and the
207 which are the left, center and right portions of the page footer.
208 For more complex formats, the user can redefine
209 the macros PT and BT, which are invoked respectively at the top
210 and bottom of each page.
211 The margins (taken from registers HM and FM for the top and bottom
212 margin respectively) are normally 1 inch; the page header/footer are
213 in the middle of that space.
214 The user who redefines these macros should be careful
215 not to change parameters such as point size or font
216 without resetting them to default values.
219 Multi-column formats.
221 If you place the command ``.2C'' in your document, the document will
222 be printed in double column format beginning
223 at that point. This feature is not too useful in computer
224 terminal output, but is often desirable on the typesetter.
225 The command ``.1C'' will go
226 back to one-column format and also skip to a new page.
227 The ``.2C'' command is actually a special case of the command
229 .MC [column width [gutter width]]
231 which makes multiple columns with the specified column
232 and gutter width; as many columns as will fit across the page
234 Thus triple, quadruple, ... column pages can be printed.
235 Whenever the number of columns is changed (except going from
236 full width to some larger number of columns)
237 a new page is started.
242 To produce a special heading, there are two commands.
246 type section heading here
249 you will get automatically numbered section headings (1, 2, 3, ...),
254 Care and Feeding of Department Heads
258 Care and Feeding of Department Heads
263 Care and Feeding of Directors
265 will print the heading with no number added:
267 Care and Feeding of Directors
269 Every section heading, of either type, should be followed
270 by a paragraph beginning with .PP or .LP, indicating
271 the end of the heading.
272 Headings may contain more than one line
275 The .NH command also supports more complex numbering schemes.
276 If a numerical argument is given, it is taken to be a
277 ``level'' number and an appropriate sub-section
279 Larger level numbers indicate deeper
280 sub-sections, as in this example:
285 Morris and Essex Division
298 Morris and Essex Division
306 An explicit ``.NH 0'' will reset the numbering of level 1
320 (Paragraphs with hanging numbers, e.g. references.)
324 Text for first paragraph, typed
325 normally for as long as you would
326 like on as many lines as needed.
328 Text for second paragraph, ...
332 Text for first paragraph, typed normally for as long
333 as you would like on as many lines as
336 Text for second paragraph, ...
338 A series of indented paragraphs may be followed by an ordinary paragraph
339 beginning with .PP or .LP,
340 depending on whether you wish indenting or not.
341 The command .LP was used here.
343 More sophisticated uses of .IP are also possible.
344 If the label is omitted, for example, a plain block indent
349 just be turned into a
350 block indent suitable for quotations or
360 quotations or such matter.
362 If a non-standard amount of indenting is required,
363 it may be specified after the label (in character positions)
364 and will remain in effect until the next .PP or .LP.
365 Thus, the general form of the .IP command
366 contains two additional fields: the label and the indenting
370 Notice the longer label, requiring larger
371 indenting for these paragraphs.
378 Notice the longer label, requiring larger
379 indenting for these paragraphs.
383 It is also possible to produce multiple nested indents;
384 the command .RS indicates that the next .IP starts from the
385 current indentation level.
386 Each .RE will eat up one level of indenting
387 so you should balance .RS and .RE commands.
388 The .RS command should be thought of as ``move right'' and
389 the .RE command as ``move left''.
428 All of these variations on .LP leave the right
429 margin untouched. Sometimes, for purposes
430 such as setting off a quotation, a paragraph indented
431 on both right and left is required.
434 like this is obtained
435 by preceding it with .QP.
436 More complicated material (several paragraphs) should be
437 bracketed with .QS and .QE.
444 (on the typesetter) or underlining (on the terminal)
448 as much text as you want
458 The .R command restores the normal (usually Roman) font.
459 If only one word is to be italicized, it
460 may be just given on the line with the .I command,
466 and in this case no .R is needed to restore
474 Text to be set in boldface
478 and also will be underlined on the terminal or line printer.
479 As with .I, a single word can be placed in boldface
480 by placing it on the same line as the .B command.
483 can be specified similarly with
484 the commands .LG (make larger), .SM (make smaller), and .NL
485 (return to normal size).
487 is two points; the commands may be repeated for
493 (here one .NL canceled two .SM commands).
497 as opposed to italicizing is required on the typesetter,
502 will underline a word. There is no way to underline
503 multiple words on the typesetter.
508 Material placed between lines with the commands .FS
509 (footnote) and .FE (footnote end) will
510 be collected, remembered, and finally placed
511 at the bottom of the current page*.
512 By default, footnotes are 11/12th the
513 length of normal text,
514 but this can be changed using the FL register (see below).
522 To prepare displays of lines, such as tables, in which
523 the lines should not be re-arranged,
524 enclose them in the commands .DS and .DE
527 table lines, like the
528 examples here, are placed
532 By default, lines between .DS and .DE are indented and left-adjusted.
533 You can also center lines, or retain the left margin.
534 Lines bracketed by .DS C and .DE commands are
535 centered (and not re-arranged); lines bracketed
536 by .DS L and .DE are left-adjusted, not indented, and
538 A plain .DS is equivalent
539 to .DS I, which indents and left-adjusts. Thus,
541 these lines were preceded
542 by .DS C and followed by
547 these lines were preceded
548 by .DS L and followed by
551 Note that .DS C centers each line; there is a variant .DS B
552 that makes the display into a left-adjusted block of text, and
553 then centers that entire block.
554 Normally a display is kept together, on one page.
555 If you wish to have a long display which
556 may be split across page
558 use .CD, .LD, or .ID in place of
559 the commands .DS C, .DS L, or .DS I respectively.
560 An extra argument to the .DS I or .DS command is taken
561 as an amount to indent.
562 Note: it is tempting to assume that .DS R will right adjust
563 lines, but it doesn't work.
566 Boxing words or lines.
568 To draw rectangular boxes around words the command
575 The boxes will not be neat on a terminal, and this
576 should not be used as a substitute for italics.
578 Longer pieces of text may be boxed
579 by enclosing them with .B1 and .B2:
585 as has been done here.
590 Keeping blocks together.
592 If you wish to keep a table or other block of lines
593 together on a page, there are ``keep - release'' commands.
594 If a block of lines preceded by .KS and followed by .KE does
595 not fit on the remainder of the current page, it will begin
597 Lines bracketed by .DS and .DE commands are automatically
598 kept together this way.
599 There is also a ``keep floating'' command: if the
600 block to be kept together is preceded by .KF instead of .KS
602 on the current page, it will be moved down through the text
603 until the top of the next page. Thus, no large blank space
604 will be introduced in the document.
607 Nroff/Troff commands.
609 Among the useful commands from the basic formatting programs
610 are the following. They all work with both typesetter and
611 computer terminal output:
613 .bp - begin new page.
614 .br - ``break'', stop running text
616 .sp n - insert n blank lines.
617 .na - don't adjust right margins.
623 By default, documents produced on computer terminals have the
624 date at the bottom of each page; documents produced on
625 the typesetter don't.
626 To force the date, say ``.DA''. To force no date, say ``.ND''.
627 To lie about the date, say ``.DA July 4, 1776''
628 which puts the specified date at the bottom of each page.
634 places the specified date on the cover sheet and nowhere else.
635 Place this line before the title.
640 Certain of the registers used by \-ms can
641 be altered to change default
643 They should be changed with .nr commands,
649 to make the default point size 9 point.
650 If the effect is needed immediately, the
655 command should be used
656 in addition to changing the number register.
664 Register Defines Takes Default
666 PO page offset next page 1\(fm\(fm
667 LL line length next para. 6\(fm\(fm
668 LT title length next para. 6\(fm\(fm
669 HM top margin next page 1\(fm\(fm
670 FM bottom margin next page 1\(fm\(fm
671 PS point size next para. 10 pts
672 VS line spacing next para. 12 pts
673 PI para. indent next para. 5 ens
674 PD para. spacing next para. 0.3 VS
675 QI quote para ind next para. 5 ens
676 FL footnote length next FS *5/6 LL
677 FI footnote indent next FS *5/6 LL
678 FF footnote format next FS *5/6 LL
679 MINGW min. column wid next page 2 ens
685 LH, CH, and RH which are the left, center, and right headings
686 respectively; and similarly LF, CF, and RF which are strings in the
692 is taken from register PN, to permit
693 changing its output style.
694 For more complicated headers and footers
695 the macros PT and BT can be redefined, as
702 To simplify typing certain foreign words,
703 strings representing common accent marks are defined.
704 They precede the letter over which the mark
706 Here are the strings:
710 Input Output Input Output
711 \e*\(fme \*'e \e*~a \*~a
712 \e*\(gae \*`e \e*Ce \h'0.15m'\v'-0.6m'\s6\zv\s0\v'0.6m'\h'-0.15m'e
713 \e*:u \*:u \e*,c \*,c
720 After your document is prepared and stored on a file,
721 you can print it on a terminal with the command*
724 * If .2C was used, pipe the
729 make the first line of the input
730 ``.pi /usr/bin/col.''
738 and you can print it on the typesetter with the
745 (many options are possible).
746 In each case, if your document is stored in several files,
747 just list all the filenames
748 where we have used ``file''.
749 If equations or tables are used,
757 must be invoked as preprocessors.
762 References and further study.
764 If you have to do Greek or mathematics, see
767 for equation setting.
772 provides definitions of .EQ and .EN
773 which normally center the equation and set it off slightly.
774 An argument on .EQ is taken to be an equation
775 number and placed in the right margin near the equation.
776 In addition, there are three special arguments to EQ:
777 the letters C, I, and L indicate centered (default),
778 indented, and left adjusted equations, respectively.
779 If there is both a format argument
780 and an equation number,
781 give the format argument first, as in
786 for a left-adjusted equation numbered (1.3a).
789 the macros .TS and .TE
791 to separate tables (see [2]) from text with a little space.
792 A very long table with a heading may be broken
793 across pages by beginning it with .TS H
795 and placing the line .TH in the table data
796 after the heading. If the table
797 has no heading repeated from page to page,
798 just use the ordinary .TS and .TE macros.
803 [3] for a general introduction, and [4]
804 for the full details (experts only).
805 Information on related UNIX commands
807 For jobs that do not seem well-adapted
808 to \-ms, consider other macro packages.
809 It is often far easier to write a specific macro packages
810 for such tasks as imitating particular journals than
811 to try to adapt \-ms.
817 Many thanks are due to Brian Kernighan for
818 his help in the design and implementation of this package,
819 and for his assistance in preparing this manual.
826 B. W. Kernighan and L. L. Cherry,
828 Typesetting Mathematics \(em Users Guide (2nd edition),
830 Bell Laboratories Computing Science Report no. 17.
834 Tbl \(em A Program to Format Tables,
836 Bell Laboratories Computing Science Report no. 45.
842 Bell Laboratories, 1976.
846 Nroff\|/Troff Reference Manual,
848 Bell Laboratories Computing Science Report no. 51.
850 K. Thompson and D. M. Ritchie,
852 UNIX Programmer's Manual,
854 Bell Laboratories, 1978.
865 1C Return to single column format. LG Increase type size.
866 2C Start double column format. LP Left aligned block paragraph.
869 AI Specify author's institution.
870 AU Specify author. ND Change or cancel date.
871 B Begin boldface. NH Specify numbered heading.
872 DA Provide the date on each page. NL Return to normal type size.
873 DE End display. PP Begin paragraph.
874 DS Start display (also CD, LD, ID).
875 EN End equation. R Return to regular font (usually Roman).
876 EQ Begin equation. RE End one level of relative indenting.
877 FE End footnote. RP Use released paper format.
878 FS Begin footnote. RS Relative indent increased one level.
879 I Begin italics. SH Specify section heading.
880 SM Change to smaller type size.
881 IP Begin indented paragraph. TL Specify title.
883 KF Begin floating keep. UL Underline one word.
892 The following register names are used by \-ms internally.
893 Independent use of these names in one's own macros may
894 produce incorrect output.
895 Note that no lower case letters are used in any \-ms internal name.
898 c s s s s s s s s s s
899 l l l l l l l l l l l.
900 Number registers used in \-ms
901 : DW GW HM IQ LL NA OJ PO T. TV
902 #T EF H1 HT IR LT NC PD PQ TB VS
903 \&.T FC H2 IF IT MF ND PE PS TC WF
904 1T FL H3 IK KI MM NF PF PX TD YE
905 AV FM H4 IM L1 MN NS PI RO TN YY
906 CW FP H5 IP LE MO OI PN ST TQ ZN
911 c s s s s s s s s s s
912 l l l l l l l l l l l.
913 String registers used in \-ms
914 \(fm A5 CB DW EZ I KF MR R1 RT TL
915 \(ga AB CC DY FA I1 KQ ND R2 S0 TM
916 ^ AE CD E1 FE I2 KS NH R3 S1 TQ
917 ~ AI CF E2 FJ I3 LB NL R4 S2 TS
918 : AU CH E3 FK I4 LD NP R5 SG TT
919 , B CM E4 FN I5 LG OD RC SH UL
920 1C BG CS E5 FO ID LP OK RE SM WB
921 2C BT CT EE FQ IE ME PP RF SN WH
922 A1 C D EL FS IM MF PT RH SY WT
923 A2 C1 DA EM FV IP MH PY RP TA XD
924 A3 C2 DE EN FY IZ MN QF RQ TE XF
925 A4 CA DS EQ HO KE MO R RS TH XK
930 Figure 1:\ \ Order of Commands in Input