home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / wroff / part02 < prev    next >
Encoding:
Text File  |  1990-06-24  |  33.1 KB  |  1,145 lines

  1. Newsgroups: comp.sources.misc
  2. From: bw@uecok.UUCP (Bill Walker CS Faculty)
  3. subject: v13i065: wroff - text formatter for HP LaserJet with PP 25-font cartridge
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 65
  7. Submitted-by: bw@uecok.UUCP (Bill Walker CS Faculty)
  8. Archive-name: wroff/part02
  9.  
  10. echo Making directory doc
  11. mkdir doc
  12. echo x - doc/wroff.1.w
  13. sed 's/^X//' >doc/wroff.1.w <<'*-*-END-of-doc/wroff.1.w-*-*'
  14. X.fo \f0Bill Walker/page #/October 27, 1989\fP
  15. X.NAME wroff
  16. X.SYNOPSIS
  17. Xwroff [-sdpk] [-b n] [-e n] [-o outfile] [-t #] filelist
  18. X
  19. X.FUNCTION
  20. Xwroff is a general text formatting program.  Options:
  21. X.sp
  22. X.nf
  23. X.in +5
  24. XSwitch              Action
  25. X.in +2
  26. X
  27. X-p        Do not effect font changes (default is p)
  28. X-b        begin printing with page n (default 1)
  29. X-e        end printing with page n (default 32767)
  30. X-o        place output on outfile
  31. X-k        do not use formfeeds to advance to new page
  32. X-s              scan text for errors only - do not print
  33. X-t #        expand tabstops (default 8 spaces)
  34. X            (use -t 0 to retain tab characters)
  35. X-v        print version number -- no text processing
  36. X
  37. X.in -7
  38. X.fi
  39. X.PP
  40. XSwitch "-p" causes special characters such as
  41. Xthose that produce italics or boldface not to be output.
  42. XAn unrecognized command will cause wroff to terminate.  
  43. X.PP
  44. XWhen writing to standard output, wroff does not emit special
  45. Xcharacters.  This allows work to be previewed on the screen
  46. Xbefore it is printed.  However, the screen only approximates
  47. Xthe true output.
  48. X.PP
  49. XThe wroff commands are discussed in the following pages.
  50. X.BUGS
  51. XThe "preview" mechanism should provide more realistic output.
  52. X.bp
  53. X.in 5
  54. X.nf
  55. X.ce 2
  56. X.bd 2
  57. X.it 1
  58. XWroff
  59. XCommands
  60. X.sp 2
  61. X\fT
  62. XCommand           default           Effect
  63. X
  64. X.cc !
  65. X!in +2
  66. X.bd n              1             boldface next n lines
  67. X.bp n            next            advance to next page
  68. X.br              none            break
  69. X.cc c             .              change command char to c
  70. X.ce n             1              center next n lines
  71. X.dc c             /              change delimiter to c in titles 
  72. X.de name         none            start macro definition
  73. X.di XX        none         start diversion to XX
  74. X.ed         none         end diversion
  75. X.en              none            end macro definition
  76. X.et         none         end transparent mode
  77. X.fi              true            set fill on
  78. X.fm  fontname    P18bl         mount font on post M
  79. X.fo string    "/page #/"     define footer
  80. X.gx x          0         move horizontally x dots 
  81. X.gy y          0         move vertically y dots
  82. X.he string     none         define header
  83. X.hr n           0         horizontal rule, length n
  84. X.if (expr) XX               if (expr) is true, call macro XX
  85. X.in n             10             set left margin to n  
  86. X.it n              1             italicize next n lines
  87. X.ju              true            justify right margin
  88. X.lp str             none         label indented paragraph
  89. X.ls n              1             set line spacing to n
  90. X.m3 n          24         margin (dots) before footer
  91. X.ne n              1             need n lines
  92. X.nf n            false,n=2       set fill off, theshold to n
  93. X.nj              false           do not justify right margin
  94. X.pc c              #             set page char to c
  95. X.pl n             480            set page length to n dots
  96. X                    (48 per vertical inch )
  97. X.pm n          10             place paragraph labels left
  98. X                  by this much (characters)
  99. X.rj n         current         process left jagged, right justified
  100. X                right margin     use .rj 0 to turn off
  101. X.rm n             70             set right margin to n
  102. X.rt         none         reset traps
  103. X.so name         none            source a file
  104. X.sp n              1             space down n lines
  105. X.ti n              0             temporary indent by n
  106. X.tf string    "l c r"         title format
  107. X.tl XX string     none           set variable XX to string
  108. X.tm          none         enter transparent mode
  109. X.vr n           0         vertical rule, length n
  110. X.vs n           12             vertical spacing between lines
  111. X                    (dots)
  112. X.ul n              1             underline next n lines
  113. X.wh n  XX     none         set trap XX at vertical position n
  114. X..         none         comment line
  115. X\\fc              none            embedded font change
  116. X                   (c = B, I, M, T, U, P, 0, 1, 2)
  117. X\\{XX}          none          interpolate macro XX
  118. X\\(reg)          none        interpolate register reg as an integer
  119. X\\(regC)        none            interpolate register reg as a character
  120. X\\[expr]    none        evaluate register expression
  121. X\\f|        none        provide "anchor" in nonfill mode
  122. X
  123. X!cc .
  124. X.bp
  125. X\fP
  126. X.ce
  127. X\fIVariables\fP
  128. X.nf
  129. X
  130. XAll measurements in "dots"
  131. X.sp 2
  132. X     registers and default values
  133. X
  134. X    # =  1         \f| start at page 1 
  135. X    A =  2         \f| the next page 
  136. X    B = 24         \f| bottom margin of 24 dots 
  137. X    C = 0        \f| center this many lines 
  138. X    D = 0         \f| vertical length of last diversion 
  139. X    E = 0          \f| italicize next n lines 
  140. X    F = 0         \f| current font 
  141. X    G = 0         \f| boldface next n lines 
  142. X    H = TRUE      \f| justify lines 
  143. X    I = TRUE       \f| start in FILLMODE = TRUE 
  144. X    J = '/'     \f| a SLASH mark 
  145. X    L = 300     \f| left margin of 300 dots  - 1 inch 
  146. X    M = 0        \f| temporary indent 
  147. X    O = '#'       \f| page character 
  148. X    P = 480     \f| page length 
  149. X    Q = 0         \f| number of printable characters in outbuf 
  150. X    R = 2100    \f| right margin of 2100 dots - 7 inches 
  151. X    S = 1         \f| line spacing 
  152. X    T = 0         \f| top margin of 0 dots 
  153. X    U = 30        \f| width of a space character in dots 
  154. X    V = 10         \f| current vertical spacing 
  155. X    W = 10         \f| indented paragraph start  in characters 
  156. X    X = 0         \f| current horizontal position 
  157. X    Y = REG('T')    \f| current vertical position 
  158. X    Z = FALSE     \f| underline state 
  159. X    ! = 8         \f| tabstops every 8 characters 
  160. X    _ = 24         \f| margin before footer 
  161. X.bp
  162. X.fi
  163. X.ce 10
  164. X\fIWroff Commands\fP
  165. X.ce 0
  166. X.sp 2
  167. X.de CMD
  168. X.in 20
  169. X.sp
  170. X.lp $1 $2
  171. X.en
  172. X
  173. X.CMD bd
  174. X"bd n" is used to boldface the next n lines.  If n is not specified,
  175. Xthe
  176. Xdefault is to boldface the next line.
  177. XSince \fBwroff\fP supports in-line font changes, this command is
  178. Xnot really very useful.
  179. X.CMD bp
  180. X"bp n" is used to advance to the next page and number it "n".  If 
  181. X"n" is not specified, the default is to number pages
  182. Xsequentially.
  183. X.CMD br
  184. XThe "br" command will always cause any collected output to
  185. Xbe printed.
  186. X.CMD cc
  187. XThe "command character" is the character that preceeds an embedded command.
  188. XThe character defaults to a ".", but can be changed to any
  189. Xcharacter by issuing "cc c", where c is any character.
  190. X.CMD ce
  191. X"ce n" centers the next n lines.  If n is not specified, the
  192. Xdefault is to center the next line.
  193. X.CMD dc
  194. XIn titles, such as the footers and headers, the fields are
  195. Xdelineated by using a "delimiter character".  For instance,
  196. Xthe default footer is "/page #/".  The "/" delimits the
  197. Xfields.  This delimiter (default "/") can be changed by
  198. Xusing the "dc c" command.
  199. X.CMD de
  200. XThis command starts a macro definition.  Use "de name" to
  201. Xbegin the definition of a macro named "name".  There is no
  202. Xdefault name.  A macro definition will continue until the
  203. X"en" command is recognized. 
  204. X.CMD di
  205. XStart a diversion named "name" by issuing "di name".  Text
  206. Xis copied into the diversion until the "ed" command is
  207. Xfound.
  208. X.CMD ed
  209. XEnd a diversion.  
  210. X.CMD en
  211. XEnd a macro.  Caution:  if you define a macro, be sure to
  212. Xend it!
  213. X.CMD et
  214. XEnd transparent print.  Any lines between "tm" and "et" will
  215. Xbe copied to the output without any processing (other than
  216. Xfor margins ).
  217. X.CMD fi
  218. X"fi" tells \fBwroff\fP to begin to fill lines.  That means
  219. Xthat both the left and the right margins will appear
  220. Xstraight.
  221. X.CMD fm
  222. XThe "fm name" command mounts a font with the given name on
  223. Xfont post "M".  To access that font, use \\fM to start, and
  224. X\\fP to return to the previous font.
  225. XThere is a list of available fonts at the end of this
  226. Xdocument.
  227. X.CMD fo
  228. X"fo string" defines the page footer to be "string".  The
  229. Xstring is constructed by examining the title format string,
  230. Xwhich is defined by "tf", and replacing any page character
  231. Xby the current page number.  (See "pc" to change the page
  232. Xcharacter.)
  233. XThe placement of the footer on the page can be controled by
  234. Xusing "m3". 
  235. X.CMD gx
  236. X"gx x" is the "go to x" command.  "x" is measured in "dots"
  237. Xfrom the left printable margin.  There are 300 "dots" to an
  238. Xinch.  "gx" is used to move horizontally across a page.
  239. X.CMD gy
  240. X"gy y" is the "go to y" command.  "y" is measured in "dots"
  241. Xfrom the top printable margin.   There are 48 "dots" to an
  242. Xinch.  "gy" is used to move vertically in a page.
  243. X.CMD he
  244. X"he string" sets the page header, in the same way that "fo"
  245. Xsets the footer.
  246. X.CMD hr
  247. X"hr n" draws a horizontal rule (a line) from the current x position
  248. Xto the right.  This line is of length n (default 0) in dots.
  249. X.CMD if
  250. X"if (expr) macname" will evaluate the expression and execute the
  251. Xmacro names "macname" if the expression is true. 
  252. XIf the expression is an arithmetic expression, the evaluator
  253. Xregards "0" as "TRUE".
  254. X.CMD in
  255. XThe "in n" command controls the left margin.  The default for n is 10.
  256. XIn contrast to other commands, n is measured in deci-inches.  The default
  257. Xleft margin is therefore 1 inch from the left printable margin.
  258. X.CMD it
  259. X"it n" will italicize the next n lines.  The default is to italicize 
  260. Xone line.  Since \fBwroff\fP supports in-line font changes, this command
  261. Xis not really useful.
  262. X.CMD ju
  263. XIssuing "ju" will cause right margin justification to take place.  To
  264. Xgain a "ragged right" margin, turn justification off with "nj".
  265. X.CMD lp
  266. XUse "lp str" to label a paragraph with the string "str".  This label is
  267. Xplaced to the left of the paragraph a distance of 10 deci-inches.  This
  268. Xdistance can be changed with the "pm" command.
  269. X.CMD ls
  270. XUse "ls n" to set the line spacing to n.  (The default is 1).  For instance,
  271. Xto double space output, use "ls 2".
  272. X.CMD m3
  273. XBefore placing a footer, wroff provides a small margin.  The default is to provide
  274. Xone-half inch (24 dots), and then place the footer.  This can be changed
  275. Xby using "m3 n", where n is measured in dots. (48 dots per vertical inch.)
  276. X.CMD ne
  277. X"ne n" means that \fBwroff\fP should guarantee that there 
  278. Xis at least n lines left on the current page (default n=1).  If this much
  279. Xspace does not remain on the current page, \fBwroff\fP will turn up a new
  280. Xpage before proceeding.
  281. X.CMD nf
  282. XThe "nf" command causes \fBwroff\fP to process in non-fill
  283. Xmode.  In fill mode, as many words as possible are packed on
  284. Xa line before the line is printed.  If "justify" mode (see
  285. X"ju" and "nj") is also on, the right margin is also
  286. Xjustified.  The "nf" command turns fill mode off, and in
  287. Xeffect causes lines to appear as they are typed.  This is
  288. Xespecially useful for tables.  The "anchor" character (see
  289. Xbelow) will be helpful in making tables line up properly.
  290. X.CMD nj
  291. XEnter "non-justify" mode.  
  292. XIn non-justify mode, the right margin is not justified.
  293. XNon-justify mode can coexist with fill mode to pack as many
  294. Xwords as possible on a line, without squaring up the right
  295. Xmargin.  The default mode is "justify".
  296. X.CMD pc
  297. XIn headers or footers, the (default) symbol "#" is used to represent
  298. Xsomething that should be replaced with the current page
  299. Xnumber.  The symbol "#" can be changed to any character c by
  300. Xusing "pc c".
  301. X.CMD pl
  302. X"pl n" is used to set the length of a page to n dots.
  303. X(default is n=480, or 10 inches)  This command is little
  304. Xused, unless you use odd sized paper in your laser printer.
  305. X.CMD pm
  306. XSee the "lp" command above.  The "pm n" command (default
  307. Xn=10) sets the margin for a paragraph label.  The parameter
  308. Xn is measured in deci-inches.
  309. X.CMD rj
  310. XUse the "rj" command to cause text to be justified on the
  311. Xright, with a ragged left margin.  This is useful for
  312. X"glitzy" work.
  313. X.CMD rm
  314. XThe "rm n" command sets the right margin.  "n" is measured
  315. Xin deci-inches, with a default of 70 (7 inches).
  316. X.CMD rt
  317. XWhen "traps" (see "wh") are placed on a page, the
  318. Xtraps are "sprung" as the location at which they are placed
  319. Xis passed.  A "sprung" trap will not be sprung a second time
  320. Xon the same page.  If you want to "reset" a trap for some
  321. Xreason (perhaps you used "gy" to move above it), use "rt"
  322. Xto reset \fIall\fP the traps on a page.  It is not possible
  323. Xto selectively reset traps.
  324. X.CMD so
  325. XSource an external file.  "so filename" will attempt to
  326. Xlocate file "filename" and include it as though it were part
  327. Xof the current file.  Nested "so" commands are legal.  i.e.
  328. Xa file that is 'sourced' may in turn 'source' another file.
  329. X.CMD sp
  330. XSpace down n lines by using "sp n".  The default for n is
  331. X1.
  332. X.CMD ti
  333. XUse "ti n" (default n=0) to indent \fIonly the next line\fP
  334. Xby n deci-inches.  (Think "temporary indent")
  335. X.CMD tf
  336. XA "title format" is a string that tells the tl command
  337. X(below) how to interpret a given string.
  338. XThe current title format is used to interpolate strings
  339. Xusing the "tl" command.
  340. XThe default title format is "l c r", meaning to interpret
  341. Xthe string as having three fields, delimited by "/" (see
  342. X"dc").  The first field will be left-justified, the second
  343. Xfield will be centered, and the third
  344. Xfield
  345. Xwill be 
  346. Xright justified, all within printed fields computed from the
  347. Xnumber of fields specified in the title format.  
  348. XTo place the second field at the right of the center printed
  349. Xfield, use "tf l r r".
  350. X.CMD tl
  351. X"tl string" is used to interpolate the string into the output, where the
  352. Xstring is formatted according to the current 'title format'.  (See "tf".)
  353. X.CMD tm
  354. XEnter transparent print mode.  No further processing is done
  355. Xon text, but the text is copied directly from input to
  356. Xoutput until command "et" is encountered.  No font changes
  357. Xare executed, and \fBwroff\fP is likely to lose track of
  358. Xcurrent positions on the page.  Use "tm" only \fIin
  359. Xextremis\fP.
  360. X.CMD vr
  361. XDraw a vertical line n dots (48 per inch) long starting at the current
  362. Xposition.  Note that the positive direction is "down" the
  363. Xpage.
  364. X.CMD vs
  365. XAdjust the vertical spacing between lines of print.  This is
  366. Xoften useful to help "squeeze" a document onto a single
  367. Xpage.  "vs -1" will squeeze lines closer together by 1
  368. Xvertical dot.  The default is to space by 12 dots.
  369. X.CMD ul
  370. XUse "ul n" to underline the next n lines.  (default n = 1)
  371. X.CMD wh
  372. XSet a trap.
  373. XThe "wh" command has an unusual syntax.  The command "wh n
  374. XNAME" will execute macro "NAME" when the current vertical position
  375. Xon the page passes position n.  The syntax "wh -24 NP" would
  376. Xfire macro NP when the current vertical position was within
  377. X24 dots of the bottom of the page.  The macro must be
  378. Xdefined elsewhere.  Beware of firing undefined macros.  A
  379. Xmacro must be defined before the trap is fired, but need not
  380. Xbe defined before the trap is set.  It is legal to change a
  381. Xmacro definition without resetting a trap.
  382. X.CMD .
  383. XThe ".." command is a comment marker.  Actually,
  384. Xthe command should really be "CMDCHAR .", where the CMDCHAR
  385. Xis set by the "cc" command.  The rest of a line after ".."
  386. Xis taken as a comment.
  387. X.in 10
  388. X.bp
  389. X.ce 
  390. X\fBIn-Line Actions\fP
  391. X.sp 3
  392. X.PP
  393. X\fBwroff\fP has the ability to deal with various fonts.  It can also 
  394. Xinterpolate the value of a variable into the output stream, or call a
  395. Xmacro from anywhere within a line.  
  396. XAll of this is accomplished with "In-Line Actions".  
  397. X.PP
  398. XIn-Line Actions
  399. Xcan be placed anywhere within a line of text.
  400. X(This is opposed to \fIembedded commands\fP, which were
  401. Xdiscussed above, and which must appear on a line by
  402. Xthemselves.)  The "backslash" symbol (\\) is used to signal
  403. X\fBwroff\fP that an in-line action is present.
  404. X.PP
  405. XThe possible in-line actions are listed below:
  406. X.nf
  407. X.sp 2
  408. Xcommand        \f|Action
  409. X.in +2
  410. X\\fc        \f|in-line font change
  411. X        \f|  where c = B, I, M, T, U, P, 0, 1, 2, other
  412. X        \f|  B -    \f|boldface
  413. X        \f|  I -    \f|italicize
  414. X        \f|  M -    \f|mountable
  415. X        \f|  T -    \f|Courier (fixed)
  416. X        \f|  U -    \f|toggle underline
  417. X        \f|  P -    \f|return to previous
  418. X        \f|  0 -    \f|default font (Times Roman)
  419. X        \f|  1 -    \f|Presentation 18 point
  420. X        \f|  2 -    \f|Helvetica 6 point
  421. X        \f| other -    \f|interpolate "other" char
  422. X
  423. X\\{XX}        \f|interpolate macro named XX
  424. X\\(reg)        \f|interpolate the value of register reg
  425. X        \f|  as an integer
  426. X\\(regC)    \f|interpolate the value of register reg
  427. X        \f|  as a character
  428. X\\[expr]    \f|evaluate register expression -
  429. X        \f|  do not interpolate, see \\(reg) above
  430. X\\f|        \f|place "anchor" in text
  431. X.sp 2
  432. X.in -2
  433. X.fi
  434. *-*-END-of-doc/wroff.1.w-*-*
  435. echo x - doc/wroff.tut.w
  436. sed 's/^X//' >doc/wroff.tut.w <<'*-*-END-of-doc/wroff.tut.w-*-*'
  437. X.fo \f0Bill Walker/page #/October 18, 1989\fP
  438. X.ce 10
  439. X\fBWroff Tutorial\fP
  440. X.ce 0
  441. X.sp 3
  442. X.in +5
  443. X.de PP
  444. X.sp
  445. X.ti +5
  446. X.en
  447. X.de OP
  448. X.sp
  449. X.ti -5
  450. X.en
  451. X.OP
  452. X\fBIntroduction:\fP  
  453. X.ls 2
  454. X.PP
  455. X"Wroff" is a general purpose text formatter,
  456. Xwritten in the spirit of Unix's \f2trademark of AT&T\fP 
  457. X\f1*roff\fP family.  The purpose
  458. Xof this document is to make the reader able to use "wroff"
  459. Xfor preparing documents.
  460. X.PP
  461. XWroff has been specifically "tuned" to the Hewlett-Packard
  462. XLaserJet II printer.  Most of the system defaults will
  463. Xprovide some reasonable output no matter \fBwhat\fP input is
  464. Xpresented.  The LaserJet can do \fBboldface\fP, \fUunderlining\fU,
  465. Xor even a \fB\fUcombination\fU\fP of the two.  Wroff 
  466. Xsupports \fIitalics\fP as well.  Wroff is aware that a page has
  467. X60 lines, and that a page should be printed with a left
  468. Xmargin of 1 inch.  (These can both be changed, of course.)
  469. X.PP
  470. XWroff, when processing text, will space twice after periods,
  471. Xquestion marks, exclamation marks, and colons.
  472. X.PP
  473. XThis document was prepared using\f1 wroff\fP.
  474. X.ls 1
  475. X.bp 
  476. X.OP
  477. X\fBEmbedded Commands:\fP  
  478. X.PP
  479. XWroff works by reading a text file,
  480. X(created by using "vi" under Unix) and rearranging the
  481. Xcontents of the file according to instructions which you
  482. Xgive by "embedding" certain commands in the file.
  483. X.PP
  484. XAn example of an embedded command would be this:
  485. X.cc #
  486. X
  487. X#nf
  488. X#in +5
  489. X.ce 3
  490. XThese three lines should
  491. Xbe centered on
  492. Xthe page.
  493. X
  494. X#cc .
  495. X
  496. X.in -5
  497. X.fi
  498. X
  499. XThe resulting output of wroff would be:
  500. X
  501. X.ce 3
  502. XThese three lines should
  503. Xbe centered on
  504. Xthe page.
  505. X
  506. X.PP
  507. XThe three lines are centered as a result of the ".ce 3"
  508. Xcommand being embedded in the text.  ".ce 3" means "center
  509. Xthe next three lines."  
  510. X.PP
  511. XThis is an example of an embedded command.  There are about
  512. Xforty such commands, most of which are not needed for
  513. Xordinary work.  An average document will require only two or
  514. Xthree of the commands.  The rest are present just to do
  515. X"fancy stuff".
  516. X.PP
  517. XAn embedded command is usually the only command on a line, and it
  518. Xusually starts with a period (".").  For this reason,
  519. Xembedded commands are often called "dot commands".  
  520. XIt is unusual to want to actually begin
  521. Xa line with a period, so this works OK.  If you have some reason for
  522. Xwanting to place a period at the first of a line (we did 
  523. Xabove in the example
  524. Xfor ".ce"), there is a way to do it.  
  525. X
  526. X.OP
  527. X\fBModes:\fP  
  528. X.PP
  529. XWe need to explain the difference in "fill mode",
  530. Xand "non-fill" mode.  
  531. X.PP
  532. XIn "fill mode", wroff will pack as many words as possible on
  533. Xa line, no matter how you typed the lines in the original
  534. Xfile.  If you are in "non-fill" mode, the lines will appear
  535. Xin the output just the way you typed them in.  Fill mode is
  536. Xusually "on", but you can turn it off with the command
  537. X".nf".  If you want it back on, just use ".fi".  Here is an
  538. Xexample:
  539. X
  540. X.cc #
  541. X#nf 
  542. X.nf
  543. XThese lines will appear 
  544. Xin non-fill mode, just the
  545. Xway they were typed in.
  546. XThis is useful for making tables and
  547. Xother things that need to line up
  548. Xin a certain way.
  549. X
  550. XHere is the output that results:
  551. X
  552. X
  553. X    These lines will appear
  554. X    in non-fill mode, just the
  555. X    way they were typed in.
  556. X    This is useful for making tables and
  557. X    other things that need to line up
  558. X    in a certain way.
  559. X
  560. X#fi
  561. XHere is the way things would look in fill
  562. Xmode.  Here is the raw text:
  563. X
  564. X#nf
  565. X.fi
  566. XThese lines will appear in
  567. Xfill mode, with the margins adjusted
  568. Xproperly.  This is the usual default for 
  569. Xtext, and so you can just omit the ".fi" if
  570. Xyou want to.
  571. X
  572. XHere is the way they appear after processing by wroff:
  573. X
  574. X#fi
  575. X#cc .
  576. XThese lines will appear in
  577. Xfill mode, with the margins adjusted
  578. Xproperly.  This is the usual default for 
  579. Xtext, and so you can just omit the ".fi" if
  580. Xyou want to.
  581. X
  582. X.OP
  583. X\fBjustify and non-justify modes:\fP  
  584. X.PP
  585. XSometimes we want to place
  586. Xas many words on a line as possible, but we do not want the
  587. Xright margins to be justified.  For instance, you may be
  588. Xwriting a business letter, and a ragged right margin gives
  589. Xsort of a "typed-by-hand" look to a paper.  Use the commands
  590. X".ju" and ".nj" to turn right margin justification on and
  591. Xoff.
  592. X.PP
  593. XHere is an example.  In the text file, we enter:
  594. X
  595. X.nf
  596. X.cc #
  597. X.fi
  598. X.nj
  599. XThese lines will appear with as
  600. Xmany words on a line as possible, but
  601. Xwith the right margin "ragged."
  602. XThis makes for a more "typed-by-hand" appearance,
  603. Xand is useful for correspondence.
  604. X
  605. XHere is the output:
  606. X
  607. X#nj
  608. X#fi
  609. XThese lines will appear with as
  610. Xmany words on a line as possible, but
  611. Xwith the right margin "ragged."
  612. XThis makes for a more "typed-by-hand" appearance,
  613. Xand is useful for correspondence.
  614. X#cc .
  615. X
  616. X.ju
  617. X.fi
  618. X.OP
  619. X\fBChanging the "command character":\fP  
  620. X.PP
  621. XSeveral times in the
  622. Xabove text, we had to print a period (a "dot") as the first
  623. Xcharacter on a line.  Since an embedded commands usually
  624. Xstarts with a "dot", we had to be sure that the
  625. Xdot at the first of a line could be ignored if we wanted it
  626. Xto be.  
  627. X.PP
  628. XThe "dot" is called the "command character", and actually
  629. Xany character can be used.  If we want some other character
  630. Xto become the command character instead, we could use the
  631. X".cc" command (for \fBc\fPhange \fBc\fPommand).  Here is how it
  632. Xworks.
  633. X.cc *
  634. X
  635. XAfter this, the command character is a "#".  For instance, 
  636. X
  637. X*nf
  638. X.cc #
  639. XI can now type a dot at the first of a line like this:
  640. X
  641. X.45 caliber automatic
  642. X
  643. X#cc .
  644. XNow the command character is changed back to a ".".
  645. X
  646. X*fi
  647. X*cc .
  648. X.PP
  649. XWe will see another method of accomplishing the same end later.
  650. X
  651. X.OP
  652. X\fBIndenting:\fP  
  653. X.PP
  654. XMost text in letters requires indented
  655. Xprinting.  The usual left-hand margin in wroff is set to
  656. X1 inch from the left printable margin on a page.  
  657. XHowever, this
  658. Xcan be changed in three ways.
  659. X.PP
  660. XThe left hand margin can be changed to any other value by
  661. Xusing ".in".  For instance, ".in 20" changes the left margin
  662. Xto 2 inches from the left printable margin.  
  663. XThe "20" means that the margin is to be set to 20 deci-inches
  664. X(tenths of an inch) from the left printable margin.
  665. XIncidentally, the left printable margin, depending on your printer, may not
  666. Xbe at the left edge of the paper.  
  667. X.PP
  668. XYou can also do it slightly differently.
  669. XUsing ".in +12" would change the left margin to be 1.2 inches
  670. Xto the right of where it was.  In a like fashion, using ".in
  671. X-5" would move the left margin one-half inch to the left.  For
  672. Xexample:
  673. X
  674. X.nf
  675. X.cc #
  676. X.in 10
  677. XThis would be printed at 1.0 inches from the left of the paper.
  678. X
  679. X.in +5
  680. XThis is placed at inch 1.5.
  681. X
  682. X.in 15
  683. XThis is also placed at inch 1.5.
  684. X
  685. X.in -10
  686. XThis would be printed at inch 0.5 (15 -10).
  687. X
  688. X#cc .
  689. X.fi
  690. X.PP
  691. XA variation on setting a margin permanently is just to
  692. Xchange the margin for \fUonly the next line\fU.  Use ".ti +5"
  693. X(for \fBt\fPemporary \fBi\fPndent 5 deci-inches) to indent only the next
  694. Xline (by 0.5 inches).  This is particularly useful at the beginning of
  695. Xparagraphs.
  696. X.PP
  697. XAs an example,
  698. X
  699. X.cc #
  700. X#nf
  701. X.ti +5
  702. XThe paragraph printed by processing this text will have an
  703. Xindented first line.  The remaining lines will not be
  704. Xindented, but will appear at the left margin.
  705. X
  706. Xprocesses into:
  707. X
  708. X#fi
  709. X#ti +5
  710. XThe paragraph printed by processing this text will have an
  711. Xindented first line.  The remaining lines will not be
  712. Xindented, but will appear at the left margin.
  713. X
  714. X#cc .
  715. X.PP
  716. XAn interesting variation is an "outdent", or hanging leader.
  717. XHere is an example:
  718. X
  719. X.cc #
  720. X#nf
  721. X.ti -5
  722. XThis paragraph has an outdent, or hanging leader in its
  723. Xfirst line.  This really helps when preparing a report or
  724. Xother written work with section headings.
  725. X#fi
  726. X
  727. XThe output will appear as:
  728. X
  729. X#ti -5
  730. XThis paragraph has an outdent, or hanging leader in its
  731. Xfirst line.  This really helps when preparing a report or
  732. Xother written work with section headings.
  733. X
  734. X#cc .
  735. X.OP
  736. X\fBBoldfacing\fP, centering, and \fUunderlining\fU:
  737. X.PP
  738. XCentering text is easy.  Just use ".ce" as in the
  739. Xexample at the first of the paper.  One "trick" is to tell
  740. Xwroff to center a huge number of lines, and then use ".ce 0"
  741. Xto turn centering off like this:
  742. X.nf
  743. X
  744. X.cc #
  745. X.ce 100
  746. XThese and
  747. Xno telling how
  748. Xmany other
  749. Xlines
  750. X----
  751. X---
  752. Xshould be centered.
  753. X.ce 0
  754. X#cc .
  755. X.fi
  756. X
  757. X.PP
  758. XThis results in all of the lines between ".ce 100" and ".ce
  759. X0" being centered, with no requirement for having to count
  760. Xlines ahead of time.  
  761. X.PP
  762. XThe same stunt works on boldface or underlining:
  763. X.cc #
  764. X#nf
  765. X
  766. X.ul 100
  767. X.bd 100
  768. XAll of the words
  769. Xin this block will be both boldfaced and
  770. Xunderlined
  771. X--
  772. X-- all the way
  773. Xdown to here, whereever 
  774. Xthis is.
  775. X.bd 0
  776. X.ul 0
  777. X
  778. X#cc .
  779. X.fi
  780. X
  781. X.PP
  782. XBoldfacing and underlining can be accomplished in two ways.
  783. XOne way is to use either ".bd" or ".ul" as above.
  784. X.PP
  785. XA second way, which is useful when you want to just
  786. Xunderline or boldface a couple of words is to use an
  787. X"in-line font change".
  788. X.PP
  789. XAn illustration probably is sufficient. 
  790. X.PP
  791. XIn this paragraph, we \\fBboldfaced three words\\fP, and \\fUunderlined
  792. Xtwo\\fU words, and \\fIitalicized three words\\fP, and printed a \\\\.  
  793. XHere is how wroff printed it.
  794. X.PP
  795. XIn this paragraph, we \fBboldfaced three words\fP, and \fUunderlined
  796. Xtwo\fU words, and \fIitalicized three words\fP, and printed a \\.  
  797. XHere is how wroff printed it.
  798. X.PP
  799. XIn-line font changes are discussed in more detail in a later section.
  800. X.OP
  801. X\fBUse of Macros:\fP
  802. X.PP
  803. X"Macros" are collections of frequently used commands that
  804. Xcan be called by a single name.  You get to invent the name.
  805. X.PP
  806. XIn typing this document, we frequently had need to 
  807. X"skip 3 lines and then temporarily outdent by 5 spaces" when
  808. Xwe came to a new section.  Rather than always type
  809. X.cc #
  810. X
  811. X#nf
  812. X.sp 3
  813. X.ti -5
  814. X
  815. X#fi
  816. Xat the start of every section, we instead defined a "macro"
  817. Xnamed ".OP" like this:
  818. X
  819. X#nf
  820. X
  821. X.de OP
  822. X.sp 3
  823. X.ti -5
  824. X.en
  825. X
  826. X#nf
  827. XAt the start of every new section, we just typed:
  828. X
  829. X.OP
  830. XThe start of the section ...
  831. X.PP
  832. X
  833. Xand went on about our business.
  834. X#cc .
  835. X.fi
  836. X.PP
  837. XMacros are really powerful.  A well thought out collection
  838. Xof macros can make writing a letter or preparing a memo a
  839. Xbreeze.  Macros can be defined and placed in a file for
  840. Xfuture use.  The file can be included in any document by
  841. Xusing the ".so" command to read the macro file before you
  842. Xstart processing.
  843. X.PP
  844. XDon't overlook the power of macros.  Here is a set we use a
  845. Xlot.  They were placed in a file called "macros" by using
  846. X"vi".  
  847. X
  848. X.in +5
  849. X.OP
  850. Xfile macros contains:
  851. X.nf
  852. X.cc #
  853. X
  854. X.de DATE
  855. X.in +30
  856. X$1 $2 $3
  857. X.br
  858. X.en
  859. X.de TO
  860. X.in 10
  861. X.sp 3
  862. X.nf
  863. X.en
  864. X.de TEXT
  865. X.sp 3
  866. X.fi
  867. X.ti +5
  868. X.en
  869. X.de SIGN
  870. X.sp 3
  871. X.in +30
  872. X.nf
  873. X.en
  874. X#cc .
  875. X.in -5
  876. X
  877. X.fi
  878. X.OP
  879. XNow when we want to write a letter, we write
  880. X.nf
  881. X.in +5
  882. X.cc #
  883. X
  884. X.DATE October 4, 1988
  885. X.TO
  886. XMr. Joe Smith
  887. XSomePlace
  888. XSomewhere, USA
  889. X
  890. XDear Joe:
  891. X.TEXT
  892. XHere is the letter and so forth ...
  893. X.SIGN
  894. XYours Truly,
  895. X
  896. XFred
  897. X#cc .
  898. X.fi
  899. X.in -5
  900. X
  901. XWe print the letter by writing "wroff macros filename".
  902. X.bp
  903. X.OP
  904. X\fBScanning for errors:\fP  
  905. X.PP
  906. Xwroff is somewhat sensitive to
  907. Xerrors in input.  It is sometimes useful to scan a document \fIbefore\fP
  908. Xyou print it to see if all of the wroff commands have been entered 
  909. Xcorrectly.  Use the command line option "-s" to scan for errors
  910. Xif you are concerned.
  911. X.PP
  912. XIf you enter "wroff -s filename", then wroff will not print anything
  913. Xat all, either on the screen, or on the printer.  If there is some kind
  914. Xof problem with any of the wroff commands in your paper, wroff will report
  915. Xthat problem, and the approximate location of it, so that you can fix it
  916. Xbefore you go to the trouble and expense of printing the document.
  917. X.OP
  918. X\fBFonts:\fP
  919. X.PP
  920. XOne of the biggest pleasures in using wroff is that you can combine various
  921. Xtypefaces in a document to give a pleasing appearance.  
  922. X.PP
  923. XThere are several fonts available.  Here is a current list:
  924. X.nf
  925. X\fT
  926. Xsymbol                   font 
  927. X
  928. X.in +5
  929. XB        Times Roman 12 point boldface 
  930. XI        Times Roman 12 point italics
  931. XM        mountable - default is Presentation 18 bold
  932. XT        Courier 12 point
  933. XP        return to previous font
  934. XU        toggle underlining
  935. X0            Times Roman 12 point Normal (default)    
  936. X1        Presentation 18 point - synonymous with M
  937. X2        Helvetica Normal 6 point
  938. X\fP
  939. X.fi
  940. X.in -5
  941. X.PP
  942. XIn order to make effective use of fonts, you must
  943. Xunderstand what is meant by "proportional spacing."
  944. X.PP
  945. XYou may have noticed that in this document, not all letters in 
  946. Xa word are the same "width".  For instance, the letter "i" is much more
  947. Xnarrow than the letter "M".  These letters were printed with a proportionally
  948. Xspaced font.  
  949. X.PP
  950. XProportional spacing is pleasant to read.  It gives a "typeset" quality
  951. Xto printed work.  Most (but not all) of 
  952. Xthis document was printed using Times Roman 12 point
  953. XNormal type.
  954. X.PP
  955. XWroff, in the default mode, allows for proportional printing, and adjusts
  956. Xthe spacing in lines accordingly.
  957. X.PP
  958. XIn the table above, the only proportional fonts are the "Times Roman" fonts.
  959. XThe other fonts are "fixed spacing fonts", which means that each letter
  960. Xtakes the same amount of space as any other letter.  Fixed spacing fonts
  961. Xare especially useful for preparing portions of a document that have
  962. Xlines which need to "line-up" with previous lines.  One such example is
  963. Xwhen preparing a table.
  964. X.PP
  965. XYou can switch fonts, even in the middle of a line, by using
  966. Xan "embedded font change."  To do this, use a "\\f" followed by the symbol
  967. Xfrom the table above that indicates which font you want.
  968. X.PP
  969. XAs an example, the line:
  970. X.nf
  971. X.in +5
  972. X
  973. X\\fBboldface this\\fP and \\fIitalicize this\\fP
  974. X.in -5
  975. X.fi
  976. X
  977. Xwould print as:
  978. X.nf
  979. X
  980. X\fBboldface this\fP and \fIitalicize this\fP
  981. X
  982. X.fi
  983. X.OP
  984. X\fBBuilding tables and using '.nf':\fP
  985. X.PP
  986. XThe only fixed spacing fonts available above are the Courier 12 point,
  987. Xand the Presentation 18 point.  (Point size indicates the height of letters,
  988. Xnot their width.)
  989. X.PP
  990. XIncidentally, you may occasionally want to print the character "\\".
  991. XIf you want to enter such a character,  you may enter '\\\\' in the document.
  992. XThis works for other characters, too.  Entering '\\x' will print the
  993. Xcharacter 'x'.  This seems useless until you realize that it is an alternative
  994. Xway of protecting a line that begins with a period.  
  995. X.PP
  996. XHere is an example table:
  997. X.nf
  998. X.in +5
  999. X
  1000. X\fT
  1001. X
  1002. X\.nf
  1003. X\.in +5
  1004. X\\fT
  1005. XName            Address
  1006. XJoe Smith        Somewhere
  1007. XJames Jones        Nowhere
  1008. XSally Sue        Anywhere
  1009. X\\.50 caliber           Guns
  1010. X\\fP
  1011. X\.in -5
  1012. X
  1013. X.in -5
  1014. X\fP
  1015. X.PP
  1016. XThis was printed by wroff as:
  1017. X
  1018. X
  1019. X.nf
  1020. X.in +5
  1021. X\fT
  1022. XName            Address
  1023. XJoe Smith        Somewhere
  1024. XJames Jones        Nowhere
  1025. XSally Sue        Anywhere
  1026. X\.50 caliber         Guns
  1027. X\fP
  1028. X.fi
  1029. X.in -5
  1030. X
  1031. X.PP
  1032. XJust switching from a proportional font to a fixed font in the same
  1033. Xline, when in fill mode gives no problems at all.  Wroff may become 
  1034. Xconfused when you build tables in non-fill mode and mix several fonts
  1035. Xtogether.  A good word of advice, then, is to build tables in non-fill
  1036. Xmode, using a fixed font, just as we did above.
  1037. X.PP
  1038. XIf for some reason
  1039. Xyou absolutely \fIinsist\fP on using a proportional font to build a table,
  1040. Xyou can use an "anchor".  The "anchor" characters cause a specific
  1041. Xplace in the text to appear in a certain column.  The anchor consists of the
  1042. Xstring "\\f|".
  1043. XHere is an example:
  1044. X.nf
  1045. X.sp
  1046. X.in +5
  1047. X\fT
  1048. Xage    \\f|14
  1049. Xdate    \\f|12
  1050. Xtoday    \\f|2
  1051. X\fP
  1052. X.in -5
  1053. X.fi
  1054. X.PP
  1055. XThis produces the following output:
  1056. X.sp
  1057. X.in +5
  1058. X.nf
  1059. Xage    \f|14
  1060. Xdate    \f|12
  1061. Xtoday    \f|2
  1062. X.in -5
  1063. X.fi
  1064. X.PP
  1065. XWhen processing a line in non-fill mode under a proportional font,
  1066. Xwroff will attempt to duplicate the appearance of the original line as
  1067. Xbest it can.   Wroff takes the original line and determines by counting
  1068. Xcharacters just where on a page that it should begin printing a word.  
  1069. XIt assumes that each character is 0.1 inches in width.
  1070. X.PP
  1071. XWroff then attempts to begin each word in the line at whatever place on
  1072. Xthe page is indicated by the character position of the first letter in
  1073. Xthe word.  This would make for some "funny" looking lines, unless you
  1074. Xplaced the anchors in the line.
  1075. X.OP
  1076. X\fBConclusions:\fP  
  1077. X.PP
  1078. XThere is a lot to wroff, and a lot more to
  1079. Xlearn.  Most of the commands are reasonable to use, and
  1080. Xactually most people only need a few of the commands.
  1081. XStudying the User's Guide will repay a careful reader.
  1082. X.PP
  1083. XAppendix A attached to this paper is a technical description
  1084. Xof all of wroff's commands.  After you gain skill with
  1085. Xwroff, this appendix will probably become very useful to
  1086. Xyou.
  1087. X.PP
  1088. XAppendix B is a listing of the raw unprocessed file that
  1089. Xwas used to create this tutorial.  It should provide a treasure
  1090. Xtrove of examples.
  1091. X.PP
  1092. XEnjoy !
  1093. *-*-END-of-doc/wroff.tut.w-*-*
  1094. echo x - doc/macs.w
  1095. sed 's/^X//' >doc/macs.w <<'*-*-END-of-doc/macs.w-*-*'
  1096. X.de NAME
  1097. X.ti -5
  1098. X\fBName:  $1\fP
  1099. X.sp 2
  1100. X.en
  1101. X.de SYNOPSIS
  1102. X.nf
  1103. X.ti -5
  1104. X\fBSYNOPSIS:\fP
  1105. X.sp 2
  1106. X.en
  1107. X.de FUNCTION
  1108. X.sp 2
  1109. X.ti -5
  1110. X\fBFUNCTION\fP
  1111. X.fi
  1112. X.en
  1113. X.de BUGS
  1114. X.sp 3
  1115. X.ti -5 
  1116. X\fBBUGS\fP
  1117. X.sp 2
  1118. X.en
  1119. X.de PP
  1120. X.sp
  1121. X.ti +5
  1122. X.en
  1123. *-*-END-of-doc/macs.w-*-*
  1124. echo x - doc/welcome
  1125. sed 's/^X//' >doc/welcome <<'*-*-END-of-doc/welcome-*-*'
  1126. X.ce
  1127. XWelcome to the wroff system.
  1128. X.sp 2
  1129. X.nf
  1130. XThis file will be printed both on your screen and on your
  1131. Xlaser printer.
  1132. X
  1133. XOn the HP Laser-Jet II,
  1134. X\fBThis will be in boldface\fI,
  1135. X\fIThis will be in italics\fP,
  1136. X
  1137. X\f2This will be in small print\fP,
  1138. X
  1139. X\f1This will be in big print\fP
  1140. X
  1141. X
  1142. *-*-END-of-doc/welcome-*-*
  1143. echo end of sh-archive
  1144.  
  1145.