BSD 2 development
[unix-history] / doc / me / intro.nr
CommitLineData
2676dd22
EA
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,
1250the label will not be separated from the text,
1251and the rest of the text
1252will be lined up at the old margin
1253(and not with the first line of text).
1254For example,
1255the input:
1256.(b
1257\&.ip longlabel
1258This paragraph had a long label.
1259The first character of text on the first line
1260will not line up with the text on second and subsequent lines,
1261although they will line up with each other.
1262.)b
1263will produce:
1264.ip longlabel
1265This paragraph had a long label.
1266The first character of text on the first line
1267will not line up with the text on second and subsequent lines,
1268although they will line up with each other.
1269.pp
1270It is possible to change the size of the label
1271by using a second argument
1272which is the size of the label.
1273For example,
1274the above example could be done correctly
1275by saying:
1276.(b
1277\&.ip longlabel 10
1278.)b
1279which will make the paragraph indent
128010 spaces for this paragraph only.
1281If you have many paragraphs to indent
1282all the same amount,
1283use the
1284.i "number register"
1285.b ii .
1286For example, to leave one inch of space
1287for the label,
1288type:
1289.(b
1290\&.nr ii 1i
1291.)b
1292somewhere before the first call to
1293.b .ip .
1294Refer to the reference manual
1295for more information.
1296.pp
1297If
1298.b .ip
1299is used
1300with no argument at all
1301no hanging tag will be printed.
1302For example,
1303the input:
1304.(b
1305\&.ip [a]
1306This is the first paragraph of the example.
1307We have seen this sort of example before.
1308\&.ip
1309This paragraph is lined up with the previous paragraph,
1310but it has no tag in the margin.
1311.)b
1312produces as output:
1313.ip [a]
1314This is the first paragraph of the example.
1315We have seen this sort of example before.
1316.ip
1317This paragraph is lined up with the previous paragraph,
1318but it has no tag in the margin.
1319.pp
1320A special case of
1321.b .ip
1322is
1323.b .np ,
1324which automatically
1325numbers paragraphs sequentially from 1.
1326The numbering is reset at the next
1327.b .pp ,
1328.b .lp ,
1329or
1330.b .sh
1331(to be described in the next section)
1332request.
1333For example,
1334the input:
1335.(b
1336\&.np
1337This is the first point.
1338\&.np
1339This is the second point.
1340Points are just regular paragraphs
1341which are given sequence numbers automatically
1342by the .np request.
1343\&.pp
1344This paragraph will reset numbering by .np.
1345\&.np
1346For example,
1347we have reverted to numbering from one now.
1348.)b
1349generates:
1350.np
1351This is the first point.
1352.np
1353This is the second point.
1354Points are just regular paragraphs
1355which are given sequence numbers automatically
1356by the .np request.
1357.pp
1358This paragraph will reset numbering by .np.
1359.np
1360For example,
1361we have reverted to numbering from one now.
1362.sh 2 "Section Headings"
1363.pp
1364Section numbers
1365(such as the ones used in this document)
1366can be automatically generated
1367using the
1368.b .sh
1369request.
1370You must tell
1371.b .sh
1372the
1373.i depth
1374of the section number
1375and a section title.
1376The depth
1377specifies how many numbers
1378are to appear
1379(separated by decimal points)
1380in the section number.
1381For example,
1382the section number
1383.b 4.2.5
1384has a depth of three.
1385.pp
1386Section numbers
1387are incremented
1388in a fairly intuitive fashion.
1389If you add a number
1390(increase the depth),
1391the new number starts out
1392at one.
1393If you subtract section numbers
1394(or keep the same number)
1395the final number is incremented.
1396For example,
1397the input:
1398.(b
1399\&.sh 1 "The Preprocessor"
1400\&.sh 2 "Basic Concepts"
1401\&.sh 2 "Control Inputs"
1402\&.sh 3
1403\&.sh 3
1404\&.sh 1 "Code Generation"
1405\&.sh 3
1406.)b
1407produces as output the result:
1408.(b
1409.b
14101. The Preprocessor
14111.1. Basic Concepts
14121.2. Control Inputs
14131.2.1.
14141.2.2.
14152. Code Generation
14162.1.1.
1417.)b
1418.pp
1419You can specify the section number to begin
1420by placing the section number after the section title,
1421using spaces instead of dots.
1422For example,
1423the request:
1424.(b
1425\&.sh 3 "Another section" 7 3 4
1426.)b
1427will begin the section numbered
1428.b 7.3.4 ;
1429all subsequent
1430.b .sh
1431requests will number relative to this number.
1432.pp
1433There are more complex features
1434which will cause each section to be indented
1435proportionally to the depth of the section.
1436For example, if you enter:
1437.(b
1438\&.nr si \c
1439.i N
1440.)b
1441each section will be indented by an amount
1442.i N .
1443.i N
1444must have a scaling factor attached,
1445that is, it must be of the form
1446.i Nx ,
1447where
1448.i x
1449is a character telling what units
1450.i N
1451is in.
1452Common values for
1453.i x
1454are
1455.b i
1456for inches,
1457.b c
1458for centimeters,
1459and
1460.b n
1461for
1462.i ens
1463(the width of a single character).
1464For example,
1465to indent each section
1466one-half inch,
1467type:
1468.(b
1469\&.nr si 0.5i
1470.)b
1471After this,
1472sections will be indented by
1473one-half inch
1474per level of depth in the section number.
1475For example,
1476this document was produced
1477using the request
1478.(b
1479\&.nr si 3n
1480.)b
1481at the beginning of the input file,
1482giving three spaces of indent
1483per section depth.
1484.pp
1485Section headers without automatically generated numbers
1486can be done using:
1487.(b
1488\&.uh "Title"
1489.)b
1490which will do a section heading,
1491but will put no number on the section.
1492.sh 2 "Parts of the Basic Paper"
1493.pp
1494There are some requests
1495which assist in setting up
1496papers.
1497The
1498.b .tp
1499request
1500initializes for a title page.
1501There are no headers or footers
1502on a title page,
1503and unlike other pages
1504you can space down
1505and leave blank space
1506at the top.
1507For example,
1508a typical title page might appear as:
1509.(b
1510\&.tp
1511\&.sp 2i
1512\&.(l C
1513THE GROWTH OF TOENAILS
1514IN UPPER PRIMATES
1515\&.sp
1516by
1517\&.sp
1518Frank N. Furter
1519\&.)l
1520\&.bp
1521.)b
1522.pp
1523The request
1524.b .th
1525sets up the environment
1526of the \*N processor
1527to do a thesis,
1528using the rules established at Berkeley.
1529It defines the correct headers and footers
1530(a page number in the upper right hand corner only),
1531sets the margins correctly,
1532and double spaces.
1533.pp
1534The
1535.b .+c \ \c
1536.i T
1537request can be used
1538to start chapters.
1539Each chapter is automatically numbered
1540from one,
1541and a heading is printed at the top of each chapter
1542with the chapter number
1543and the chapter name
1544.i T .
1545For example,
1546to begin a chapter called
1547.q Conclusions ,
1548use the request:
1549.(b
1550\&.+c "CONCLUSIONS"
1551.)b
1552which will produce,
1553on a new page,
1554the lines
1555.(b C
1556CHAPTER 5
1557CONCLUSIONS
1558.)b
1559with appropriate spacing for a thesis.
1560Also, the header is moved to the foot of the page
1561on the first page of a chapter.
1562Although the
1563.b .+c
1564request was not designed to work only with the
1565.b .th
1566request,
1567it is tuned for the format acceptable
1568for a PhD thesis
1569at Berkeley.
1570.pp
1571If the
1572title parameter
1573.i T
1574is omitted from the
1575.b .+c
1576request,
1577the result is a chapter with no heading.
1578This can also be used at the beginning
1579of a paper;
1580for example,
1581.b .+c
1582was used to generate page one
1583of this document.
1584.pp
1585Although
1586papers traditionally have the abstract,
1587table of contents,
1588and so forth at the front of the paper,
1589it is more convenient to format
1590and print them last
1591when using \*N.
1592This is so that index entries
1593can be collected and then printed
1594for the table of contents
1595(or whatever).
1596At the end of the paper,
1597issue the
1598.b ".++ P"
1599request,
1600which begins the preliminary part
1601of the paper.
1602After issuing this request,
1603the
1604.b .+c
1605request will begin a preliminary section
1606of the paper.
1607Most notably,
1608this prints the page number
1609restarted from one
1610in lower case Roman numbers.
1611.b .+c
1612may be used repeatedly
1613to begin different parts of the
1614front material
1615for example,
1616the abstract,
1617the table of contents,
1618acknowledgments,
1619list of illustrations,
1620etc.
1621The request
1622.b ".++ B"
1623may also be used
1624to begin the bibliographic section
1625at the end of the paper.
1626For example,
1627the paper might appear
1628as outlined in figure 2.
1629(In this figure,
1630comments begin with the sequence
1631.b \e" .)
1632.(z
1633.hl
1634.if t .in 0.5i
1635.if t .ta 2i
1636.if n .ta 3i
1637\&.th \e" set for thesis mode
1638\&.fo \(aa\(aaDRAFT\(aa\(aa \e" define footer for each page
1639\&.tp \e" begin title page
1640\&.(l C \e" center a large block
1641THE GROWTH OF TOENAILS
1642IN UPPER PRIMATES
1643\&.sp
1644by
1645\&.sp
1646Frank Furter
1647\&.)l \e" end centered part
1648\&.+c INTRODUCTION \e" begin chapter named "INTRODUCTION"
1649\&.(x t \e" make an entry into index `t'
1650Introduction
1651\&.)x \e" end of index entry
1652text of chapter one
1653\&.+c "NEXT CHAPTER" \e" begin another chapter
1654\&.(x t \e" enter into index `t' again
1655Next Chapter
1656\&.)x
1657text of chapter two
1658\&.+c CONCLUSIONS
1659\&.(x t
1660Conclusions
1661\&.)x
1662text of chapter three
1663\&.++ B \e" begin bibliographic information
1664\&.+c BIBLIOGRAPHY \e" begin another `chapter'
1665\&.(x t
1666Bibliography
1667\&.)x
1668text of bibliography
1669\&.++ P \e" begin preliminary material
1670\&.+c "TABLE OF CONTENTS"
1671\&.xp t \e" print index `t' collected above
1672\&.+c PREFACE \e" begin another preliminary section
1673text of preface
1674.sp 2
1675.in 0
1676.ce
1677Figure 2. Outline of a Sample Paper
1678.hl
1679.)z
1680.sh 2 "Equations and Tables"
1681.pp
1682Two special \*U programs exist
1683to format special types of material.
1684.b Eqn
1685and
1686.b neqn
1687set equations
1688for the phototypesetter
1689and \*N respectively.
1690.b Tbl
1691arranges to print
1692extremely pretty tables
1693in a variety of formats.
1694This document will only describe
1695the embellishments
1696to the standard features;
1697consult the reference manuals
1698for those processors
1699for a description of their use.
1700.pp
1701The
1702.b eqn
1703and
1704.b neqn
1705programs are described fully
1706in the document
1707.ul
1708Typesetting Mathematics \- Users' Guide
1709by Brian W. Kernighan
1710and Lorinda L. Cherry.
1711Equations are centered,
1712and are kept on one page.
1713They are introduced by the
1714.b .EQ
1715request and terminated by the
1716.b .EN
1717request.
1718.pp
1719The
1720.b .EQ
1721request may take an
1722equation number as an
1723optional argument,
1724which is printed vertically centered
1725on the right hand side
1726of the equation.
1727If the equation becomes too long
1728it should be split
1729between two lines.
1730To do this, type:
1731.(b
1732\&.EQ (eq 34)
1733text of equation 34
1734\&.EN C
1735\&.EQ
1736continuation of equation 34
1737\&.EN
1738.)b
1739The
1740.b C
1741on the
1742.b .EN
1743request
1744specifies that the equation
1745will be continued.
1746.pp
1747The
1748.b tbl
1749program produces tables.
1750It is fully described
1751(including numerous examples)
1752in the document
1753.ul
1754Tbl \- A Program to Format Tables
1755by M. E. Lesk.
1756Tables begin with the
1757.b .TS
1758request
1759and end with the
1760.b .TE
1761request.
1762Tables are normally kept on a single page.
1763If you have a table which is too big
1764to fit on a single page,
1765so that you know it will extend
1766to several pages,
1767begin the table with the request
1768.b ".TS\ H"
1769and put the request
1770.b .TH
1771after the part of the table
1772which you want
1773duplicated at the top of every page
1774that the table is printed on.
1775For example, a table definition
1776for a long table might look like:
1777.ds TA \|\h'.4n'\v'-.2n'\s-4\zT\s0\v'.2n'\h'-.4n'\(ci\|
1778.if n .ds TA \ \o'-T'\ \"
1779.(b
1780\&.TS H
1781c s s
1782n n n.
1783THE TABLE TITLE
1784\&.TH
1785text of the table
1786\&.TE
1787.)b
1788.pp
1789.sh 2 "Two Column Output"
1790.pp
1791You can get two column output
1792automatically
1793by using the request
1794.b .2c .
1795This causes everything after it
1796to be output in two-column form.
1797The request
1798.b .bc
1799will start a new column;
1800it differs from
1801.b .bp
1802in that
1803.b .bp
1804may leave a totally blank column
1805when it starts a new page.
1806To revert to single column output,
1807use
1808.b .1c .
1809.sh 2 "Defining Macros"
1810.pp
1811A
1812.i macro
1813is a collection of requests and text
1814which may be used
1815by stating a simple request.
1816Macros begin with the line
1817.b ".de" \ \c
1818.i xx
1819(where
1820.i xx
1821is the name of the macro to be defined)
1822and end with the line consisting of two dots.
1823After defining the macro,
1824stating the line
1825.b . \c
1826.i xx
1827is the same as stating all the other lines.
1828For example,
1829to define a macro
1830that spaces 3 lines
1831and then centers the next input line,
1832enter:
1833.(b
1834\&.de SS
1835\&.sp 3
1836\&.ce
1837\&..
1838.)b
1839and use it by typing:
1840.(b
1841\&.SS
1842\&Title Line
1843(beginning of text)
1844.)b
1845.pp
1846Macro names may be one or two characters.
1847In order to avoid conflicts
1848with names in \-me,
1849always use upper case letters as names.
1850The only names to avoid are
1851.b TS ,
1852.b TH ,
1853.b TE ,
1854.b EQ ,
1855and
1856.b EN .
1857.sh 2 "Annotations Inside Keeps"
1858.pp
1859Sometimes you may want to put
1860a footnote
1861or index entry inside a keep.
1862For example,
1863if you want to maintain a
1864.q "list of figures"
1865you will want to do something like:
1866.(b
1867\&.(z
1868\&.(c
1869text of figure
1870\&.)c
1871\&.ce
1872Figure 5.
1873\&.(x f
1874Figure 5
1875\&.)x
1876\&.)z
1877.)b
1878which you may hope
1879will give you a figure
1880with a label
1881and an entry in the index
1882.b f
1883(presumably a list of figures index).
1884Unfortunately,
1885the
1886index entry
1887is read and interpreted
1888when the keep is read,
1889not when it is printed,
1890so the page number in the index is likely to be wrong.
1891The solution is to use the magic string
1892.b \e!
1893at the beginning of all the lines dealing with the index.
1894In other words,
1895you should use:
1896.(b
1897\&.(z
1898\&.(c
1899Text of figure
1900\&.)c
1901\&.ce
1902Figure 5.
1903\e!.(x f
1904\e!Figure 5
1905\e!.)x
1906\&.)z
1907.)b
1908which will defer the processing of the index
1909until the figure is output.
1910This will guarantee
1911that the page number in the index
1912is correct.
1913The same comments apply
1914to
1915blocks
1916(with
1917.b .(b
1918and
1919.b .)b )
1920as well.
1921.sh 1 "\*T and the Photosetter"
1922.pp
1923With a little care,
1924you can prepare
1925documents that
1926will print nicely
1927on either a regular terminal
1928or when phototypeset
1929using the \*T formatting program.
1930.sh 2 "Fonts"
1931.pp
1932A
1933.i font
1934is a style of type.
1935There are three fonts
1936that are available simultaneously,
1937Times Roman,
1938Times Italic,
1939and Times Bold,
1940plus the special math font.
1941The normal font is Roman.
1942Text which would be underlined in \*N
1943with the
1944.b .ul
1945request
1946is set in italics
1947in \*T.
1948.pp
1949There are ways of switching between fonts.
1950The requests
1951.b .r ,
1952.b .i ,
1953and
1954.b .b
1955switch to Roman,
1956italic,
1957and bold fonts respectively.
1958You can set a single word
1959in some font
1960by typing (for example):
1961.(b
1962\&.i word
1963.)b
1964which will set
1965.i word
1966in italics
1967but does not affect the surrounding text.
1968In \*N,
1969italic and bold text
1970is underlined.
1971.pp
1972Notice that if you are setting more than one word
1973in whatever font,
1974you must surround that word with double quote marks
1975(`\|"\|')
1976so that it will appear to the \*N processor as a single word.
1977The quote marks will not appear in the formatted text.
1978If you do want a quote mark to appear,
1979you should quote the entire string
1980(even if a single word),
1981and use
1982.i two
1983quote marks where you want one to appear.
1984For example,
1985if you want to produce the text:
1986.(b
1987.i """Master Control\|"""
1988.)b
1989in italics, you must type:
1990.(b
1991\&.i """Master Control\e|"""
1992.)b
1993The
1994.b \e|
1995produces a very narrow space
1996so that the
1997.q l
1998does not overlap the quote sign in \*T,
1999like this:
2000.(b
2001.i """Master Control"""
2002.)b
2003.pp
2004There are also several
2005.q pseudo-fonts
2006available.
2007The input:
2008.(b
2009\&.(b
2010\&.u underlined
2011\&.bi "bold italics"
2012\&.bx "words in a box"
2013\&.)b
2014.)b
2015generates
2016.(b
2017.u underlined
2018.bi "bold italics"
2019.bx "words in a box"
2020.)b
2021In \*N these all just underline
2022the text.
2023Notice that pseudo font requests
2024set only the single parameter in the pseudo font;
2025ordinary font requests will begin setting all text
2026in the special font
2027if you do not provide a parameter.
2028No more than one word
2029should appear
2030with these three font requests
2031in the middle of lines.
2032This is because
2033of the way \*T justifies text.
2034For example,
2035if you were to issue the requests:
2036.(b
2037\&.bi "some bold italics"
2038and
2039\&.bx "words in a box"
2040.)b
2041in the middle of a line
2042\*T would produce
2043.bi "some bold italics"
2044and
2045.bx "words in a box" ,\c
2046.if t \p
2047.if n \& \"
2048.if t which I think you will agree does not look good.
2049.if n which would look really lousy in \*T.
2050.pp
2051The second parameter
2052of all font requests
2053is set in the original font.
2054For example,
2055the font request:
2056.(b
2057\&.b bold face
2058.)b
2059generates
2060.q bold
2061in bold font,
2062but sets
2063.q face
2064in the font of the surrounding text,
2065resulting in:
2066.(b
2067.b bold face.
2068.)b
2069To set the two words
2070.b bold
2071and
2072.b face
2073both in
2074.b "bold face" ,
2075type:
2076.(b
2077\&.b "bold face"
2078.)b
2079.pp
2080You can mix fonts in a word by using the
2081special sequence
2082.b \ec
2083at the end of a line
2084to indicate
2085.q "continue text processing" ;
2086this allows input lines
2087to be joined together
2088without a space inbetween them.
2089For example, the input:
2090.(b
2091\&.u under \ec
2092\&.i italics
2093.)b
2094generates
2095.u under \c
2096.i italics ,
2097but if we had typed:
2098.(b
2099\&.u under
2100\&.i italics
2101.)b
2102the result would have been
2103.u under
2104.i italics
2105as two words.
2106.sh 2 "Point Sizes"
2107.pp
2108The phototypesetter
2109supports different sizes of type,
2110measured in points.
2111The default point size
2112is 10 points
2113for most text,
21148 points for footnotes.
2115To change the pointsize,
2116type:
2117.(b
2118\&.sz \c
2119.i +N
2120.)b
2121where
2122.i N
2123is the size wanted in points.
2124The
2125.i "vertical spacing"
2126(distance between the bottom of most letters
2127(the
2128.i baseline )
2129between adjacent lines)
2130is set to be proportional
2131to the type size.
2132.pp
2133Warning:
2134changing point sizes
2135on the phototypesetter
2136is a slow mechanical operation.
2137Size changes
2138should be considered carefully.
2139.sh 2 "Quotes"
2140.pp
2141It is conventional when using
2142the typesetter to
2143use pairs of grave and acute accents
2144to generate double quotes,
2145rather than the
2146double quote character
2147(`\|"\|').
2148This is because it looks better
2149to use grave and acute accents;
2150for example, compare
2151"quote" to
2152``quote''.
2153.pp
2154In order to make quotes compatible
2155between the typesetter and terminals,
2156you may use the sequences
2157.b \e*(lq
2158and
2159.b \e*(rq
2160to stand for the left and right quote
2161respectively.
2162These both appear as
2163.b """"
2164on most terminals,
2165but are typeset as
2166.b ``
2167and
2168.b ''
2169respectively.
2170For example,
2171use:
2172.(b
2173\e*(lqSome things aren\(aat true
2174even if they did happen.\e*(rq
2175.)b
2176to generate the result:
2177.(b
2178.q "Some things aren't true even if they did happen."
2179.)b
2180As a shorthand,
2181the special font request:
2182.(b
2183\&.q "quoted text"
2184.)b
2185will generate
2186.q "quoted text" .
2187Notice that you must surround
2188the material to be quoted
2189with double quote marks
2190if it is more than one word.
2191.sh 0
2192.sp 1i
2193.b Acknowledgments
2194.pp
2195I would like to thank
2196Bob Epstein,
2197Bill Joy,
2198and Larry Rowe
2199for having the courage
2200to use the \-me macros
2201to produce non-trivial papers
2202during the development stages;
2203Ricki Blau,
2204Pamela Humphrey,
2205and Jim Joyce
2206for their help with the documentation phase;
2207and the plethora of people who have contributed ideas
2208and have given support for the project.
2209.sp 1i
2210This document was
2211.if n \*N'ed
2212.if t \*T'ed
2213on \*(td
2214and applies to version
22151.1
2216of the \-me macros.