home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-24 | 33.1 KB | 1,145 lines |
- Newsgroups: comp.sources.misc
- From: bw@uecok.UUCP (Bill Walker CS Faculty)
- subject: v13i065: wroff - text formatter for HP LaserJet with PP 25-font cartridge
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 13, Issue 65
- Submitted-by: bw@uecok.UUCP (Bill Walker CS Faculty)
- Archive-name: wroff/part02
-
- echo Making directory doc
- mkdir doc
- echo x - doc/wroff.1.w
- sed 's/^X//' >doc/wroff.1.w <<'*-*-END-of-doc/wroff.1.w-*-*'
- X.fo \f0Bill Walker/page #/October 27, 1989\fP
- X.NAME wroff
- X.SYNOPSIS
- Xwroff [-sdpk] [-b n] [-e n] [-o outfile] [-t #] filelist
- X
- X.FUNCTION
- Xwroff is a general text formatting program. Options:
- X.sp
- X.nf
- X.in +5
- XSwitch Action
- X.in +2
- X
- X-p Do not effect font changes (default is p)
- X-b begin printing with page n (default 1)
- X-e end printing with page n (default 32767)
- X-o place output on outfile
- X-k do not use formfeeds to advance to new page
- X-s scan text for errors only - do not print
- X-t # expand tabstops (default 8 spaces)
- X (use -t 0 to retain tab characters)
- X-v print version number -- no text processing
- X
- X.in -7
- X.fi
- X.PP
- XSwitch "-p" causes special characters such as
- Xthose that produce italics or boldface not to be output.
- XAn unrecognized command will cause wroff to terminate.
- X.PP
- XWhen writing to standard output, wroff does not emit special
- Xcharacters. This allows work to be previewed on the screen
- Xbefore it is printed. However, the screen only approximates
- Xthe true output.
- X.PP
- XThe wroff commands are discussed in the following pages.
- X.BUGS
- XThe "preview" mechanism should provide more realistic output.
- X.bp
- X.in 5
- X.nf
- X.ce 2
- X.bd 2
- X.it 1
- XWroff
- XCommands
- X.sp 2
- X\fT
- XCommand default Effect
- X
- X.cc !
- X!in +2
- X.bd n 1 boldface next n lines
- X.bp n next advance to next page
- X.br none break
- X.cc c . change command char to c
- X.ce n 1 center next n lines
- X.dc c / change delimiter to c in titles
- X.de name none start macro definition
- X.di XX none start diversion to XX
- X.ed none end diversion
- X.en none end macro definition
- X.et none end transparent mode
- X.fi true set fill on
- X.fm fontname P18bl mount font on post M
- X.fo string "/page #/" define footer
- X.gx x 0 move horizontally x dots
- X.gy y 0 move vertically y dots
- X.he string none define header
- X.hr n 0 horizontal rule, length n
- X.if (expr) XX if (expr) is true, call macro XX
- X.in n 10 set left margin to n
- X.it n 1 italicize next n lines
- X.ju true justify right margin
- X.lp str none label indented paragraph
- X.ls n 1 set line spacing to n
- X.m3 n 24 margin (dots) before footer
- X.ne n 1 need n lines
- X.nf n false,n=2 set fill off, theshold to n
- X.nj false do not justify right margin
- X.pc c # set page char to c
- X.pl n 480 set page length to n dots
- X (48 per vertical inch )
- X.pm n 10 place paragraph labels left
- X by this much (characters)
- X.rj n current process left jagged, right justified
- X right margin use .rj 0 to turn off
- X.rm n 70 set right margin to n
- X.rt none reset traps
- X.so name none source a file
- X.sp n 1 space down n lines
- X.ti n 0 temporary indent by n
- X.tf string "l c r" title format
- X.tl XX string none set variable XX to string
- X.tm none enter transparent mode
- X.vr n 0 vertical rule, length n
- X.vs n 12 vertical spacing between lines
- X (dots)
- X.ul n 1 underline next n lines
- X.wh n XX none set trap XX at vertical position n
- X.. none comment line
- X\\fc none embedded font change
- X (c = B, I, M, T, U, P, 0, 1, 2)
- X\\{XX} none interpolate macro XX
- X\\(reg) none interpolate register reg as an integer
- X\\(regC) none interpolate register reg as a character
- X\\[expr] none evaluate register expression
- X\\f| none provide "anchor" in nonfill mode
- X
- X!cc .
- X.bp
- X\fP
- X.ce
- X\fIVariables\fP
- X.nf
- X
- XAll measurements in "dots"
- X.sp 2
- X registers and default values
- X
- X # = 1 \f| start at page 1
- X A = 2 \f| the next page
- X B = 24 \f| bottom margin of 24 dots
- X C = 0 \f| center this many lines
- X D = 0 \f| vertical length of last diversion
- X E = 0 \f| italicize next n lines
- X F = 0 \f| current font
- X G = 0 \f| boldface next n lines
- X H = TRUE \f| justify lines
- X I = TRUE \f| start in FILLMODE = TRUE
- X J = '/' \f| a SLASH mark
- X L = 300 \f| left margin of 300 dots - 1 inch
- X M = 0 \f| temporary indent
- X O = '#' \f| page character
- X P = 480 \f| page length
- X Q = 0 \f| number of printable characters in outbuf
- X R = 2100 \f| right margin of 2100 dots - 7 inches
- X S = 1 \f| line spacing
- X T = 0 \f| top margin of 0 dots
- X U = 30 \f| width of a space character in dots
- X V = 10 \f| current vertical spacing
- X W = 10 \f| indented paragraph start in characters
- X X = 0 \f| current horizontal position
- X Y = REG('T') \f| current vertical position
- X Z = FALSE \f| underline state
- X ! = 8 \f| tabstops every 8 characters
- X _ = 24 \f| margin before footer
- X.bp
- X.fi
- X.ce 10
- X\fIWroff Commands\fP
- X.ce 0
- X.sp 2
- X.de CMD
- X.in 20
- X.sp
- X.lp $1 $2
- X.en
- X
- X.CMD bd
- X"bd n" is used to boldface the next n lines. If n is not specified,
- Xthe
- Xdefault is to boldface the next line.
- XSince \fBwroff\fP supports in-line font changes, this command is
- Xnot really very useful.
- X.CMD bp
- X"bp n" is used to advance to the next page and number it "n". If
- X"n" is not specified, the default is to number pages
- Xsequentially.
- X.CMD br
- XThe "br" command will always cause any collected output to
- Xbe printed.
- X.CMD cc
- XThe "command character" is the character that preceeds an embedded command.
- XThe character defaults to a ".", but can be changed to any
- Xcharacter by issuing "cc c", where c is any character.
- X.CMD ce
- X"ce n" centers the next n lines. If n is not specified, the
- Xdefault is to center the next line.
- X.CMD dc
- XIn titles, such as the footers and headers, the fields are
- Xdelineated by using a "delimiter character". For instance,
- Xthe default footer is "/page #/". The "/" delimits the
- Xfields. This delimiter (default "/") can be changed by
- Xusing the "dc c" command.
- X.CMD de
- XThis command starts a macro definition. Use "de name" to
- Xbegin the definition of a macro named "name". There is no
- Xdefault name. A macro definition will continue until the
- X"en" command is recognized.
- X.CMD di
- XStart a diversion named "name" by issuing "di name". Text
- Xis copied into the diversion until the "ed" command is
- Xfound.
- X.CMD ed
- XEnd a diversion.
- X.CMD en
- XEnd a macro. Caution: if you define a macro, be sure to
- Xend it!
- X.CMD et
- XEnd transparent print. Any lines between "tm" and "et" will
- Xbe copied to the output without any processing (other than
- Xfor margins ).
- X.CMD fi
- X"fi" tells \fBwroff\fP to begin to fill lines. That means
- Xthat both the left and the right margins will appear
- Xstraight.
- X.CMD fm
- XThe "fm name" command mounts a font with the given name on
- Xfont post "M". To access that font, use \\fM to start, and
- X\\fP to return to the previous font.
- XThere is a list of available fonts at the end of this
- Xdocument.
- X.CMD fo
- X"fo string" defines the page footer to be "string". The
- Xstring is constructed by examining the title format string,
- Xwhich is defined by "tf", and replacing any page character
- Xby the current page number. (See "pc" to change the page
- Xcharacter.)
- XThe placement of the footer on the page can be controled by
- Xusing "m3".
- X.CMD gx
- X"gx x" is the "go to x" command. "x" is measured in "dots"
- Xfrom the left printable margin. There are 300 "dots" to an
- Xinch. "gx" is used to move horizontally across a page.
- X.CMD gy
- X"gy y" is the "go to y" command. "y" is measured in "dots"
- Xfrom the top printable margin. There are 48 "dots" to an
- Xinch. "gy" is used to move vertically in a page.
- X.CMD he
- X"he string" sets the page header, in the same way that "fo"
- Xsets the footer.
- X.CMD hr
- X"hr n" draws a horizontal rule (a line) from the current x position
- Xto the right. This line is of length n (default 0) in dots.
- X.CMD if
- X"if (expr) macname" will evaluate the expression and execute the
- Xmacro names "macname" if the expression is true.
- XIf the expression is an arithmetic expression, the evaluator
- Xregards "0" as "TRUE".
- X.CMD in
- XThe "in n" command controls the left margin. The default for n is 10.
- XIn contrast to other commands, n is measured in deci-inches. The default
- Xleft margin is therefore 1 inch from the left printable margin.
- X.CMD it
- X"it n" will italicize the next n lines. The default is to italicize
- Xone line. Since \fBwroff\fP supports in-line font changes, this command
- Xis not really useful.
- X.CMD ju
- XIssuing "ju" will cause right margin justification to take place. To
- Xgain a "ragged right" margin, turn justification off with "nj".
- X.CMD lp
- XUse "lp str" to label a paragraph with the string "str". This label is
- Xplaced to the left of the paragraph a distance of 10 deci-inches. This
- Xdistance can be changed with the "pm" command.
- X.CMD ls
- XUse "ls n" to set the line spacing to n. (The default is 1). For instance,
- Xto double space output, use "ls 2".
- X.CMD m3
- XBefore placing a footer, wroff provides a small margin. The default is to provide
- Xone-half inch (24 dots), and then place the footer. This can be changed
- Xby using "m3 n", where n is measured in dots. (48 dots per vertical inch.)
- X.CMD ne
- X"ne n" means that \fBwroff\fP should guarantee that there
- Xis at least n lines left on the current page (default n=1). If this much
- Xspace does not remain on the current page, \fBwroff\fP will turn up a new
- Xpage before proceeding.
- X.CMD nf
- XThe "nf" command causes \fBwroff\fP to process in non-fill
- Xmode. In fill mode, as many words as possible are packed on
- Xa line before the line is printed. If "justify" mode (see
- X"ju" and "nj") is also on, the right margin is also
- Xjustified. The "nf" command turns fill mode off, and in
- Xeffect causes lines to appear as they are typed. This is
- Xespecially useful for tables. The "anchor" character (see
- Xbelow) will be helpful in making tables line up properly.
- X.CMD nj
- XEnter "non-justify" mode.
- XIn non-justify mode, the right margin is not justified.
- XNon-justify mode can coexist with fill mode to pack as many
- Xwords as possible on a line, without squaring up the right
- Xmargin. The default mode is "justify".
- X.CMD pc
- XIn headers or footers, the (default) symbol "#" is used to represent
- Xsomething that should be replaced with the current page
- Xnumber. The symbol "#" can be changed to any character c by
- Xusing "pc c".
- X.CMD pl
- X"pl n" is used to set the length of a page to n dots.
- X(default is n=480, or 10 inches) This command is little
- Xused, unless you use odd sized paper in your laser printer.
- X.CMD pm
- XSee the "lp" command above. The "pm n" command (default
- Xn=10) sets the margin for a paragraph label. The parameter
- Xn is measured in deci-inches.
- X.CMD rj
- XUse the "rj" command to cause text to be justified on the
- Xright, with a ragged left margin. This is useful for
- X"glitzy" work.
- X.CMD rm
- XThe "rm n" command sets the right margin. "n" is measured
- Xin deci-inches, with a default of 70 (7 inches).
- X.CMD rt
- XWhen "traps" (see "wh") are placed on a page, the
- Xtraps are "sprung" as the location at which they are placed
- Xis passed. A "sprung" trap will not be sprung a second time
- Xon the same page. If you want to "reset" a trap for some
- Xreason (perhaps you used "gy" to move above it), use "rt"
- Xto reset \fIall\fP the traps on a page. It is not possible
- Xto selectively reset traps.
- X.CMD so
- XSource an external file. "so filename" will attempt to
- Xlocate file "filename" and include it as though it were part
- Xof the current file. Nested "so" commands are legal. i.e.
- Xa file that is 'sourced' may in turn 'source' another file.
- X.CMD sp
- XSpace down n lines by using "sp n". The default for n is
- X1.
- X.CMD ti
- XUse "ti n" (default n=0) to indent \fIonly the next line\fP
- Xby n deci-inches. (Think "temporary indent")
- X.CMD tf
- XA "title format" is a string that tells the tl command
- X(below) how to interpret a given string.
- XThe current title format is used to interpolate strings
- Xusing the "tl" command.
- XThe default title format is "l c r", meaning to interpret
- Xthe string as having three fields, delimited by "/" (see
- X"dc"). The first field will be left-justified, the second
- Xfield will be centered, and the third
- Xfield
- Xwill be
- Xright justified, all within printed fields computed from the
- Xnumber of fields specified in the title format.
- XTo place the second field at the right of the center printed
- Xfield, use "tf l r r".
- X.CMD tl
- X"tl string" is used to interpolate the string into the output, where the
- Xstring is formatted according to the current 'title format'. (See "tf".)
- X.CMD tm
- XEnter transparent print mode. No further processing is done
- Xon text, but the text is copied directly from input to
- Xoutput until command "et" is encountered. No font changes
- Xare executed, and \fBwroff\fP is likely to lose track of
- Xcurrent positions on the page. Use "tm" only \fIin
- Xextremis\fP.
- X.CMD vr
- XDraw a vertical line n dots (48 per inch) long starting at the current
- Xposition. Note that the positive direction is "down" the
- Xpage.
- X.CMD vs
- XAdjust the vertical spacing between lines of print. This is
- Xoften useful to help "squeeze" a document onto a single
- Xpage. "vs -1" will squeeze lines closer together by 1
- Xvertical dot. The default is to space by 12 dots.
- X.CMD ul
- XUse "ul n" to underline the next n lines. (default n = 1)
- X.CMD wh
- XSet a trap.
- XThe "wh" command has an unusual syntax. The command "wh n
- XNAME" will execute macro "NAME" when the current vertical position
- Xon the page passes position n. The syntax "wh -24 NP" would
- Xfire macro NP when the current vertical position was within
- X24 dots of the bottom of the page. The macro must be
- Xdefined elsewhere. Beware of firing undefined macros. A
- Xmacro must be defined before the trap is fired, but need not
- Xbe defined before the trap is set. It is legal to change a
- Xmacro definition without resetting a trap.
- X.CMD .
- XThe ".." command is a comment marker. Actually,
- Xthe command should really be "CMDCHAR .", where the CMDCHAR
- Xis set by the "cc" command. The rest of a line after ".."
- Xis taken as a comment.
- X.in 10
- X.bp
- X.ce
- X\fBIn-Line Actions\fP
- X.sp 3
- X.PP
- X\fBwroff\fP has the ability to deal with various fonts. It can also
- Xinterpolate the value of a variable into the output stream, or call a
- Xmacro from anywhere within a line.
- XAll of this is accomplished with "In-Line Actions".
- X.PP
- XIn-Line Actions
- Xcan be placed anywhere within a line of text.
- X(This is opposed to \fIembedded commands\fP, which were
- Xdiscussed above, and which must appear on a line by
- Xthemselves.) The "backslash" symbol (\\) is used to signal
- X\fBwroff\fP that an in-line action is present.
- X.PP
- XThe possible in-line actions are listed below:
- X.nf
- X.sp 2
- Xcommand \f|Action
- X.in +2
- X\\fc \f|in-line font change
- X \f| where c = B, I, M, T, U, P, 0, 1, 2, other
- X \f| B - \f|boldface
- X \f| I - \f|italicize
- X \f| M - \f|mountable
- X \f| T - \f|Courier (fixed)
- X \f| U - \f|toggle underline
- X \f| P - \f|return to previous
- X \f| 0 - \f|default font (Times Roman)
- X \f| 1 - \f|Presentation 18 point
- X \f| 2 - \f|Helvetica 6 point
- X \f| other - \f|interpolate "other" char
- X
- X\\{XX} \f|interpolate macro named XX
- X\\(reg) \f|interpolate the value of register reg
- X \f| as an integer
- X\\(regC) \f|interpolate the value of register reg
- X \f| as a character
- X\\[expr] \f|evaluate register expression -
- X \f| do not interpolate, see \\(reg) above
- X\\f| \f|place "anchor" in text
- X.sp 2
- X.in -2
- X.fi
- *-*-END-of-doc/wroff.1.w-*-*
- echo x - doc/wroff.tut.w
- sed 's/^X//' >doc/wroff.tut.w <<'*-*-END-of-doc/wroff.tut.w-*-*'
- X.fo \f0Bill Walker/page #/October 18, 1989\fP
- X.ce 10
- X\fBWroff Tutorial\fP
- X.ce 0
- X.sp 3
- X.in +5
- X.de PP
- X.sp
- X.ti +5
- X.en
- X.de OP
- X.sp
- X.ti -5
- X.en
- X.OP
- X\fBIntroduction:\fP
- X.ls 2
- X.PP
- X"Wroff" is a general purpose text formatter,
- Xwritten in the spirit of Unix's \f2trademark of AT&T\fP
- X\f1*roff\fP family. The purpose
- Xof this document is to make the reader able to use "wroff"
- Xfor preparing documents.
- X.PP
- XWroff has been specifically "tuned" to the Hewlett-Packard
- XLaserJet II printer. Most of the system defaults will
- Xprovide some reasonable output no matter \fBwhat\fP input is
- Xpresented. The LaserJet can do \fBboldface\fP, \fUunderlining\fU,
- Xor even a \fB\fUcombination\fU\fP of the two. Wroff
- Xsupports \fIitalics\fP as well. Wroff is aware that a page has
- X60 lines, and that a page should be printed with a left
- Xmargin of 1 inch. (These can both be changed, of course.)
- X.PP
- XWroff, when processing text, will space twice after periods,
- Xquestion marks, exclamation marks, and colons.
- X.PP
- XThis document was prepared using\f1 wroff\fP.
- X.ls 1
- X.bp
- X.OP
- X\fBEmbedded Commands:\fP
- X.PP
- XWroff works by reading a text file,
- X(created by using "vi" under Unix) and rearranging the
- Xcontents of the file according to instructions which you
- Xgive by "embedding" certain commands in the file.
- X.PP
- XAn example of an embedded command would be this:
- X.cc #
- X
- X#nf
- X#in +5
- X.ce 3
- XThese three lines should
- Xbe centered on
- Xthe page.
- X
- X#cc .
- X
- X.in -5
- X.fi
- X
- XThe resulting output of wroff would be:
- X
- X.ce 3
- XThese three lines should
- Xbe centered on
- Xthe page.
- X
- X.PP
- XThe three lines are centered as a result of the ".ce 3"
- Xcommand being embedded in the text. ".ce 3" means "center
- Xthe next three lines."
- X.PP
- XThis is an example of an embedded command. There are about
- Xforty such commands, most of which are not needed for
- Xordinary work. An average document will require only two or
- Xthree of the commands. The rest are present just to do
- X"fancy stuff".
- X.PP
- XAn embedded command is usually the only command on a line, and it
- Xusually starts with a period ("."). For this reason,
- Xembedded commands are often called "dot commands".
- XIt is unusual to want to actually begin
- Xa line with a period, so this works OK. If you have some reason for
- Xwanting to place a period at the first of a line (we did
- Xabove in the example
- Xfor ".ce"), there is a way to do it.
- X
- X.OP
- X\fBModes:\fP
- X.PP
- XWe need to explain the difference in "fill mode",
- Xand "non-fill" mode.
- X.PP
- XIn "fill mode", wroff will pack as many words as possible on
- Xa line, no matter how you typed the lines in the original
- Xfile. If you are in "non-fill" mode, the lines will appear
- Xin the output just the way you typed them in. Fill mode is
- Xusually "on", but you can turn it off with the command
- X".nf". If you want it back on, just use ".fi". Here is an
- Xexample:
- X
- X.cc #
- X#nf
- X.nf
- XThese lines will appear
- Xin non-fill mode, just the
- Xway they were typed in.
- XThis is useful for making tables and
- Xother things that need to line up
- Xin a certain way.
- X
- XHere is the output that results:
- X
- X
- X These lines will appear
- X in non-fill mode, just the
- X way they were typed in.
- X This is useful for making tables and
- X other things that need to line up
- X in a certain way.
- X
- X#fi
- XHere is the way things would look in fill
- Xmode. Here is the raw text:
- X
- X#nf
- X.fi
- XThese lines will appear in
- Xfill mode, with the margins adjusted
- Xproperly. This is the usual default for
- Xtext, and so you can just omit the ".fi" if
- Xyou want to.
- X
- XHere is the way they appear after processing by wroff:
- X
- X#fi
- X#cc .
- XThese lines will appear in
- Xfill mode, with the margins adjusted
- Xproperly. This is the usual default for
- Xtext, and so you can just omit the ".fi" if
- Xyou want to.
- X
- X.OP
- X\fBjustify and non-justify modes:\fP
- X.PP
- XSometimes we want to place
- Xas many words on a line as possible, but we do not want the
- Xright margins to be justified. For instance, you may be
- Xwriting a business letter, and a ragged right margin gives
- Xsort of a "typed-by-hand" look to a paper. Use the commands
- X".ju" and ".nj" to turn right margin justification on and
- Xoff.
- X.PP
- XHere is an example. In the text file, we enter:
- X
- X.nf
- X.cc #
- X.fi
- X.nj
- XThese lines will appear with as
- Xmany words on a line as possible, but
- Xwith the right margin "ragged."
- XThis makes for a more "typed-by-hand" appearance,
- Xand is useful for correspondence.
- X
- XHere is the output:
- X
- X#nj
- X#fi
- XThese lines will appear with as
- Xmany words on a line as possible, but
- Xwith the right margin "ragged."
- XThis makes for a more "typed-by-hand" appearance,
- Xand is useful for correspondence.
- X#cc .
- X
- X.ju
- X.fi
- X.OP
- X\fBChanging the "command character":\fP
- X.PP
- XSeveral times in the
- Xabove text, we had to print a period (a "dot") as the first
- Xcharacter on a line. Since an embedded commands usually
- Xstarts with a "dot", we had to be sure that the
- Xdot at the first of a line could be ignored if we wanted it
- Xto be.
- X.PP
- XThe "dot" is called the "command character", and actually
- Xany character can be used. If we want some other character
- Xto become the command character instead, we could use the
- X".cc" command (for \fBc\fPhange \fBc\fPommand). Here is how it
- Xworks.
- X.cc *
- X
- XAfter this, the command character is a "#". For instance,
- X
- X*nf
- X.cc #
- XI can now type a dot at the first of a line like this:
- X
- X.45 caliber automatic
- X
- X#cc .
- XNow the command character is changed back to a ".".
- X
- X*fi
- X*cc .
- X.PP
- XWe will see another method of accomplishing the same end later.
- X
- X.OP
- X\fBIndenting:\fP
- X.PP
- XMost text in letters requires indented
- Xprinting. The usual left-hand margin in wroff is set to
- X1 inch from the left printable margin on a page.
- XHowever, this
- Xcan be changed in three ways.
- X.PP
- XThe left hand margin can be changed to any other value by
- Xusing ".in". For instance, ".in 20" changes the left margin
- Xto 2 inches from the left printable margin.
- XThe "20" means that the margin is to be set to 20 deci-inches
- X(tenths of an inch) from the left printable margin.
- XIncidentally, the left printable margin, depending on your printer, may not
- Xbe at the left edge of the paper.
- X.PP
- XYou can also do it slightly differently.
- XUsing ".in +12" would change the left margin to be 1.2 inches
- Xto the right of where it was. In a like fashion, using ".in
- X-5" would move the left margin one-half inch to the left. For
- Xexample:
- X
- X.nf
- X.cc #
- X.in 10
- XThis would be printed at 1.0 inches from the left of the paper.
- X
- X.in +5
- XThis is placed at inch 1.5.
- X
- X.in 15
- XThis is also placed at inch 1.5.
- X
- X.in -10
- XThis would be printed at inch 0.5 (15 -10).
- X
- X#cc .
- X.fi
- X.PP
- XA variation on setting a margin permanently is just to
- Xchange the margin for \fUonly the next line\fU. Use ".ti +5"
- X(for \fBt\fPemporary \fBi\fPndent 5 deci-inches) to indent only the next
- Xline (by 0.5 inches). This is particularly useful at the beginning of
- Xparagraphs.
- X.PP
- XAs an example,
- X
- X.cc #
- X#nf
- X.ti +5
- XThe paragraph printed by processing this text will have an
- Xindented first line. The remaining lines will not be
- Xindented, but will appear at the left margin.
- X
- Xprocesses into:
- X
- X#fi
- X#ti +5
- XThe paragraph printed by processing this text will have an
- Xindented first line. The remaining lines will not be
- Xindented, but will appear at the left margin.
- X
- X#cc .
- X.PP
- XAn interesting variation is an "outdent", or hanging leader.
- XHere is an example:
- X
- X.cc #
- X#nf
- X.ti -5
- XThis paragraph has an outdent, or hanging leader in its
- Xfirst line. This really helps when preparing a report or
- Xother written work with section headings.
- X#fi
- X
- XThe output will appear as:
- X
- X#ti -5
- XThis paragraph has an outdent, or hanging leader in its
- Xfirst line. This really helps when preparing a report or
- Xother written work with section headings.
- X
- X#cc .
- X.OP
- X\fBBoldfacing\fP, centering, and \fUunderlining\fU:
- X.PP
- XCentering text is easy. Just use ".ce" as in the
- Xexample at the first of the paper. One "trick" is to tell
- Xwroff to center a huge number of lines, and then use ".ce 0"
- Xto turn centering off like this:
- X.nf
- X
- X.cc #
- X.ce 100
- XThese and
- Xno telling how
- Xmany other
- Xlines
- X----
- X---
- Xshould be centered.
- X.ce 0
- X#cc .
- X.fi
- X
- X.PP
- XThis results in all of the lines between ".ce 100" and ".ce
- X0" being centered, with no requirement for having to count
- Xlines ahead of time.
- X.PP
- XThe same stunt works on boldface or underlining:
- X.cc #
- X#nf
- X
- X.ul 100
- X.bd 100
- XAll of the words
- Xin this block will be both boldfaced and
- Xunderlined
- X--
- X-- all the way
- Xdown to here, whereever
- Xthis is.
- X.bd 0
- X.ul 0
- X
- X#cc .
- X.fi
- X
- X.PP
- XBoldfacing and underlining can be accomplished in two ways.
- XOne way is to use either ".bd" or ".ul" as above.
- X.PP
- XA second way, which is useful when you want to just
- Xunderline or boldface a couple of words is to use an
- X"in-line font change".
- X.PP
- XAn illustration probably is sufficient.
- X.PP
- XIn this paragraph, we \\fBboldfaced three words\\fP, and \\fUunderlined
- Xtwo\\fU words, and \\fIitalicized three words\\fP, and printed a \\\\.
- XHere is how wroff printed it.
- X.PP
- XIn this paragraph, we \fBboldfaced three words\fP, and \fUunderlined
- Xtwo\fU words, and \fIitalicized three words\fP, and printed a \\.
- XHere is how wroff printed it.
- X.PP
- XIn-line font changes are discussed in more detail in a later section.
- X.OP
- X\fBUse of Macros:\fP
- X.PP
- X"Macros" are collections of frequently used commands that
- Xcan be called by a single name. You get to invent the name.
- X.PP
- XIn typing this document, we frequently had need to
- X"skip 3 lines and then temporarily outdent by 5 spaces" when
- Xwe came to a new section. Rather than always type
- X.cc #
- X
- X#nf
- X.sp 3
- X.ti -5
- X
- X#fi
- Xat the start of every section, we instead defined a "macro"
- Xnamed ".OP" like this:
- X
- X#nf
- X
- X.de OP
- X.sp 3
- X.ti -5
- X.en
- X
- X#nf
- XAt the start of every new section, we just typed:
- X
- X.OP
- XThe start of the section ...
- X.PP
- X
- Xand went on about our business.
- X#cc .
- X.fi
- X.PP
- XMacros are really powerful. A well thought out collection
- Xof macros can make writing a letter or preparing a memo a
- Xbreeze. Macros can be defined and placed in a file for
- Xfuture use. The file can be included in any document by
- Xusing the ".so" command to read the macro file before you
- Xstart processing.
- X.PP
- XDon't overlook the power of macros. Here is a set we use a
- Xlot. They were placed in a file called "macros" by using
- X"vi".
- X
- X.in +5
- X.OP
- Xfile macros contains:
- X.nf
- X.cc #
- X
- X.de DATE
- X.in +30
- X$1 $2 $3
- X.br
- X.en
- X.de TO
- X.in 10
- X.sp 3
- X.nf
- X.en
- X.de TEXT
- X.sp 3
- X.fi
- X.ti +5
- X.en
- X.de SIGN
- X.sp 3
- X.in +30
- X.nf
- X.en
- X#cc .
- X.in -5
- X
- X.fi
- X.OP
- XNow when we want to write a letter, we write
- X.nf
- X.in +5
- X.cc #
- X
- X.DATE October 4, 1988
- X.TO
- XMr. Joe Smith
- XSomePlace
- XSomewhere, USA
- X
- XDear Joe:
- X.TEXT
- XHere is the letter and so forth ...
- X.SIGN
- XYours Truly,
- X
- XFred
- X#cc .
- X.fi
- X.in -5
- X
- XWe print the letter by writing "wroff macros filename".
- X.bp
- X.OP
- X\fBScanning for errors:\fP
- X.PP
- Xwroff is somewhat sensitive to
- Xerrors in input. It is sometimes useful to scan a document \fIbefore\fP
- Xyou print it to see if all of the wroff commands have been entered
- Xcorrectly. Use the command line option "-s" to scan for errors
- Xif you are concerned.
- X.PP
- XIf you enter "wroff -s filename", then wroff will not print anything
- Xat all, either on the screen, or on the printer. If there is some kind
- Xof problem with any of the wroff commands in your paper, wroff will report
- Xthat problem, and the approximate location of it, so that you can fix it
- Xbefore you go to the trouble and expense of printing the document.
- X.OP
- X\fBFonts:\fP
- X.PP
- XOne of the biggest pleasures in using wroff is that you can combine various
- Xtypefaces in a document to give a pleasing appearance.
- X.PP
- XThere are several fonts available. Here is a current list:
- X.nf
- X\fT
- Xsymbol font
- X
- X.in +5
- XB Times Roman 12 point boldface
- XI Times Roman 12 point italics
- XM mountable - default is Presentation 18 bold
- XT Courier 12 point
- XP return to previous font
- XU toggle underlining
- X0 Times Roman 12 point Normal (default)
- X1 Presentation 18 point - synonymous with M
- X2 Helvetica Normal 6 point
- X\fP
- X.fi
- X.in -5
- X.PP
- XIn order to make effective use of fonts, you must
- Xunderstand what is meant by "proportional spacing."
- X.PP
- XYou may have noticed that in this document, not all letters in
- Xa word are the same "width". For instance, the letter "i" is much more
- Xnarrow than the letter "M". These letters were printed with a proportionally
- Xspaced font.
- X.PP
- XProportional spacing is pleasant to read. It gives a "typeset" quality
- Xto printed work. Most (but not all) of
- Xthis document was printed using Times Roman 12 point
- XNormal type.
- X.PP
- XWroff, in the default mode, allows for proportional printing, and adjusts
- Xthe spacing in lines accordingly.
- X.PP
- XIn the table above, the only proportional fonts are the "Times Roman" fonts.
- XThe other fonts are "fixed spacing fonts", which means that each letter
- Xtakes the same amount of space as any other letter. Fixed spacing fonts
- Xare especially useful for preparing portions of a document that have
- Xlines which need to "line-up" with previous lines. One such example is
- Xwhen preparing a table.
- X.PP
- XYou can switch fonts, even in the middle of a line, by using
- Xan "embedded font change." To do this, use a "\\f" followed by the symbol
- Xfrom the table above that indicates which font you want.
- X.PP
- XAs an example, the line:
- X.nf
- X.in +5
- X
- X\\fBboldface this\\fP and \\fIitalicize this\\fP
- X.in -5
- X.fi
- X
- Xwould print as:
- X.nf
- X
- X\fBboldface this\fP and \fIitalicize this\fP
- X
- X.fi
- X.OP
- X\fBBuilding tables and using '.nf':\fP
- X.PP
- XThe only fixed spacing fonts available above are the Courier 12 point,
- Xand the Presentation 18 point. (Point size indicates the height of letters,
- Xnot their width.)
- X.PP
- XIncidentally, you may occasionally want to print the character "\\".
- XIf you want to enter such a character, you may enter '\\\\' in the document.
- XThis works for other characters, too. Entering '\\x' will print the
- Xcharacter 'x'. This seems useless until you realize that it is an alternative
- Xway of protecting a line that begins with a period.
- X.PP
- XHere is an example table:
- X.nf
- X.in +5
- X
- X\fT
- X
- X\.nf
- X\.in +5
- X\\fT
- XName Address
- XJoe Smith Somewhere
- XJames Jones Nowhere
- XSally Sue Anywhere
- X\\.50 caliber Guns
- X\\fP
- X\.in -5
- X
- X.in -5
- X\fP
- X.PP
- XThis was printed by wroff as:
- X
- X
- X.nf
- X.in +5
- X\fT
- XName Address
- XJoe Smith Somewhere
- XJames Jones Nowhere
- XSally Sue Anywhere
- X\.50 caliber Guns
- X\fP
- X.fi
- X.in -5
- X
- X.PP
- XJust switching from a proportional font to a fixed font in the same
- Xline, when in fill mode gives no problems at all. Wroff may become
- Xconfused when you build tables in non-fill mode and mix several fonts
- Xtogether. A good word of advice, then, is to build tables in non-fill
- Xmode, using a fixed font, just as we did above.
- X.PP
- XIf for some reason
- Xyou absolutely \fIinsist\fP on using a proportional font to build a table,
- Xyou can use an "anchor". The "anchor" characters cause a specific
- Xplace in the text to appear in a certain column. The anchor consists of the
- Xstring "\\f|".
- XHere is an example:
- X.nf
- X.sp
- X.in +5
- X\fT
- Xage \\f|14
- Xdate \\f|12
- Xtoday \\f|2
- X\fP
- X.in -5
- X.fi
- X.PP
- XThis produces the following output:
- X.sp
- X.in +5
- X.nf
- Xage \f|14
- Xdate \f|12
- Xtoday \f|2
- X.in -5
- X.fi
- X.PP
- XWhen processing a line in non-fill mode under a proportional font,
- Xwroff will attempt to duplicate the appearance of the original line as
- Xbest it can. Wroff takes the original line and determines by counting
- Xcharacters just where on a page that it should begin printing a word.
- XIt assumes that each character is 0.1 inches in width.
- X.PP
- XWroff then attempts to begin each word in the line at whatever place on
- Xthe page is indicated by the character position of the first letter in
- Xthe word. This would make for some "funny" looking lines, unless you
- Xplaced the anchors in the line.
- X.OP
- X\fBConclusions:\fP
- X.PP
- XThere is a lot to wroff, and a lot more to
- Xlearn. Most of the commands are reasonable to use, and
- Xactually most people only need a few of the commands.
- XStudying the User's Guide will repay a careful reader.
- X.PP
- XAppendix A attached to this paper is a technical description
- Xof all of wroff's commands. After you gain skill with
- Xwroff, this appendix will probably become very useful to
- Xyou.
- X.PP
- XAppendix B is a listing of the raw unprocessed file that
- Xwas used to create this tutorial. It should provide a treasure
- Xtrove of examples.
- X.PP
- XEnjoy !
- *-*-END-of-doc/wroff.tut.w-*-*
- echo x - doc/macs.w
- sed 's/^X//' >doc/macs.w <<'*-*-END-of-doc/macs.w-*-*'
- X.de NAME
- X.ti -5
- X\fBName: $1\fP
- X.sp 2
- X.en
- X.de SYNOPSIS
- X.nf
- X.ti -5
- X\fBSYNOPSIS:\fP
- X.sp 2
- X.en
- X.de FUNCTION
- X.sp 2
- X.ti -5
- X\fBFUNCTION\fP
- X.fi
- X.en
- X.de BUGS
- X.sp 3
- X.ti -5
- X\fBBUGS\fP
- X.sp 2
- X.en
- X.de PP
- X.sp
- X.ti +5
- X.en
- *-*-END-of-doc/macs.w-*-*
- echo x - doc/welcome
- sed 's/^X//' >doc/welcome <<'*-*-END-of-doc/welcome-*-*'
- X.ce
- XWelcome to the wroff system.
- X.sp 2
- X.nf
- XThis file will be printed both on your screen and on your
- Xlaser printer.
- X
- XOn the HP Laser-Jet II,
- X\fBThis will be in boldface\fI,
- X\fIThis will be in italics\fP,
- X
- X\f2This will be in small print\fP,
- X
- X\f1This will be in big print\fP
- X
- X
- *-*-END-of-doc/welcome-*-*
- echo end of sh-archive
-
-