BSD 4_2 development
[unix-history] / usr / doc / memacros / intro.nr
CommitLineData
bf6892df
C
1.nr si 3n
2.he 'USING NROFF AND \-ME''%'
3.ds U \s-1UNIX\s0
4.ds N \s-1NROFF\s0
5.ds T \s-1TROFF\s0
6.+c
7.(l C
8.sz 14
9.b "WRITING PAPERS WITH NROFF USING \-ME"
10.sz
11.sp 2
12.ul
13Eric P. Allman
14.sp
15Electronics Research Laboratory
16University of California, Berkeley
17Berkeley, California 94720
18.)l
19.sp 4
20.pp
21This document describes
22the text processing facilities
23available on the \*U\(dg
24.(f
25\(dg\*U, \*N, and \*T are Trademarks
26of Bell Laboratories
27.)f
28operating system
29via \*N\(dg and the
30\-me
31macro package.
32It is assumed
33that the reader
34already is generally familiar
35with the \*U operating system
36and a text editor
37such as
38.b ex .
39This is intended to be a casual introduction,
40and
41as such not all material is covered.
42In particular,
43many variations and additional features
44of the \-me macro package
45are not explained.
46For a complete discussion of this
47and other issues,
48see
49.ul
50The \-me Reference Manual
51and
52.ul
53The \*N/\*T Reference Manual.
54.pp
55\*N, a computer program
56that runs on the \*U operating system,
57reads an input file
58prepared by the user
59and outputs a formatted paper
60suitable for publication or framing.
61The input consists of
62.i text ,
63or words to be printed,
64and
65.i requests ,
66which give instructions
67to the \*N program
68telling how to format the printed copy.
69.pp
70Section 1
71describes the basics
72of text processing.
73Section 2
74describes the basic requests.
75Section 3
76introduces displays.
77Annotations,
78such as footnotes,
79are handled in
80section 4.
81The more complex requests
82which are not discussed in section 2
83are covered in section 5.
84Finally,
85section 6
86discusses things you will need
87to know
88if you want to typeset documents.
89If you are a novice,
90you probably won't want to read beyond section 4
91until you have tried some of the basic features out.
92.pp
93When you have your raw text ready,
94call the \*N formatter by typing
95as a request to the \*U shell:
96.(b
97nroff \-me \-T\c
98.i "type files"
99.)b
100where
101.i type
102describes the type of terminal
103you are outputting to.
104Common values are
105.b dtc
106for a DTC 300s
107(daisy-wheel type)
108printer and
109.b lpr
110for the line printer.
111If the
112.b \-T
113flag is omitted,
114a
115.q "lowest common denominator"
116terminal is assumed;
117this is good for previewing output
118on most terminals.
119A complete description of options
120to the \*N command can be found in
121.ul
122The \*N/\*T Reference Manual.
123.pp
124The word
125.i argument
126is used in this manual
127to mean a word or number
128which appears on the same line
129as a request
130which modifies the meaning
131of that request.
132For example,
133the request
134.(b
135\&.sp
136.)b
137spaces one line,
138but
139.(b
140\&.sp 4
141.)b
142spaces four lines.
143The number
144.b 4
145is an
146.i argument
147to the
148.b .sp
149request
150which says to space four lines
151instead of one.
152Arguments are separated from the request
153and from each other
154by spaces.
155.sh 1 "Basics of Text Processing"
156.pp
157The primary function
158of \*N
159is to
160.i collect
161words from input lines,
162.i fill
163output lines with those words,
164.i justify
165the right hand margin by inserting extra spaces
166in the line,
167and output the result.
168For example,
169the input:
170.(b
171Now is the time
172for all good men
173to come to the aid
174of their party.
175Four score and seven
176years ago,...
177.)b
178will be read,
179packed onto output lines,
180and justified
181to produce:
182.(b F
183Now is the time
184for all good men
185to come to the aid
186of their party.
187Four score and seven
188years ago,...
189.)b
190Sometimes you may want to start a new output line
191even though the line you are on
192is not yet full;
193for example,
194at the end of a paragraph.
195To do this
196you can cause a
197.i break ,
198which
199starts a new output line.
200Some requests
201cause a break automatically,
202as do blank input lines
203and input lines beginning with a space.
204.pp
205Not all input lines
206are text to be formatted.
207Some of the input lines
208are
209.i requests
210which describe
211how to format the text.
212Requests always have a period
213or an apostrophe
214(\c
215.q "\|\(aa\|" )
216as the first character
217of the input line.
218.pp
219The text formatter
220also does more complex things,
221such as automatically numbering pages,
222skipping over page folds,
223putting footnotes in the correct place,
224and so forth.
225.pp
226I can offer you a few hints
227for preparing text
228for input to \*N.
229First,
230keep the input lines short.
231Short input lines are easier to edit,
232and \*N will pack words onto longer lines
233for you anyhow.
234In keeping with this,
235it is helpful
236to begin a new line
237after every period,
238comma,
239or phrase,
240since common corrections
241are to add or delete sentences
242or phrases.
243Second,
244do not put spaces at the end of lines,
245since this can sometimes confuse the \*N
246processor.
247Third,
248do not hyphenate words at the end of lines
249(except words that should have hyphens in them,
250such as
251.q mother-in-law );
252\*N is smart enough to hyphenate words
253for you as needed,
254but is not smart enough
255to take hyphens out
256and join a word back together.
257Also,
258words such as
259.q mother-in-law
260should not be broken
261over a line,
262since then you will get a space
263where not wanted,
264such as
265.tr @-
266.nh
267.q "mother@\ in@law" .
268.br
269.tr @@
270.hy 14
271.sh 1 "Basic Requests"
272.sh 2 "Paragraphs"
273.pp
274Paragraphs are begun
275by using the
276.b .pp
277request.
278For example,
279the input:
280.(b
281\&.pp
282Now is the time for all good men
283to come to the aid of their party.
284Four score and seven years ago,...
285.)b
286produces a blank line
287followed by an indented first line.
288The result is:
289.(b F
290.ti +\n(piu
291Now is the time for all good men
292to come to the aid of their party.
293Four score and seven years ago,...
294.)b
295.pp
296Notice that the sentences
297of the paragraphs
298.i "must not"
299begin with a space,
300since blank lines
301and lines begining with spaces
302cause a break.
303For example,
304if I had typed:
305.(b
306\&.pp
307Now is the time for all good men
308 to come to the aid of their party.
309Four score and seven years ago,...
310.)b
311The output would be:
312.(b F
313.ti +\n(piu
314Now is the time for all good men
315 to come to the aid of their party.
316Four score and seven years ago,...
317.)b
318A new line begins after the word
319.q men
320because the second line began with a space character.
321.pp
322There are many
323fancier
324types of paragraphs,
325which will be described later.
326.sh 2 "Headers and Footers"
327.pp
328Arbitrary headers and footers
329can be put
330at the top and bottom
331of every page.
332Two requests
333of the form
334.b .he \ \c
335.i title
336and
337.b .fo \ \c
338.i title
339define the titles to put at the head and the foot
340of every page,
341respectively.
342The titles are called
343.i three-part
344titles,
345that is,
346there is a left-justified part,
347a centered part,
348and a right-justified part.
349To separate these three parts
350the first character of
351.i title
352(whatever it may be)
353is used as a delimiter.
354Any character may be used,
355but
356backslash
357and double quote marks
358should be avoided.
359The percent sign
360is replaced by the current page number
361whenever found in the title.
362For example,
363the input:
364.(b
365\&.he \(aa\(aa%\(aa\(aa
366\&.fo \(aaJane Jones\(aa\(aaMy Book\(aa
367.)b
368results in the page number
369centered at the top
370of each page,
371.q "Jane Jones"
372in the lower left corner,
373and
374.q "My Book"
375in the lower right corner.
376.sh 2 "Double Spacing"
377.pp
378.ls 2
379\*N will double space output text automatically if you
380use the request
381.b ".ls\ 2" ,
382as is done in this section.
383You can revert to single spaced mode
384by typing
385.b ".ls\ 1" .
386.ls 1
387.sh 2 "Page Layout"
388.pp
389A number of requests allow
390you to change the way the printed copy looks,
391sometimes called the
392.i layout
393of the output page.
394Most of these requests adjust the placing
395of
396.q "white space"
397(blank lines or spaces).
398In these explanations,
399characters in italics
400should be replaced with values you wish to use;
401bold characters
402represent characters which should actually be typed.
403.pp
404The
405.b .bp
406request
407starts a new page.
408.pp
409The request
410.b .sp \ \c
411.i N
412leaves
413.i N
414lines of blank space.
415.i N
416can be omitted
417(meaning skip a single line)
418or can be of the form
419.i N \^\c
420.b i
421(for
422.i N
423inches)
424or
425.i N \^\c
426.b c
427(for
428.i N
429centimeters).
430For example, the input:
431.(b
432\&.sp 1.5i
433My thoughts on the subject
434\&.sp
435.)b
436leaves one and a half inches of space,
437followed by the line
438.q "My thoughts on the subject" ,
439followed by a single blank line.
440.pp
441The
442.b .in \ \c
443.i +N
444request
445changes the amount of white space
446on the left of the page
447(the
448.i indent ).
449The argument
450.i N
451can be of the form
452.b + \c
453.i N
454(meaning leave
455.i N
456spaces more than you are already leaving),
457.b \- \c
458.i N
459(meaning leave less than you do now),
460or just
461.i N
462(meaning leave exactly
463.i N
464spaces).
465.i N
466can be of the form
467.i N \^\c
468.b i
469or
470.i N \^\c
471.b c
472also.
473For example,
474the input:
475.(b
476initial text
477\&.in 5
478some text
479\&.in +1i
480more text
481\&.in \-2c
482final text
483.)b
484produces
485.q "some text"
486indented exactly five spaces
487from the left margin,
488.q "more text"
489indented five spaces
490plus one inch
491from the left margin
492(fifteen spaces
493on a pica typewriter),
494and
495.q "final text"
496indented five spaces
497plus one inch
498minus two centimeters
499from the margin.
500That is,
501the output is:
502.(b
503initial text
504.in +5
505some text
506.in +1i
507more text
508.in -2c
509final text
510.)b
511.pp
512The
513.b .ti \ \c
514.i +N
515(temporary indent)
516request is used like
517.b .in \ \c
518.i +N
519when the indent
520should apply to one line only,
521after which it should revert
522to the previous indent.
523For example,
524the input:
525.(b
526\&.in 1i
527\&.ti 0
528Ware, James R. The Best of Confucius,
529Halcyon House, 1950.
530An excellent book containing translations of
531most of Confucius\(aa most delightful sayings.
532A definite must for anyone interested in the early foundations
533of Chinese philosophy.
534.)b
535produces:
536.in 1i+\n($iu
537.ti \n($iu
538Ware, James R. The Best of Confucius,
539Halcyon House, 1950.
540An excellent book containing translations of
541most of Confucius' most delightful sayings.
542A definite must for anyone interested in the early foundations
543of Chinese philosophy.
544.pp
545Text lines can be centered
546by using the
547.b .ce
548request.
549The line after the
550.b .ce
551is centered
552(horizontally)
553on the page.
554To center more than one line,
555use
556.b .ce \ \c
557.i N
558(where
559.i N
560is the number of lines to center),
561followed by the
562.i N
563lines.
564If you want to center many lines
565but don't want to count them,
566type:
567.(b
568\&.ce 1000
569lines to center
570\&.ce 0
571.)b
572The
573.b ".ce\ 0"
574request tells \*N to center zero more lines,
575in other words,
576stop centering.
577.pp
578All of these requests
579cause a break;
580that is,
581they always start
582a new line.
583If you want to start a new line
584without performing any other action,
585use
586.b .br .
587.sh 2 "Underlining"
588.pp
589Text can be underlined
590using the
591.b .ul
592request.
593The
594.b .ul
595request
596causes the next input line
597to be underlined when output.
598You can underline multiple lines
599by stating a count of
600.i input
601lines to underline,
602followed by those lines
603(as with the
604.b .ce
605request).
606For example,
607the input:
608.(b
609\&.ul 2
610Notice that these two input lines
611are underlined.
612.)b
613will underline those eight words in \*N.
614(In \*T they will be set in italics.)
615.sh 1 "Displays"
616.pp
617Displays are sections of text
618to be set off
619from the body of the paper.
620Major quotes,
621tables,
622and figures
623are types of displays,
624as are all the examples
625used in this document.
626All displays
627except centered blocks
628are output
629single spaced.
630.sh 2 "Major Quotes"
631.pp
632Major quotes
633are quotes which are several lines long,
634and hence are set in from the rest
635of the text
636without quote marks
637around them.
638These can be generated
639using the commmands
640.b .(q
641and
642.b .)q
643to surround the quote.
644For example,
645the input:
646.(b
647As Weizenbaum points out:
648\&.(q
649It is said that to explain is to explain away.
650This maxim is nowhere so well fulfilled
651as in the areas of computer programming,...
652\&.)q
653.)b
654generates as output:
655.lp
656As Weizenbaum points out:
657.(q
658It is said that to explain is to explain away.
659This maxim is nowhere so well fulfilled
660as in the areas of computer programming,...
661.)q
662.sh 2 "Lists"
663.pp
664A
665.i list
666is an indented,
667single spaced,
668unfilled display.
669Lists should be used
670when the material to be printed
671should not be filled and justified
672like normal text,
673such as columns of figures
674or the examples used in this paper.
675Lists are surrounded
676by the requests
677.b .(l
678and
679.b .)l .
680For example,
681type:
682.(b
683Alternatives to avoid deadlock are:
684\&.(l
685Lock in a specified order
686Detect deadlock and back out one process
687Lock all resources needed before proceeding
688\&.)l
689.)b
690will produce:
691.br
692Alternatives to avoid deadlock are:
693.(l
694Lock in a specified order
695Detect deadlock and back out one process
696Lock all resources needed before proceeding
697.)l
698.sh 2 "Keeps"
699.pp
700A
701.i keep
702is a display of lines
703which are kept on a single page
704if possible.
705An example of where you would use a keep
706might be a diagram.
707Keeps differ from lists
708in that lists may be broken
709over a page boundary
710whereas keeps will not.
711.pp
712Blocks are the basic kind of keep.
713They begin with the request
714.b .(b
715and end with the request
716.b .)b .
717If there is not room on the current page
718for everything in the block,
719a new page is begun.
720This has the unpleasant effect
721of leaving blank space
722at the bottom of the page.
723When this is not appropriate,
724you can use the alternative,
725called
726.i "floating keeps" .
727.pp
728.i "Floating keeps"
729move relative to the text.
730Hence,
731they are good for things
732which will be referred to
733by name,
734such as
735.q "See figure 3" .
736A floating keep will appear
737at the bottom of the current page
738if it will fit;
739otherwise,
740it will appear at the top
741of the next page.
742Floating keeps begin with the line
743.b .(z
744and end with the line
745.b .)z .
746For an example of a floating keep,
747see figure 1.
748.(z
749.in 1i
750.xl -1i
751.hl
752\&.(z
753\&.hl
754Text of keep to be floated.
755\&.sp
756\&.ce
757Figure 1. Example of a Floating Keep.
758\&.hl
759\&.)z
760.sp
761.ce
762Figure 1. Example of a Floating Keep.
763.hl
764.)z
765The
766.b .hl
767request is used
768to draw a horizontal line
769so that the figure
770stands out from the text.
771.sh 2 "Fancier Displays"
772.pp
773Keeps and lists are normally collected in
774.i nofill
775mode,
776so that they are good for tables and such.
777If you want a display
778in fill mode
779(for text),
780type
781.b ".(l\ F"
782(Throughout this section,
783comments applied to
784.b .(l
785also apply to
786.b .(b
787and
788.b .(z ).
789This kind of display
790will be indented from both margins.
791For example,
792the input:
793.(b
794\&.(l F
795And now boys and girls,
796a newer, bigger, better toy than ever before!
797Be the first on your block to have your own computer!
798Yes kids, you too can have one of these modern
799data processing devices.
800You too can produce beautifully formatted papers
801without even batting an eye!
802\&.)l
803.)b
804will be output as:
805.(b F
806And now boys and girls,
807a newer, bigger, better toy than ever before!
808Be the first on your block to have your own computer!
809Yes kids, you too can have one of these modern
810data processing devices.
811You too can produce beautifully formatted papers
812without even batting an eye!
813.)b
814.pp
815Lists and blocks are also normally indented
816(floating keeps are normally left justified).
817To get a left-justified list,
818type
819.b ".(l\ L" .
820To get a list centered
821line-for-line,
822type
823.b ".(l C" .
824For example,
825to get a filled,
826left justified list, enter:
827.(b
828\&.(l L F
829text of block
830\&.)l
831.)b
832The input:
833.(b
834\&.(l
835first line of unfilled display
836more lines
837\&.)l
838.)b
839produces the indented text:
840.(b
841first line of unfilled display
842more lines
843.)b
844Typing the character
845.b L
846after the
847.b .(l
848request produces the left justified result:
849.(b L
850first line of unfilled display
851more lines
852.)b
853Using
854.b C
855instead of
856.b L
857produces the line-at-a-time centered output:
858.(b C
859first line of unfilled display
860more lines
861.)b
862.pp
863Sometimes it may be
864that you want to center several lines
865as a group,
866rather than centering them
867one line at a time.
868To do this
869use centered blocks,
870which are surrounded by the requests
871.b .(c
872and
873.b .)c .
874All the lines are centered as a unit,
875such that the longest line is centered
876and the rest are
877lined up around that line.
878Notice that lines
879do not move
880relative to each other
881using centered blocks,
882whereas they do
883using the
884.b C
885argument to keeps.
886.pp
887Centered blocks are
888.i not
889keeps,
890and may be used
891in conjunction
892with keeps.
893For example,
894to center a group of lines
895as a unit
896and keep them
897on one page,
898use:
899.(b
900\&.(b L
901\&.(c
902first line of unfilled display
903more lines
904\&.)c
905\&.)b
906.)b
907to produce:
908.(b L
909.(c
910first line of unfilled display
911more lines
912.)c
913.)b
914If the block requests
915(\c
916.b .(b
917and
918.b .)b )
919had been omitted
920the result would have been the same,
921but with no guarantee
922that the lines of the centered block
923would have all been on one page.
924Note the use of the
925.b L
926argument to
927.b .(b ;
928this causes the centered block
929to center within the entire line
930rather than within the line
931minus the indent.
932Also,
933the center requests
934must
935be nested
936.i inside
937the keep requests.
938.sh 1 "Annotations"
939.pp
940There are a number of requests
941to save text
942for later printing.
943.i Footnotes
944are printed at the bottom of the current page.
945.i "Delayed text"
946is intended to be a variant form
947of footnote;
948the text is printed only
949when explicitly called for,
950such as at the end of each chapter.
951.i Indexes
952are a type of delayed text
953having a tag
954(usually the page number)
955attached to each entry
956after a row of dots.
957Indexes are also saved
958until called for explicitly.
959.sh 2 "Footnotes"
960.pp
961Footnotes begin with the request
962.b .(f
963and end with the request
964.b .)f .
965The current footnote number is maintained
966automatically,
967and can be used by typing \e**,
968to produce a footnote number\**.
969.(f
970\**Like this.
971.)f
972The number is automatically incremented
973after every footnote.
974For example,
975the input:
976.(b
977\&.(q
978A man who is not upright
979and at the same time is presumptuous;
980one who is not diligent and at the same time is ignorant;
981one who is untruthful and at the same time is incompetent;
982such men I do not count among acquaintances.\e**
983\&.(f
984\e**James R. Ware,
985\&.ul
986The Best of Confucius,
987Halcyon House, 1950.
988Page 77.
989\&.)f
990\&.)q
991.)b
992generates the result:
993.(q
994A man who is not upright
995and at the same time is presumptuous;
996one who is not diligent and at the same time is ignorant;
997one who is untruthful and at the same time is incompetent;
998such men I do not count among acquaintances.\**
999.(f
1000\**James R. Ware,
1001.ul
1002The Best of Confucius,
1003Halcyon House, 1950.
1004Page 77.
1005.)f
1006.)q
1007It is important
1008that the footnote
1009appears
1010.i inside
1011the quote,
1012so that you can be sure
1013that the footnote
1014will appear
1015on the same page
1016as the quote.
1017.sh 2 "Delayed Text"
1018.pp
1019Delayed text
1020is very similar to a footnote
1021except that it is printed
1022when called for explicitly.
1023This allows a list of
1024references to
1025appear
1026(for example)
1027at the end of each chapter,
1028as is the convention in some disciplines.
1029Use
1030.b \e*#
1031on delayed text
1032instead of
1033.b \e**
1034as on footnotes.
1035.pp
1036If you are using delayed text
1037as your standard reference mechanism,
1038you can still use footnotes,
1039except that you may want to reference them
1040with special characters*
1041.(f
1042*Such as an asterisk.
1043.)f
1044rather than numbers.
1045.sh 2 "Indexes"
1046.pp
1047An
1048.q index
1049(actually more like a table of contents,
1050since the entries are not sorted alphabetically)
1051resembles delayed text,
1052in that it is saved until called for.
1053However,
1054each entry has the page number
1055(or some other tag)
1056appended to the last line
1057of the index entry
1058after a row of dots.
1059.pp
1060Index entries begin with the request
1061.b .(x
1062and end with
1063.b .)x .
1064The
1065.b .)x
1066request may have a argument,
1067which is the value to print
1068as the
1069.q "page number" .
1070It defaults to the current page number.
1071If the page number given is an underscore
1072(\c
1073.q _ )
1074no page number
1075or line of dots
1076is printed at all.
1077To get the line of dots
1078without a page number,
1079type
1080.b ".)x """"" ,
1081which specifies an explicitly null page number.
1082.pp
1083The
1084.b .xp
1085request prints the index.
1086.pp
1087For example,
1088the input:
1089.(b
1090\&.(x
1091Sealing wax
1092\&.)x
1093\&.(x
1094Cabbages and kings
1095\&.)x _
1096\&.(x
1097Why the sea is boiling hot
1098\&.)x 2.5a
1099\&.(x
1100Whether pigs have wings
1101\&.)x ""
1102\&.(x
1103This is a terribly long index entry, such as might be used
1104for a list of illustrations, tables, or figures; I expect it to
1105take at least two lines.
1106\&.)x
1107\&.xp
1108.)b
1109generates:
1110.(x
1111Sealing wax
1112.)x
1113.(x
1114Cabbages and kings
1115.)x _
1116.(x
1117Why the sea is boiling hot
1118.)x 2.5a
1119.(x
1120Whether pigs have wings
1121.)x ""
1122.(x
1123This is a terribly long index entry, such as might be used
1124for a list of illustrations, tables, or figures; I expect it to
1125take at least two lines.
1126.)x
1127.xp
1128.pp
1129The
1130.b .(x
1131request may have a single character
1132argument,
1133specifying the
1134.q name
1135of the index;
1136the normal index is
1137.b x .
1138Thus,
1139several
1140.q indicies
1141may be maintained simultaneously
1142(such as a list of tables, table of contents, etc.).
1143.pp
1144Notice that the index must be printed
1145at the
1146.i end
1147of the paper,
1148rather than at the beginning
1149where it will probably appear
1150(as a table of contents);
1151the pages may have to be physically rearranged
1152after printing.
1153.sh 1 "Fancier Features"
1154.pp
1155A large number of fancier requests
1156exist,
1157notably requests to provide other sorts of paragraphs,
1158numbered sections of the form
1159.b 1.2.3
1160(such as used in this document),
1161and multicolumn output.
1162.sh 2 "More Paragraphs"
1163.pp
1164Paragraphs generally start with
1165a blank line
1166and with the first line
1167indented.
1168It is possible to get
1169left-justified block-style paragraphs
1170by using
1171.b .lp
1172instead of
1173.b .pp ,
1174as demonstrated by the next paragraph.
1175.lp
1176Sometimes you want to use paragraphs
1177that have the
1178.i body
1179indented,
1180and the first line
1181exdented
1182(opposite of indented)
1183with a label.
1184This can be done with the
1185.b .ip
1186request.
1187A word specified on the same line as
1188.b .ip
1189is printed in the margin,
1190and the body is lined up
1191at a prespecified position
1192(normally five spaces).
1193For example,
1194the input:
1195.(b
1196\&.ip one
1197This is the first paragraph.
1198Notice how the first line
1199of the resulting paragraph lines up
1200with the other lines in the paragraph.
1201\&.ip two
1202And here we are at the second paragraph already.
1203You may notice that the argument to \c
1204.b .ip
1205appears
1206in the margin.
1207\&.lp
1208We can continue text...
1209.)b
1210produces as output:
1211.ip one
1212This is the first paragraph.
1213Notice how the first line of the resulting paragraph lines up
1214with the other lines in the paragraph.
1215.ip two
1216And here we are at the second paragraph already.
1217You may notice that the argument to
1218.b .ip
1219appears
1220in the margin.
1221.lp
1222We can continue text without starting a new indented
1223paragraph
1224by using the
1225.b .lp
1226request.
1227.pp
1228If you have spaces in the label of a
1229.b .ip
1230request,
1231you must use an
1232.q "unpaddable space"
1233instead of a regular space.
1234This is typed as a backslash character
1235(\c
1236.q \e )
1237followed by a space.
1238For example,
1239to print the label
1240.q "Part 1" ,
1241enter:
1242.(b
1243\&.ip "Part\e 1"
1244.)b
1245.pp
1246If a label of an indented paragraph
1247(that is, the argument to
1248.b .ip )
1249is longer than the space allocated for the label,
1250.b .ip
1251will begin a new line after the label.
1252For example,
1253the input:
1254.(b
1255\&.ip longlabel
1256This paragraph had a long label.
1257The first character of text on the first line
1258will not line up with the text on second and subsequent lines,
1259although they will line up with each other.
1260.)b
1261will produce:
1262.ip longlabel
1263This paragraph had a long label.
1264The first character of text on the first line
1265will not line up with the text on second and subsequent lines,
1266although they will line up with each other.
1267.pp
1268It is possible to change the size of the label
1269by using a second argument
1270which is the size of the label.
1271For example,
1272the above example could be done correctly
1273by saying:
1274.(b
1275\&.ip longlabel 10
1276.)b
1277which will make the paragraph indent
127810 spaces for this paragraph only.
1279If you have many paragraphs to indent
1280all the same amount,
1281use the
1282.i "number register"
1283.b ii .
1284For example, to leave one inch of space
1285for the label,
1286type:
1287.(b
1288\&.nr ii 1i
1289.)b
1290somewhere before the first call to
1291.b .ip .
1292Refer to the reference manual
1293for more information.
1294.pp
1295If
1296.b .ip
1297is used
1298with no argument at all
1299no hanging tag will be printed.
1300For example,
1301the input:
1302.(b
1303\&.ip [a]
1304This is the first paragraph of the example.
1305We have seen this sort of example before.
1306\&.ip
1307This paragraph is lined up with the previous paragraph,
1308but it has no tag in the margin.
1309.)b
1310produces as output:
1311.ip [a]
1312This is the first paragraph of the example.
1313We have seen this sort of example before.
1314.ip
1315This paragraph is lined up with the previous paragraph,
1316but it has no tag in the margin.
1317.pp
1318A special case of
1319.b .ip
1320is
1321.b .np ,
1322which automatically
1323numbers paragraphs sequentially from 1.
1324The numbering is reset at the next
1325.b .pp ,
1326.b .lp ,
1327or
1328.b .sh
1329(to be described in the next section)
1330request.
1331For example,
1332the input:
1333.(b
1334\&.np
1335This is the first point.
1336\&.np
1337This is the second point.
1338Points are just regular paragraphs
1339which are given sequence numbers automatically
1340by the .np request.
1341\&.pp
1342This paragraph will reset numbering by .np.
1343\&.np
1344For example,
1345we have reverted to numbering from one now.
1346.)b
1347generates:
1348.np
1349This is the first point.
1350.np
1351This is the second point.
1352Points are just regular paragraphs
1353which are given sequence numbers automatically
1354by the .np request.
1355.pp
1356This paragraph will reset numbering by .np.
1357.np
1358For example,
1359we have reverted to numbering from one now.
1360.sh 2 "Section Headings"
1361.pp
1362Section numbers
1363(such as the ones used in this document)
1364can be automatically generated
1365using the
1366.b .sh
1367request.
1368You must tell
1369.b .sh
1370the
1371.i depth
1372of the section number
1373and a section title.
1374The depth
1375specifies how many numbers
1376are to appear
1377(separated by decimal points)
1378in the section number.
1379For example,
1380the section number
1381.b 4.2.5
1382has a depth of three.
1383.pp
1384Section numbers
1385are incremented
1386in a fairly intuitive fashion.
1387If you add a number
1388(increase the depth),
1389the new number starts out
1390at one.
1391If you subtract section numbers
1392(or keep the same number)
1393the final number is incremented.
1394For example,
1395the input:
1396.(b
1397\&.sh 1 "The Preprocessor"
1398\&.sh 2 "Basic Concepts"
1399\&.sh 2 "Control Inputs"
1400\&.sh 3
1401\&.sh 3
1402\&.sh 1 "Code Generation"
1403\&.sh 3
1404.)b
1405produces as output the result:
1406.(b
1407.b
14081. The Preprocessor
14091.1. Basic Concepts
14101.2. Control Inputs
14111.2.1.
14121.2.2.
14132. Code Generation
14142.1.1.
1415.)b
1416.pp
1417You can specify the section number to begin
1418by placing the section number after the section title,
1419using spaces instead of dots.
1420For example,
1421the request:
1422.(b
1423\&.sh 3 "Another section" 7 3 4
1424.)b
1425will begin the section numbered
1426.b 7.3.4 ;
1427all subsequent
1428.b .sh
1429requests will number relative to this number.
1430.pp
1431There are more complex features
1432which will cause each section to be indented
1433proportionally to the depth of the section.
1434For example, if you enter:
1435.(b
1436\&.nr si \c
1437.i N
1438.)b
1439each section will be indented by an amount
1440.i N .
1441.i N
1442must have a scaling factor attached,
1443that is, it must be of the form
1444.i Nx ,
1445where
1446.i x
1447is a character telling what units
1448.i N
1449is in.
1450Common values for
1451.i x
1452are
1453.b i
1454for inches,
1455.b c
1456for centimeters,
1457and
1458.b n
1459for
1460.i ens
1461(the width of a single character).
1462For example,
1463to indent each section
1464one-half inch,
1465type:
1466.(b
1467\&.nr si 0.5i
1468.)b
1469After this,
1470sections will be indented by
1471one-half inch
1472per level of depth in the section number.
1473For example,
1474this document was produced
1475using the request
1476.(b
1477\&.nr si 3n
1478.)b
1479at the beginning of the input file,
1480giving three spaces of indent
1481per section depth.
1482.pp
1483Section headers without automatically generated numbers
1484can be done using:
1485.(b
1486\&.uh "Title"
1487.)b
1488which will do a section heading,
1489but will put no number on the section.
1490.sh 2 "Parts of the Basic Paper"
1491.pp
1492There are some requests
1493which assist in setting up
1494papers.
1495The
1496.b .tp
1497request
1498initializes for a title page.
1499There are no headers or footers
1500on a title page,
1501and unlike other pages
1502you can space down
1503and leave blank space
1504at the top.
1505For example,
1506a typical title page might appear as:
1507.(b
1508\&.tp
1509\&.sp 2i
1510\&.(l C
1511THE GROWTH OF TOENAILS
1512IN UPPER PRIMATES
1513\&.sp
1514by
1515\&.sp
1516Frank N. Furter
1517\&.)l
1518\&.bp
1519.)b
1520.pp
1521The request
1522.b .th
1523sets up the environment
1524of the \*N processor
1525to do a thesis,
1526using the rules established at Berkeley.
1527It defines the correct headers and footers
1528(a page number in the upper right hand corner only),
1529sets the margins correctly,
1530and double spaces.
1531.pp
1532The
1533.b .+c \ \c
1534.i T
1535request can be used
1536to start chapters.
1537Each chapter is automatically numbered
1538from one,
1539and a heading is printed at the top of each chapter
1540with the chapter number
1541and the chapter name
1542.i T .
1543For example,
1544to begin a chapter called
1545.q Conclusions ,
1546use the request:
1547.(b
1548\&.+c "CONCLUSIONS"
1549.)b
1550which will produce,
1551on a new page,
1552the lines
1553.(b C
1554CHAPTER 5
1555CONCLUSIONS
1556.)b
1557with appropriate spacing for a thesis.
1558Also, the header is moved to the foot of the page
1559on the first page of a chapter.
1560Although the
1561.b .+c
1562request was not designed to work only with the
1563.b .th
1564request,
1565it is tuned for the format acceptable
1566for a PhD thesis
1567at Berkeley.
1568.pp
1569If the
1570title parameter
1571.i T
1572is omitted from the
1573.b .+c
1574request,
1575the result is a chapter with no heading.
1576This can also be used at the beginning
1577of a paper;
1578for example,
1579.b .+c
1580was used to generate page one
1581of this document.
1582.pp
1583Although
1584papers traditionally have the abstract,
1585table of contents,
1586and so forth at the front of the paper,
1587it is more convenient to format
1588and print them last
1589when using \*N.
1590This is so that index entries
1591can be collected and then printed
1592for the table of contents
1593(or whatever).
1594At the end of the paper,
1595issue the
1596.b ".++ P"
1597request,
1598which begins the preliminary part
1599of the paper.
1600After issuing this request,
1601the
1602.b .+c
1603request will begin a preliminary section
1604of the paper.
1605Most notably,
1606this prints the page number
1607restarted from one
1608in lower case Roman numbers.
1609.b .+c
1610may be used repeatedly
1611to begin different parts of the
1612front material
1613for example,
1614the abstract,
1615the table of contents,
1616acknowledgments,
1617list of illustrations,
1618etc.
1619The request
1620.b ".++ B"
1621may also be used
1622to begin the bibliographic section
1623at the end of the paper.
1624For example,
1625the paper might appear
1626as outlined in figure 2.
1627(In this figure,
1628comments begin with the sequence
1629.b \e" .)
1630.(z
1631.hl
1632.if t .in 0.5i
1633.if t .ta 2i
1634.if n .ta 3i
1635\&.th \e" set for thesis mode
1636\&.fo \(aa\(aaDRAFT\(aa\(aa \e" define footer for each page
1637\&.tp \e" begin title page
1638\&.(l C \e" center a large block
1639THE GROWTH OF TOENAILS
1640IN UPPER PRIMATES
1641\&.sp
1642by
1643\&.sp
1644Frank Furter
1645\&.)l \e" end centered part
1646\&.+c INTRODUCTION \e" begin chapter named "INTRODUCTION"
1647\&.(x t \e" make an entry into index `t'
1648Introduction
1649\&.)x \e" end of index entry
1650text of chapter one
1651\&.+c "NEXT CHAPTER" \e" begin another chapter
1652\&.(x t \e" enter into index `t' again
1653Next Chapter
1654\&.)x
1655text of chapter two
1656\&.+c CONCLUSIONS
1657\&.(x t
1658Conclusions
1659\&.)x
1660text of chapter three
1661\&.++ B \e" begin bibliographic information
1662\&.+c BIBLIOGRAPHY \e" begin another `chapter'
1663\&.(x t
1664Bibliography
1665\&.)x
1666text of bibliography
1667\&.++ P \e" begin preliminary material
1668\&.+c "TABLE OF CONTENTS"
1669\&.xp t \e" print index `t' collected above
1670\&.+c PREFACE \e" begin another preliminary section
1671text of preface
1672.sp 2
1673.in 0
1674.ce
1675Figure 2. Outline of a Sample Paper
1676.hl
1677.)z
1678.sh 2 "Equations and Tables"
1679.pp
1680Two special \*U programs exist
1681to format special types of material.
1682.b Eqn
1683and
1684.b neqn
1685set equations
1686for the phototypesetter
1687and \*N respectively.
1688.b Tbl
1689arranges to print
1690extremely pretty tables
1691in a variety of formats.
1692This document will only describe
1693the embellishments
1694to the standard features;
1695consult the reference manuals
1696for those processors
1697for a description of their use.
1698.pp
1699The
1700.b eqn
1701and
1702.b neqn
1703programs are described fully
1704in the document
1705.ul
1706Typesetting Mathematics \- Users' Guide
1707by Brian W. Kernighan
1708and Lorinda L. Cherry.
1709Equations are centered,
1710and are kept on one page.
1711They are introduced by the
1712.b .EQ
1713request and terminated by the
1714.b .EN
1715request.
1716.pp
1717The
1718.b .EQ
1719request may take an
1720equation number as an
1721optional argument,
1722which is printed vertically centered
1723on the right hand side
1724of the equation.
1725If the equation becomes too long
1726it should be split
1727between two lines.
1728To do this, type:
1729.(b
1730\&.EQ (eq 34)
1731text of equation 34
1732\&.EN C
1733\&.EQ
1734continuation of equation 34
1735\&.EN
1736.)b
1737The
1738.b C
1739on the
1740.b .EN
1741request
1742specifies that the equation
1743will be continued.
1744.pp
1745The
1746.b tbl
1747program produces tables.
1748It is fully described
1749(including numerous examples)
1750in the document
1751.ul
1752Tbl \- A Program to Format Tables
1753by M. E. Lesk.
1754Tables begin with the
1755.b .TS
1756request
1757and end with the
1758.b .TE
1759request.
1760Tables are normally kept on a single page.
1761If you have a table which is too big
1762to fit on a single page,
1763so that you know it will extend
1764to several pages,
1765begin the table with the request
1766.b ".TS\ H"
1767and put the request
1768.b .TH
1769after the part of the table
1770which you want
1771duplicated at the top of every page
1772that the table is printed on.
1773For example, a table definition
1774for a long table might look like:
1775.ds TA \|\h'.4n'\v'-.2n'\s-4\zT\s0\v'.2n'\h'-.4n'\(ci\|
1776.if n .ds TA \ \o'-T'\ \"
1777.(b
1778\&.TS H
1779c s s
1780n n n.
1781THE TABLE TITLE
1782\&.TH
1783text of the table
1784\&.TE
1785.)b
1786.pp
1787.sh 2 "Two Column Output"
1788.pp
1789You can get two column output
1790automatically
1791by using the request
1792.b .2c .
1793This causes everything after it
1794to be output in two-column form.
1795The request
1796.b .bc
1797will start a new column;
1798it differs from
1799.b .bp
1800in that
1801.b .bp
1802may leave a totally blank column
1803when it starts a new page.
1804To revert to single column output,
1805use
1806.b .1c .
1807.sh 2 "Defining Macros"
1808.pp
1809A
1810.i macro
1811is a collection of requests and text
1812which may be used
1813by stating a simple request.
1814Macros begin with the line
1815.b ".de" \ \c
1816.i xx
1817(where
1818.i xx
1819is the name of the macro to be defined)
1820and end with the line consisting of two dots.
1821After defining the macro,
1822stating the line
1823.b . \c
1824.i xx
1825is the same as stating all the other lines.
1826For example,
1827to define a macro
1828that spaces 3 lines
1829and then centers the next input line,
1830enter:
1831.(b
1832\&.de SS
1833\&.sp 3
1834\&.ce
1835\&..
1836.)b
1837and use it by typing:
1838.(b
1839\&.SS
1840\&Title Line
1841(beginning of text)
1842.)b
1843.pp
1844Macro names may be one or two characters.
1845In order to avoid conflicts
1846with names in \-me,
1847always use upper case letters as names.
1848The only names to avoid are
1849.b TS ,
1850.b TH ,
1851.b TE ,
1852.b EQ ,
1853and
1854.b EN .
1855.sh 2 "Annotations Inside Keeps"
1856.pp
1857Sometimes you may want to put
1858a footnote
1859or index entry inside a keep.
1860For example,
1861if you want to maintain a
1862.q "list of figures"
1863you will want to do something like:
1864.(b
1865\&.(z
1866\&.(c
1867text of figure
1868\&.)c
1869\&.ce
1870Figure 5.
1871\&.(x f
1872Figure 5
1873\&.)x
1874\&.)z
1875.)b
1876which you may hope
1877will give you a figure
1878with a label
1879and an entry in the index
1880.b f
1881(presumably a list of figures index).
1882Unfortunately,
1883the
1884index entry
1885is read and interpreted
1886when the keep is read,
1887not when it is printed,
1888so the page number in the index is likely to be wrong.
1889The solution is to use the magic string
1890.b \e!
1891at the beginning of all the lines dealing with the index.
1892In other words,
1893you should use:
1894.(b
1895\&.(z
1896\&.(c
1897Text of figure
1898\&.)c
1899\&.ce
1900Figure 5.
1901\e!.(x f
1902\e!Figure 5
1903\e!.)x
1904\&.)z
1905.)b
1906which will defer the processing of the index
1907until the figure is output.
1908This will guarantee
1909that the page number in the index
1910is correct.
1911The same comments apply
1912to
1913blocks
1914(with
1915.b .(b
1916and
1917.b .)b )
1918as well.
1919.sh 1 "\*T and the Photosetter"
1920.pp
1921With a little care,
1922you can prepare
1923documents that
1924will print nicely
1925on either a regular terminal
1926or when phototypeset
1927using the \*T formatting program.
1928.sh 2 "Fonts"
1929.pp
1930A
1931.i font
1932is a style of type.
1933There are three fonts
1934that are available simultaneously,
1935Times Roman,
1936Times Italic,
1937and Times Bold,
1938plus the special math font.
1939The normal font is Roman.
1940Text which would be underlined in \*N
1941with the
1942.b .ul
1943request
1944is set in italics
1945in \*T.
1946.pp
1947There are ways of switching between fonts.
1948The requests
1949.b .r ,
1950.b .i ,
1951and
1952.b .b
1953switch to Roman,
1954italic,
1955and bold fonts respectively.
1956You can set a single word
1957in some font
1958by typing (for example):
1959.(b
1960\&.i word
1961.)b
1962which will set
1963.i word
1964in italics
1965but does not affect the surrounding text.
1966In \*N,
1967italic and bold text
1968is underlined.
1969.pp
1970Notice that if you are setting more than one word
1971in whatever font,
1972you must surround that word with double quote marks
1973(`\|"\|')
1974so that it will appear to the \*N processor as a single word.
1975The quote marks will not appear in the formatted text.
1976If you do want a quote mark to appear,
1977you should quote the entire string
1978(even if a single word),
1979and use
1980.i two
1981quote marks where you want one to appear.
1982For example,
1983if you want to produce the text:
1984.(b
1985.i """Master Control\|"""
1986.)b
1987in italics, you must type:
1988.(b
1989\&.i """Master Control\e|"""
1990.)b
1991The
1992.b \e|
1993produces a very narrow space
1994so that the
1995.q l
1996does not overlap the quote sign in \*T,
1997like this:
1998.(b
1999.i """Master Control"""
2000.)b
2001.pp
2002There are also several
2003.q pseudo-fonts
2004available.
2005The input:
2006.(b
2007\&.(b
2008\&.u underlined
2009\&.bi "bold italics"
2010\&.bx "words in a box"
2011\&.)b
2012.)b
2013generates
2014.(b
2015.u underlined
2016.bi "bold italics"
2017.bx "words in a box"
2018.)b
2019In \*N these all just underline
2020the text.
2021Notice that pseudo font requests
2022set only the single parameter in the pseudo font;
2023ordinary font requests will begin setting all text
2024in the special font
2025if you do not provide a parameter.
2026No more than one word
2027should appear
2028with these three font requests
2029in the middle of lines.
2030This is because
2031of the way \*T justifies text.
2032For example,
2033if you were to issue the requests:
2034.(b
2035\&.bi "some bold italics"
2036and
2037\&.bx "words in a box"
2038.)b
2039in the middle of a line
2040\*T would produce
2041.bi "some bold italics"
2042and
2043.bx "words in a box" ,\c
2044.if t \p
2045.if n \& \"
2046.if t which I think you will agree does not look good.
2047.if n which would look really lousy in \*T.
2048.pp
2049The second parameter
2050of all font requests
2051is set in the original font.
2052For example,
2053the font request:
2054.(b
2055\&.b bold face
2056.)b
2057generates
2058.q bold
2059in bold font,
2060but sets
2061.q face
2062in the font of the surrounding text,
2063resulting in:
2064.(b
2065.b bold face.
2066.)b
2067To set the two words
2068.b bold
2069and
2070.b face
2071both in
2072.b "bold face" ,
2073type:
2074.(b
2075\&.b "bold face"
2076.)b
2077.pp
2078You can mix fonts in a word by using the
2079special sequence
2080.b \ec
2081at the end of a line
2082to indicate
2083.q "continue text processing" ;
2084this allows input lines
2085to be joined together
2086without a space inbetween them.
2087For example, the input:
2088.(b
2089\&.u under \ec
2090\&.i italics
2091.)b
2092generates
2093.u under \c
2094.i italics ,
2095but if we had typed:
2096.(b
2097\&.u under
2098\&.i italics
2099.)b
2100the result would have been
2101.u under
2102.i italics
2103as two words.
2104.sh 2 "Point Sizes"
2105.pp
2106The phototypesetter
2107supports different sizes of type,
2108measured in points.
2109The default point size
2110is 10 points
2111for most text,
21128 points for footnotes.
2113To change the pointsize,
2114type:
2115.(b
2116\&.sz \c
2117.i +N
2118.)b
2119where
2120.i N
2121is the size wanted in points.
2122The
2123.i "vertical spacing"
2124(distance between the bottom of most letters
2125(the
2126.i baseline )
2127between adjacent lines)
2128is set to be proportional
2129to the type size.
2130.pp
2131Warning:
2132changing point sizes
2133on the phototypesetter
2134is a slow mechanical operation.
2135Size changes
2136should be considered carefully.
2137.sh 2 "Quotes"
2138.pp
2139It is conventional when using
2140the typesetter to
2141use pairs of grave and acute accents
2142to generate double quotes,
2143rather than the
2144double quote character
2145(`\|"\|').
2146This is because it looks better
2147to use grave and acute accents;
2148for example, compare
2149"quote" to
2150``quote''.
2151.pp
2152In order to make quotes compatible
2153between the typesetter and terminals,
2154you may use the sequences
2155.b \e*(lq
2156and
2157.b \e*(rq
2158to stand for the left and right quote
2159respectively.
2160These both appear as
2161.b """"
2162on most terminals,
2163but are typeset as
2164.b ``
2165and
2166.b ''
2167respectively.
2168For example,
2169use:
2170.(b
2171\e*(lqSome things aren\(aat true
2172even if they did happen.\e*(rq
2173.)b
2174to generate the result:
2175.(b
2176.q "Some things aren't true even if they did happen."
2177.)b
2178As a shorthand,
2179the special font request:
2180.(b
2181\&.q "quoted text"
2182.)b
2183will generate
2184.q "quoted text" .
2185Notice that you must surround
2186the material to be quoted
2187with double quote marks
2188if it is more than one word.
2189.sh 0
2190.sp 1i
2191.b Acknowledgments
2192.pp
2193I would like to thank
2194Bob Epstein,
2195Bill Joy,
2196and Larry Rowe
2197for having the courage
2198to use the \-me macros
2199to produce non-trivial papers
2200during the development stages;
2201Ricki Blau,
2202Pamela Humphrey,
2203and Jim Joyce
2204for their help with the documentation phase;
2205and the plethora of people who have contributed ideas
2206and have given support for the project.
2207.sp 1i
2208This document was
2209.if n \*N'ed
2210.if t \*T'ed
2211on \*(td
2212and applies to version
22131.1
2214of the \-me macros.