home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource5 / 304_01 / ma.doc < prev    next >
Encoding:
Text File  |  1990-02-14  |  8.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.                           USING "MA."
  6.  
  7.  
  8.                          E. E. Bergmann
  9.  
  10.  
  11.  
  12. I.INTRODUCTION
  13. I.INTRODUCTION
  14. I.INTRODUCTION
  15.  
  16.  
  17.      The  file,  "ma.",  is  a  collection  of device independent
  18.  
  19. macros and initializations.  It is the first such file for  ROFF5
  20.  
  21. and  so  will  benefit  from further testing and will probably be
  22.  
  23. enhanced in the future.
  24.  
  25.  
  26.      It is normally preceeded by a  printer  initialization  file
  27.  
  28. and followed  by the file or files to be formatted.  For example,
  29.  
  30. I am using an Okidata Microline 92 printer (so I use the  printer
  31.  
  32. initialization  file,  "ml92.")  and  I  wish to generate a three
  33.  
  34. chapter  work  contained  in  files,  "chap1.",   "chap2.",   and
  35.  
  36. "chap3.".  Assuming that the relevent files are all accessed from
  37.  
  38. the current directory, my command line may look like:
  39.  
  40.  
  41. C>roff5 ml92 ma chap1 chap2 chap3 )
  42.  
  43.  
  44. A second example is to print this documentation:
  45.  
  46.  
  47. C>roff5 ml92 ma ma.src )
  48.  
  49.  
  50.      The  purpose of the final ")" is, of course, to redirect the
  51.  
  52. output of the roff5 formatter to the printer;  it  is  equivalent
  53.  
  54. to "}prn".  We have generated the file, "ma.doc" by using:
  55.  
  56.  
  57. C>roff5 ma ma.doc }ma.doc
  58.  
  59.  
  60.  
  61.  
  62. II.SIMPLE MACROS
  63. II.SIMPLE MACROS
  64. II.SIMPLE MACROS
  65.  
  66.  
  67.      We  have  developed  a  few simple macros which we recommend
  68.  
  69. studying their "source code"  in  the  "ma."  file  to  begin  to
  70.  
  71. understand  writing  one's  own  macros  for special needs and to
  72.  
  73. modify to suit one's own tastes.
  74.  
  75.  
  76.      PAGINATION will start placing page numbers at the top center
  77.  
  78. of each page.  In the file it is  automatically  invoked  by  the
  79.  
  80. line:   ".wh 10 PAGINATION"  which  will  start  it  when we have
  81.  
  82. gotten into the first page.  Since the top of page 1  is  already
  83.  
  84. done, pagination will first be visible on the top of page 2.
  85.  
  86.  
  87.      Major section  headings  are  achieved with the H macro.  We
  88.  
  89. provide for left alignment with roman  numerals  and  bold  type.
  90.  
  91. For  example,  the  header  for this section was created with the
  92.  
  93. line, '.H "SIMPLE MACROS"'.
  94.  
  95.  
  96.      Each paragraph is preceded by the macro command line,  ".P".
  97.  
  98. The  default  style  is  controlled by a number of registers that
  99.  
  100. could be changed to suit taste.  The spacing  between  paragraphs
  101.  
  102. is Ps lines;  its default value is 1 blank line.  The register Pt
  103.  
  104. is   1   or   0   depending   upon   wanting  to  indent  or  not
  105.  
  106. (respectively).  The size of the indent relative to  the  current
  107.  
  108.  
  109.  
  110.                      DOCUMENTATION FOR "MA."
  111.  
  112.  
  113.  
  114.                                -2-
  115.  
  116.  
  117.  
  118. margin  is  controlled  by  the  number  register  Pi which has a
  119.  
  120. default value of 5.
  121.  
  122.  
  123.      To enhance the ".rl" ruler command of roff5, we have a macro
  124.  
  125. command, ".RL" which will act like the  original  when  given  an
  126.  
  127. argument,  but  will  give  a  reasonable  default  ruler when no
  128.  
  129. argument is supplied.
  130.  
  131.  
  132.      When we are in fill mode (the default), we can  conveniently
  133.  
  134. number equations  or  expressions  with  the  ".En" request.  For
  135.  
  136. example, we can get:
  137.  
  138.  
  139. a = b + c                                                     (1)
  140.  
  141.  
  142.                            d = e + f                          (2)
  143.  
  144.  
  145. (examine the source of this file to see how it was done!)
  146.  
  147.  
  148.      Another quick macro line is '.signed "E. E. Bergmann"' which
  149.  
  150. provides a simple way to end some documents, such as this one.
  151.  
  152.  
  153.  
  154. III.COMPOUND MACROS
  155. III.COMPOUND MACROS
  156. III.COMPOUND MACROS
  157.  
  158.  
  159.      Many of the useful macros work  in  cooperation  to  achieve
  160.  
  161. their results.    The  naming of these macros was chosen to align
  162.  
  163. reasonably well with the macro packages used in UNIX(R  by  AT&T)
  164.  
  165. for their  text  formatters.   We recommend reading books such as
  166.  
  167.                                         1
  168. "troff Typsetting for UNIX(tm) Systems."
  169.  
  170.  
  171.      For example, the pair of macro commands,  ".RS"  and  ".RF",
  172.  
  173. which  are  to  handle  reference  starts  and  finishes,  are  a
  174.  
  175. convenient way to provide a means to collect all ones  references
  176.  
  177. at the  end  of  the paper, chapter, or book.  The references are
  178.  
  179. also automatically numbered at the same time.  To use  them,  one
  180.  
  181. generally  wants  to place in the text a superscripted referenmce
  182.  
  183. number.  This is achieved with the defined string (created in the
  184.  
  185. macro  package  with  the  ".ds"  command),  \rn\  at  the   text
  186.  
  187. location.   Immediately  after  this place in the source file one
  188.  
  189. should start a new line with the command, ".RS".   The  following
  190.  
  191. lines  contain  the text that is to be collected as the reference
  192.  
  193. information and printed  at  the  end  of  the  document.    This
  194.  
  195. reference  information  is  terminated  with a new line beginning
  196.  
  197.                                                    2
  198. with the macro command, ".RF" (reference finished).
  199.  
  200.  
  201.      One can place the same reference  in  several  places.    To
  202.  
  203. create  a copy of the \rn\ named, say, "TAG" to be used later for
  204.  
  205. the same reference number, one places the name in  the  reference
  206.  
  207. start:  ".RS TAG".    Later,  for  this  same reference, one uses
  208.  
  209. \TAG\ instead of \rn\.
  210.  
  211.  
  212.      A very  similar  set  of  commands  exists  for  figures  or
  213.  
  214. illustrations.    The   numbering   of   illustrations   is  done
  215.  
  216. automatically using the i# number register.  The  figure  caption
  217.  
  218. is placed after the macro command line, ".IS <tag>", and followed
  219.  
  220. by the  macro  command  line,  ".IE".   The <tag> is optional and
  221.  
  222.  
  223.  
  224.                      DOCUMENTATION FOR "MA."
  225.  
  226.  
  227.  
  228.                                -3-
  229.  
  230.  
  231.  
  232. serves the analogous function we previously described for ".RS".
  233.  
  234.  
  235.      The production of footnotes (at the bottom  of  the  current
  236.  
  237. page,  instead  of  references  that  appear  at  the  end of the
  238.  
  239. document), has proven the most trying for me.  I have included  a
  240.  
  241. demo  file,  "fs."  to  excercise  the relevent macros in a large
  242.  
  243. variety of conditions.  We provide the  option  of  automatically
  244.  
  245. numbering  or  of  other  means such as "*" or "**" to label each
  246.  
  247. footnote.  The numbering  of  footnotes  will  run  consecutively
  248.  
  249. throughout  the document unless one resets the counter, f# with a
  250.  
  251. command of the form:  ".nr f# 1".  A lot of the complexity arises
  252.  
  253. because the amount of space needed on the page varies and one may
  254.  
  255. run  out  of  space   on   the   current   page   under   certain
  256.  
  257. circumstances.    We   have   striven   to   handle   all   cases
  258.  
  259. automatically.
  260.  
  261.  
  262.      We use the ".FS" and ".FE" (footnote start and footnote end)
  263.  
  264. in a manner similar to the ".RS",".RF",  and  ".IS",".IE"  pairs.
  265.  
  266. However,   the  optional  use  of  a  <tag>  in  ".FS  <tag>"  is
  267.  
  268. different;  here we would use for the <tag> a "*", "**", etc.  to
  269.  
  270. substitute for automatically numbering.*
  271.  
  272.  
  273.      To  mark  where  there  is  an  automatic  numbering  for  a
  274.  
  275.                                                             1
  276. footnote, one uses \fn\ as I have at the end of  this  line.   To
  277.  
  278. change  the  spacing  before  each  footnote,  change  the number
  279.  
  280. register, "Fs";  its default value is 0.
  281.  
  282.  
  283.  
  284. IV.CONCLUDING MACROS
  285. IV.CONCLUDING MACROS
  286. IV.CONCLUDING MACROS
  287.  
  288.  
  289.      We have provided a "finish" macro that is the initial choice
  290.  
  291. of end macro (achieved by using ".em  finish").    This  "finish"
  292.  
  293. will  complete  the  production of any remaining footnotes at the
  294.  
  295. end  of  the  document,  generate  one  or  more  new  pages  for
  296.  
  297. references (if needed), and, if needed, one or more pages for the
  298.  
  299. illustration captions listing.
  300.  
  301.  
  302.      It  should  be educational to examine how this documentation
  303.  
  304. was created as well as by studying the contents  of  "ma.".    It
  305.  
  306. should be emphasized that this macro package is neither necessary
  307.  
  308. nor complete.    One  may be happy without using a macro package,
  309.  
  310. since the  basic  ROFF5  formatter  does  most  needed  functions
  311.  
  312. without further elaboration.  One may have very complex needs and
  313.  
  314. wish  to  achieve  a  uniform  set  of  documents  with automatic
  315.  
  316. numbering and sub-numbering, in which case,  this  initial  macro
  317.  
  318. package may provide a starting point.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                              E. E. Bergmann
  325.  
  326.                                              730 Seneca Street
  327.  
  328.                                              Bethlehem, PA 18015
  329.  
  330. __________
  331.  
  332. *As I have just done here.
  333.  
  334. 1. I have just demonstrated an automatic numbered footnote here!
  335.  
  336.  
  337.  
  338.  
  339.                      DOCUMENTATION FOR "MA."
  340.  
  341.  
  342.  
  343.                                -4-
  344.  
  345.  
  346.  
  347.                            REFERENCES
  348.                            __________
  349.                            REFERENCES
  350.                            __________
  351.                            REFERENCES
  352.                            __________
  353.  
  354. 1
  355.  Sandra L. Emerson and Karen  Paulsell,  "troff  Typesetting  for
  356.  
  357. UNIX(tm)   Systems,"   Prentiss-Hall   (New  Jersey,  1987)  ISBN
  358.  
  359. 0-13-930959-4.
  360.  
  361. 2
  362.  I just could not resist creating a reference here to show off!
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.                      DOCUMENTATION FOR "MA."
  418.  
  419.  
  420.