home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / FUNNEL_S / SOURCES / TEXHEAD.TEX < prev    next >
Text File  |  1992-05-27  |  13KB  |  321 lines

  1. %===================== Start of FunnelWeb TeX Definitions ======================
  2.  
  3.  
  4. % Version
  5. % -------
  6. % This is FunnelWeb TeX Macro Library Version 1.0.
  7.  
  8.  
  9. % Copyright
  10. % ---------
  11. % This set of FunnelWeb TeX definitions was written by Ross Williams and was
  12. % originally Copyright (C) 1992 Ross N. Williams.  However, I, Ross Williams,
  13. % hereby forego any claim to Copyright in this set of FunnelWeb TeX definitions
  14. % and hereby authorize that the set of TeX definitions pass into the public
  15. % domain. -- Ross N. Williams, 3:41pm 07-May-1992, Adelaide, Australia.
  16.  
  17.  
  18. % Modification
  19. % ------------
  20. % Please record all modifications to these TeX definitions here. Unless
  21. % otherwise specified, all modified definitions fall in the public domain too.
  22. %
  23. % Programmers:
  24. %    RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  25. %
  26. % Changes:
  27. %    07-May-1992  RNW  Prepared this work for public domain release.
  28. %
  29.  
  30.  
  31. % General Comments
  32. % ----------------
  33. % This set of TeX definitions exists for two reasons:
  34. %
  35. %    1. To shorten and neaten the FunnelWeb TeX output.
  36. %    2. To allow users to fiddle with the output format in their input files
  37. %       (by inserting redefining "\def"s) without having to resort to
  38. %       modifying the FunnelWeb code.
  39. %
  40. % The user is warned that these definitions may be changed from time to time
  41. % (but probably not much). The user should not be too sneaky. In particular,
  42. % users wishing to redefine some of these macros should do so in an explicitly
  43. % defined section at the top of their input file. This will mean that in the
  44. % event of problems, that section can simply be deleted or commented out to
  45. % allow the document to at least be typeset in the default format. Users should
  46. % limit themselves to redefining these macros in such a section and should
  47. % refrain from using the macros throughout their documents.
  48.  
  49.  
  50. % Environment Parameters
  51. % ----------------------
  52. % \tolerance tells TeX how tolerant it should be about making bad line and
  53. % page breaks. Here we set it to it's maximum, as
  54. %   1) Computer programs are likely to cause lots of bad breaks.
  55. %   2) In most cases the user would probably rather get the TeX file through
  56. %      TeX without any errors than fiddle with spacings for perfection.
  57. \tolerance=10000
  58.  
  59. % I don't like indentation as it makes the page look more busy. Instead,
  60. % paragraphs are separated by a little space (see next).
  61. \parindent=0pt
  62.  
  63. % In many cases, users will produce documents with long runs of paragraphs.
  64. % In order to space out these paragraphs, it is convenient to maintain a
  65. % prevailing non-zero \parskip (end-of-paragaph skip). The only trouble is
  66. % that the skip becomes a problem in macro definitions which require no skip
  67. % and so we have to turn the skip on and off. The following two macros
  68. % simplify this process.
  69. \def\fwparskipon{\parskip=\medskipamount}
  70. \def\fwparskipoff{\parskip=0pt}
  71. \fwparskipon
  72.  
  73. % Setting raggedbottom allows TeX to leave a bit of space at the bottom of the
  74. % page in order to better vertically align the rest of the page (e.g. skips
  75. % won't stretch as much). It also means that headings are less likely to be
  76. % isolated at the bottom of the page without any following text.
  77. \raggedbottom
  78.  
  79.  
  80. % Fonts
  81. % -----
  82. % Most of the typeset output is set in 10pt roman and 10pt tt font.
  83. % The major extra font needs spring from titles and headings.
  84. % For portability's sake we use only the following fonts:
  85. %    cmr10
  86. %    cmbx10
  87. %    cmtt10
  88. % and some enlargements of them. These fonts are all "standard" fonts
  89. % in Plain TeX. See The TeXbook p.350.
  90. \font\fwfontnote=cmr7
  91.  
  92. \font\fwfontnorm=cmr10
  93. \font\fwfontnorma=cmr10 scaled \magstep1
  94. \font\fwfontnormb=cmr10 scaled \magstep2
  95.  
  96. \font\fwfontbold=cmbx10
  97. \font\fwfontbolda=cmbx10 scaled \magstep1
  98. \font\fwfontboldb=cmbx10 scaled \magstep2
  99. \font\fwfontboldc=cmbx10 scaled \magstep3
  100. \font\fwfontboldd=cmbx10 scaled \magstep4
  101.  
  102.  
  103. % Macros for Stylistic Details
  104. % ----------------------------
  105. % This section contains all the fiddly little macros for setting the details
  106. % of each macro definition.
  107.  
  108. % Macro definitions are sandwiched by calls to these macros which can be used
  109. % to sort out the spacing before and after the macro definition.
  110. \def\fwbeginmacro{\fwparskipoff\bigskip}
  111. \def\fwendmacro{\fwparskipon\par}
  112.  
  113. % These macros deal with the macro name and definition line.
  114. \def\fwmacroname#1#2{{\sl #1\/}$\lbrack$#2$\rbrack$}
  115. \def\fwfilename#1#2{{\bf #1}$\lbrack$#2$\rbrack$}
  116. \def\fwzero#1{{\bf Z}}
  117. \def\fwmany#1{{\bf M}}
  118. \def\fwequals{ $\equiv$}
  119. \def\fwplusequals{ $+\equiv$}
  120.  
  121. % Now for the actual body of the definition. It looks nice to have the tt
  122. % code indented a little. Again, we use macros instead of writing direct TeX,
  123. % so as to allow the user to fiddle this stuff to taste without having to
  124. % modify the FunnelWeb C code.
  125. \def\fwodef{\parindent=15pt\vskip0pt$\lbrace$\parindent=20pt}
  126. \def\fwcdef{$\rbrace$\vskip0pt\parindent=0pt}
  127. \def\fwoquote{`}
  128. \def\fwcquote{'}
  129. \def\fwoparen{$($}
  130. \def\fwcomma{$,$}
  131. \def\fwcparen{$)$}
  132. \def\fwparam#1{$\diamond #1$}
  133. \def\fwparams#1{$(\diamond #1)$}
  134.  
  135. % These macros deal with the notes that are appended at the end of each
  136. % macro definition. Note that even though \fwisafile,\fwusedin, and \fwseealso
  137. % have the same definition, they are given different names so as to allow the
  138. % user to redefine these macros to typeset each kind of information differently
  139. % if desired.
  140. \def\fwbeginmacronotes{\begingroup\baselineskip=9pt\smallskip}
  141. \def\fwnote#1{{\fwfontnote #1}\par}
  142. \def\fwisafile#1{\fwnote{#1}}
  143. \def\fwusedin#1{\fwnote{#1}}
  144. \def\fwseealso#1{\fwnote{#1}}
  145. \def\fwendmacronotes{\endgroup}
  146.  
  147.  
  148. % Macros to Typeset Program Code Verbatim
  149. % ---------------------------------------
  150. % This is by far the hairiest and most difficult part of the typesetting task
  151. % because we have to turn off most of TeX's natural instincts in order to
  152. % typeset the program text exactly as it appears in the input file.
  153. % Two macros are defined to pull this off: \fwbtx and \fwverbatimgobble.
  154. % Their code was inspired by the following sections of "The TeXbook":
  155. %    Appendix D: Dirty Tricks, 3.Verbatim listing, p.380-382.
  156. %    Appendix E: Example Formats, p.421.
  157. % The \fwbtx[ (for "FunnelWeb Begin TeXt") macro does most of the hard work.
  158. % The liberal use of "%" is because I don't understand TeX well enough to
  159. % understand when an end of line will cause trouble, and I am playing it safe.
  160.  
  161. % Before defining the main \fwbtx macro, we have to stash away some definitions
  162. % in the hidden part of TeX's environment. Let's hope that these "hidden"
  163. % definitions don't affect anything except what is desired to be affected.
  164.  
  165. % The tt font in which we wish to set the text has two Latin lurking ligatures!
  166. % These are ?` and !`. To disable them, we define the left quote when ACTIVE
  167. % to be defined in such a way as to prevent ligatures. The main TeX text will
  168. % normally not be exposed to this definition because normally the leftquote
  169. % character is not active. The \fwbtx macro temporarily makes the left quote
  170. % character active thus activating the deactivation of left quote ligatures.
  171. % See The TeXbook p.381.
  172. {\catcode`\`=\active \gdef`{\relax\lq}}
  173.  
  174. % TeX is fairly carefree about spaces and so we have to make it more serious.
  175. % To do so we pull the same trick as above, setting up a definition for active
  176. % space, but only making space active during the span of the verbatim text.
  177. % In Plain TeX the active space is defined to be simply a space, but here we
  178. % define it to be a control space. This ensures that the space cannot
  179. % be gobbled up by one of TeX's mysterious mechanisms when activated.
  180. % See The TeXbook, p.381 and p.352.
  181. {\obeyspaces\global\let =\ }
  182.  
  183. % Here is the main \fwbtx verbatim text macro.
  184. % Note: The order in which all these pieces of business have to be done is
  185. % still a partial mystery to me. Don't fiddle with this stuff unless you
  186. % think you know what you are doing.
  187. \def\fwbtx[{%
  188. %
  189. % The funnies involved in getting verbatim output are safely housed inside
  190. % this \begingroup, and the \endgroup in \fwverbatimgobble. Groups are used
  191. % instead of curly braces because we have to be able to signal the end of
  192. % this macro with a curly brace.
  193. \begingroup%
  194. %
  195. % \pars at the end of empty lines in the verbatim text won't come out normally
  196. % because TeX is in vertical mode and they get gobbled up. To prevent this,
  197. % we force \par to exit vertical mode first. See The TeXbook p.381.
  198. \def\par{\leavevmode\endgraf}%
  199. %
  200. % Activate the leftquote character so as to avoid ligatures (see above).
  201. \catcode`\`=\active%
  202. %
  203. % The \obeylines macro simply defines end of line (^M) to be \par. This ensures
  204. % that TeX will treat each verbatim line as a new paragraph.
  205. \obeylines%
  206. %
  207. % To get verbatim output, we have to desex all the special characters. This
  208. % is explained in detail in The TeXbook p.380.
  209. \def\do##1{\catcode`##1=12 }\dospecials%
  210. %
  211. % Activate the space character so as to make TeX treat blanks seriously.
  212. % This activation invokes an eralier definition (see above).
  213. \obeyspaces
  214. %
  215. % Interparagraph skips do not help the cause.
  216. % Note: We have to preserve the indentation though, as the code is actually
  217. % indented in the final output. See \fwodef in an earlier section.
  218. \parskip=0pt%
  219. %
  220. % We typeset the verbatim text in tt font (courier on the Macintosh) for a
  221. % number of reasons:
  222. %    - tt font has the same horizontal spacing for each character.
  223. %    - tt font covers the ASCII character set.
  224. %    - tt font doesn't have many surprises (e.g. ligatures).
  225. %    - tt font looks much what you might see on a computer terminal screen.
  226. \tt%
  227. %
  228. % Having set up an environment for verbatim, we are ready to use it.
  229. % By invoking \fwverbatimgobble, this \fwbtx macro gobbles up text verbatim (as
  230. % part of the parameter of \fwverbatimgobble) until it sees the termination
  231. % string "]fwetx=" (the "=" was thrown in to add obscurity as this sequence
  232. % must never occur in the verbatim text).
  233. \fwverbatimgobble}
  234.  
  235. % The \fwverbatimgobble macro exists to allow \fwbtx to bracket verbatim text.
  236. \def\fwverbatimgobble#1]fwetx={#1\endgroup}
  237.  
  238.  
  239. % Table of Contents
  240. % -----------------
  241. % The five levels of table of contents that FunnelWeb supports are identified
  242. % by the five letters [A..E]. These are used throughout the following macros.
  243.  
  244. % The following macros are utilities to the TOC macros to follow.
  245. \def\fwrule{\medskip\hrule\medskip}
  246. \def\fwqh{\hskip1.5em\relax}
  247. \def\fwbeforesec{\penalty-200\bigskip\medskip\par}
  248.  
  249. % The following macros are used to typeset the table of contents.
  250. \def\fwtocstart#1{\fwrule\leftline{\fwfontbolda Table of Contents}\fwrule}
  251. \def\fwtoca#1#2{\leftline{{\bf #1 #2}}}
  252. \def\fwtocb#1#2{\leftline{\fwqh #1 #2}}
  253. \def\fwtocc#1#2{\leftline{\fwqh\fwqh #1 #2}}
  254. \def\fwtocd#1#2{\leftline{\fwqh\fwqh\fwqh #1 #2}}
  255. \def\fwtoce#1#2{\leftline{\fwqh\fwqh\fwqh\fwqh #1 #2}}
  256. \def\fwtocfinish#1{\fwrule}
  257.  
  258. % The following "library" macros define five different strengths of headings
  259. % which can be used later in the section macros.
  260. \def\fwliba#1#2{\vfill\eject{\fwfontboldc #1 #2}\penalty200\smallskip}
  261. \def\fwlibb#1#2{\fwbeforesec{\fwfontboldb #1 #2}\penalty200\smallskip}
  262. \def\fwlibc#1#2{\fwbeforesec{\fwfontnormb #1 #2}\penalty200\smallskip}
  263. \def\fwlibd#1#2{\fwbeforesec{\bf          #1 #2}\penalty200}
  264. \def\fwlibe#1#2{\fwbeforesec{\bf          #1 #2}}
  265.  
  266. % Here are the macros that actually typeset the section headings throughout
  267. % the document. The fwlib system has been employed so as to easily allow the
  268. % user to redefine the strengths of headings to taste. For example, the
  269. % user could insert in the input document a similar set of definitions to these
  270. % but with the b..e headings set to \fwlibc. This would tone down the output.
  271. \def\fwseca#1#2{\fwliba{#1}{#2}}
  272. \def\fwsecb#1#2{\fwlibb{#1}{#2}}
  273. \def\fwsecc#1#2{\fwlibc{#1}{#2}}
  274. \def\fwsecd#1#2{\fwlibd{#1}{#2}}
  275. \def\fwsece#1#2{\fwlibe{#1}{#2}}
  276.  
  277.  
  278. % Support for Explicit Typesetting
  279. % --------------------------------
  280. % FunnelWeb supports pragmas and other constructs that allow
  281. % typesetter-independent typesetting commands to be given. The
  282. % following macros support these features.
  283.  
  284. % The in-text literal @{sloth@} and emphasise @[walrus@] features.
  285. \def\fwlit#1{{\tt #1}}
  286. \def\fwemp#1{{\it #1}}
  287.  
  288. % The "@p new_page" pragma.
  289. \def\fwnewpage{\vfill\eject}
  290.  
  291. % The "@p vskip Nmm" pragma.
  292. \def\fwvskip#1{\null\vskip #1mm}
  293.  
  294. % The "@p title <font> <align> <text>" pragma.
  295. \def\fwfontnormal#1{{\fwfontnorm {#1}}}
  296. \def\fwfonttitle#1{{\fwfontboldd {#1}}}
  297. \def\fwfontsmalltitle#1{{\fwfontboldb {#1}}}
  298. \def\fwleftline#1{\leftline{#1}}
  299. \def\fwcenterline#1{\centerline{#1}}
  300. \def\fwrightline#1{\rightline{#1}}
  301.  
  302.  
  303. % Support for Old FunnelWeb
  304. % -------------------------
  305. % The following macros were used extensively in the first version of
  306. % FunnelWeb and are retained so that these older input files will still
  307. % typeset cleanly.
  308. \def\p#1{{\tt #1}}  % P for Program text.
  309. \def\flagpage#1#2{
  310.    \null
  311.    \vfill
  312.    \centerline{\fwfontboldd #1}
  313.    \vskip 1cm
  314.    \centerline{\fwfontboldd #2}
  315.    \vfill
  316.    \null
  317.    \vfill
  318. }
  319.  
  320. %====================== End of FunnelWeb TeX Definitions =======================
  321.