WX("%===================== Start of FunnelWeb TeX Definitions ======================"); WX(""); WX(""); WX("% Version"); WX("% -------"); WX("% This is FunnelWeb TeX Macro Library Version 1.0."); WX(""); WX(""); WX("% Copyright"); WX("% ---------"); WX("% This set of FunnelWeb TeX definitions was written by Ross Williams and was"); WX("% originally Copyright (C) 1992 Ross N. Williams. However, I, Ross Williams,"); WX("% hereby forego any claim to Copyright in this set of FunnelWeb TeX definitions"); WX("% and hereby authorize that the set of TeX definitions pass into the public"); WX("% domain. -- Ross N. Williams, 3:41pm 07-May-1992, Adelaide, Australia."); WX(""); WX(""); WX("% Modification"); WX("% ------------"); WX("% Please record all modifications to these TeX definitions here. Unless"); WX("% otherwise specified, all modified definitions fall in the public domain too."); WX("%"); WX("% Programmers:"); WX("% RNW Ross N. Williams ross@spam.adelaide.edu.au"); WX("%"); WX("% Changes:"); WX("% 07-May-1992 RNW Prepared this work for public domain release."); WX("%"); WX(""); WX(""); WX("% General Comments"); WX("% ----------------"); WX("% This set of TeX definitions exists for two reasons:"); WX("%"); WX("% 1. To shorten and neaten the FunnelWeb TeX output."); WX("% 2. To allow users to fiddle with the output format in their input files"); WX("% (by inserting redefining \"\\def\"s) without having to resort to"); WX("% modifying the FunnelWeb code."); WX("%"); WX("% The user is warned that these definitions may be changed from time to time"); WX("% (but probably not much). The user should not be too sneaky. In particular,"); WX("% users wishing to redefine some of these macros should do so in an explicitly"); WX("% defined section at the top of their input file. This will mean that in the"); WX("% event of problems, that section can simply be deleted or commented out to"); WX("% allow the document to at least be typeset in the default format. Users should"); WX("% limit themselves to redefining these macros in such a section and should"); WX("% refrain from using the macros throughout their documents."); WX(""); WX(""); WX("% Environment Parameters"); WX("% ----------------------"); WX("% \\tolerance tells TeX how tolerant it should be about making bad line and"); WX("% page breaks. Here we set it to it's maximum, as"); WX("% 1) Computer programs are likely to cause lots of bad breaks."); WX("% 2) In most cases the user would probably rather get the TeX file through"); WX("% TeX without any errors than fiddle with spacings for perfection."); WX("\\tolerance=10000"); WX(""); WX("% I don't like indentation as it makes the page look more busy. Instead,"); WX("% paragraphs are separated by a little space (see next)."); WX("\\parindent=0pt"); WX(""); WX("% In many cases, users will produce documents with long runs of paragraphs."); WX("% In order to space out these paragraphs, it is convenient to maintain a"); WX("% prevailing non-zero \\parskip (end-of-paragaph skip). The only trouble is"); WX("% that the skip becomes a problem in macro definitions which require no skip"); WX("% and so we have to turn the skip on and off. The following two macros"); WX("% simplify this process."); WX("\\def\\fwparskipon{\\parskip=\\medskipamount}"); WX("\\def\\fwparskipoff{\\parskip=0pt}"); WX("\\fwparskipon"); WX(""); WX("% Setting raggedbottom allows TeX to leave a bit of space at the bottom of the"); WX("% page in order to better vertically align the rest of the page (e.g. skips"); WX("% won't stretch as much). It also means that headings are less likely to be"); WX("% isolated at the bottom of the page without any following text."); WX("\\raggedbottom"); WX(""); WX(""); WX("% Fonts"); WX("% -----"); WX("% Most of the typeset output is set in 10pt roman and 10pt tt font."); WX("% The major extra font needs spring from titles and headings."); WX("% For portability's sake we use only the following fonts:"); WX("% cmr10"); WX("% cmbx10"); WX("% cmtt10"); WX("% and some enlargements of them. These fonts are all \"standard\" fonts"); WX("% in Plain TeX. See The TeXbook p.350."); WX("\\font\\fwfontnote=cmr7"); WX(""); WX("\\font\\fwfontnorm=cmr10"); WX("\\font\\fwfontnorma=cmr10 scaled \\magstep1"); WX("\\font\\fwfontnormb=cmr10 scaled \\magstep2"); WX(""); WX("\\font\\fwfontbold=cmbx10"); WX("\\font\\fwfontbolda=cmbx10 scaled \\magstep1"); WX("\\font\\fwfontboldb=cmbx10 scaled \\magstep2"); WX("\\font\\fwfontboldc=cmbx10 scaled \\magstep3"); WX("\\font\\fwfontboldd=cmbx10 scaled \\magstep4"); WX(""); WX(""); WX("% Macros for Stylistic Details"); WX("% ----------------------------"); WX("% This section contains all the fiddly little macros for setting the details"); WX("% of each macro definition."); WX(""); WX("% Macro definitions are sandwiched by calls to these macros which can be used"); WX("% to sort out the spacing before and after the macro definition."); WX("\\def\\fwbeginmacro{\\fwparskipoff\\bigskip}"); WX("\\def\\fwendmacro{\\fwparskipon\\par}"); WX(""); WX("% These macros deal with the macro name and definition line."); WX("\\def\\fwmacroname#1#2{{\\sl #1\\/}$\\lbrack$#2$\\rbrack$}"); WX("\\def\\fwfilename#1#2{{\\bf #1}$\\lbrack$#2$\\rbrack$}"); WX("\\def\\fwzero#1{{\\bf Z}}"); WX("\\def\\fwmany#1{{\\bf M}}"); WX("\\def\\fwequals{ $\\equiv$}"); WX("\\def\\fwplusequals{ $+\\equiv$}"); WX(""); WX("% Now for the actual body of the definition. It looks nice to have the tt"); WX("% code indented a little. Again, we use macros instead of writing direct TeX,"); WX("% so as to allow the user to fiddle this stuff to taste without having to"); WX("% modify the FunnelWeb C code."); WX("\\def\\fwodef{\\parindent=15pt\\vskip0pt$\\lbrace$\\parindent=20pt}"); WX("\\def\\fwcdef{$\\rbrace$\\vskip0pt\\parindent=0pt}"); WX("\\def\\fwoquote{`}"); WX("\\def\\fwcquote{'}"); WX("\\def\\fwoparen{$($}"); WX("\\def\\fwcomma{$,$}"); WX("\\def\\fwcparen{$)$}"); WX("\\def\\fwparam#1{$\\diamond #1$}"); WX("\\def\\fwparams#1{$(\\diamond #1)$}"); WX(""); WX("% These macros deal with the notes that are appended at the end of each"); WX("% macro definition. Note that even though \\fwisafile,\\fwusedin, and \\fwseealso"); WX("% have the same definition, they are given different names so as to allow the"); WX("% user to redefine these macros to typeset each kind of information differently"); WX("% if desired."); WX("\\def\\fwbeginmacronotes{\\begingroup\\baselineskip=9pt\\smallskip}"); WX("\\def\\fwnote#1{{\\fwfontnote #1}\\par}"); WX("\\def\\fwisafile#1{\\fwnote{#1}}"); WX("\\def\\fwusedin#1{\\fwnote{#1}}"); WX("\\def\\fwseealso#1{\\fwnote{#1}}"); WX("\\def\\fwendmacronotes{\\endgroup}"); WX(""); WX(""); WX("% Macros to Typeset Program Code Verbatim"); WX("% ---------------------------------------"); WX("% This is by far the hairiest and most difficult part of the typesetting task"); WX("% because we have to turn off most of TeX's natural instincts in order to"); WX("% typeset the program text exactly as it appears in the input file."); WX("% Two macros are defined to pull this off: \\fwbtx and \\fwverbatimgobble."); WX("% Their code was inspired by the following sections of \"The TeXbook\":"); WX("% Appendix D: Dirty Tricks, 3.Verbatim listing, p.380-382."); WX("% Appendix E: Example Formats, p.421."); WX("% The \\fwbtx[ (for \"FunnelWeb Begin TeXt\") macro does most of the hard work."); WX("% The liberal use of \"%\" is because I don't understand TeX well enough to"); WX("% understand when an end of line will cause trouble, and I am playing it safe."); WX(""); WX("% Before defining the main \\fwbtx macro, we have to stash away some definitions"); WX("% in the hidden part of TeX's environment. Let's hope that these \"hidden\""); WX("% definitions don't affect anything except what is desired to be affected."); WX(""); WX("% The tt font in which we wish to set the text has two Latin lurking ligatures!"); WX("% These are ?` and !`. To disable them, we define the left quote when ACTIVE"); WX("% to be defined in such a way as to prevent ligatures. The main TeX text will"); WX("% normally not be exposed to this definition because normally the leftquote"); WX("% character is not active. The \\fwbtx macro temporarily makes the left quote"); WX("% character active thus activating the deactivation of left quote ligatures."); WX("% See The TeXbook p.381."); WX("{\\catcode`\\`=\\active \\gdef`{\\relax\\lq}}"); WX(""); WX("% TeX is fairly carefree about spaces and so we have to make it more serious."); WX("% To do so we pull the same trick as above, setting up a definition for active"); WX("% space, but only making space active during the span of the verbatim text."); WX("% In Plain TeX the active space is defined to be simply a space, but here we"); WX("% define it to be a control space. This ensures that the space cannot"); WX("% be gobbled up by one of TeX's mysterious mechanisms when activated."); WX("% See The TeXbook, p.381 and p.352."); WX("{\\obeyspaces\\global\\let =\\ }"); WX(""); WX("% Here is the main \\fwbtx verbatim text macro."); WX("% Note: The order in which all these pieces of business have to be done is"); WX("% still a partial mystery to me. Don't fiddle with this stuff unless you"); WX("% think you know what you are doing."); WX("\\def\\fwbtx[{%"); WX("%"); WX("% The funnies involved in getting verbatim output are safely housed inside"); WX("% this \\begingroup, and the \\endgroup in \\fwverbatimgobble. Groups are used"); WX("% instead of curly braces because we have to be able to signal the end of"); WX("% this macro with a curly brace."); WX("\\begingroup%"); WX("%"); WX("% \\pars at the end of empty lines in the verbatim text won't come out normally"); WX("% because TeX is in vertical mode and they get gobbled up. To prevent this,"); WX("% we force \\par to exit vertical mode first. See The TeXbook p.381."); WX("\\def\\par{\\leavevmode\\endgraf}%"); WX("%"); WX("% Activate the leftquote character so as to avoid ligatures (see above)."); WX("\\catcode`\\`=\\active%"); WX("%"); WX("% The \\obeylines macro simply defines end of line (^M) to be \\par. This ensures"); WX("% that TeX will treat each verbatim line as a new paragraph."); WX("\\obeylines%"); WX("%"); WX("% To get verbatim output, we have to desex all the special characters. This"); WX("% is explained in detail in The TeXbook p.380."); WX("\\def\\do##1{\\catcode`##1=12 }\\dospecials%"); WX("%"); WX("% Activate the space character so as to make TeX treat blanks seriously."); WX("% This activation invokes an eralier definition (see above)."); WX("\\obeyspaces"); WX("%"); WX("% Interparagraph skips do not help the cause."); WX("% Note: We have to preserve the indentation though, as the code is actually"); WX("% indented in the final output. See \\fwodef in an earlier section."); WX("\\parskip=0pt%"); WX("%"); WX("% We typeset the verbatim text in tt font (courier on the Macintosh) for a"); WX("% number of reasons:"); WX("% - tt font has the same horizontal spacing for each character."); WX("% - tt font covers the ASCII character set."); WX("% - tt font doesn't have many surprises (e.g. ligatures)."); WX("% - tt font looks much what you might see on a computer terminal screen."); WX("\\tt%"); WX("%"); WX("% Having set up an environment for verbatim, we are ready to use it."); WX("% By invoking \\fwverbatimgobble, this \\fwbtx macro gobbles up text verbatim (as"); WX("% part of the parameter of \\fwverbatimgobble) until it sees the termination"); WX("% string \"]fwetx=\" (the \"=\" was thrown in to add obscurity as this sequence"); WX("% must never occur in the verbatim text)."); WX("\\fwverbatimgobble}"); WX(""); WX("% The \\fwverbatimgobble macro exists to allow \\fwbtx to bracket verbatim text."); WX("\\def\\fwverbatimgobble#1]fwetx={#1\\endgroup}"); WX(""); WX(""); WX("% Table of Contents"); WX("% -----------------"); WX("% The five levels of table of contents that FunnelWeb supports are identified"); WX("% by the five letters [A..E]. These are used throughout the following macros."); WX(""); WX("% The following macros are utilities to the TOC macros to follow."); WX("\\def\\fwrule{\\medskip\\hrule\\medskip}"); WX("\\def\\fwqh{\\hskip1.5em\\relax}"); WX("\\def\\fwbeforesec{\\penalty-200\\bigskip\\medskip\\par}"); WX(""); WX("% The following macros are used to typeset the table of contents."); WX("\\def\\fwtocstart#1{\\fwrule\\leftline{\\fwfontbolda Table of Contents}\\fwrule}"); WX("\\def\\fwtoca#1#2{\\leftline{{\\bf #1 #2}}}"); WX("\\def\\fwtocb#1#2{\\leftline{\\fwqh #1 #2}}"); WX("\\def\\fwtocc#1#2{\\leftline{\\fwqh\\fwqh #1 #2}}"); WX("\\def\\fwtocd#1#2{\\leftline{\\fwqh\\fwqh\\fwqh #1 #2}}"); WX("\\def\\fwtoce#1#2{\\leftline{\\fwqh\\fwqh\\fwqh\\fwqh #1 #2}}"); WX("\\def\\fwtocfinish#1{\\fwrule}"); WX(""); WX("% The following \"library\" macros define five different strengths of headings"); WX("% which can be used later in the section macros."); WX("\\def\\fwliba#1#2{\\vfill\\eject{\\fwfontboldc #1 #2}\\penalty200\\smallskip}"); WX("\\def\\fwlibb#1#2{\\fwbeforesec{\\fwfontboldb #1 #2}\\penalty200\\smallskip}"); WX("\\def\\fwlibc#1#2{\\fwbeforesec{\\fwfontnormb #1 #2}\\penalty200\\smallskip}"); WX("\\def\\fwlibd#1#2{\\fwbeforesec{\\bf #1 #2}\\penalty200}"); WX("\\def\\fwlibe#1#2{\\fwbeforesec{\\bf #1 #2}}"); WX(""); WX("% Here are the macros that actually typeset the section headings throughout"); WX("% the document. The fwlib system has been employed so as to easily allow the"); WX("% user to redefine the strengths of headings to taste. For example, the"); WX("% user could insert in the input document a similar set of definitions to these"); WX("% but with the b..e headings set to \\fwlibc. This would tone down the output."); WX("\\def\\fwseca#1#2{\\fwliba{#1}{#2}}"); WX("\\def\\fwsecb#1#2{\\fwlibb{#1}{#2}}"); WX("\\def\\fwsecc#1#2{\\fwlibc{#1}{#2}}"); WX("\\def\\fwsecd#1#2{\\fwlibd{#1}{#2}}"); WX("\\def\\fwsece#1#2{\\fwlibe{#1}{#2}}"); WX(""); WX(""); WX("% Support for Explicit Typesetting"); WX("% --------------------------------"); WX("% FunnelWeb supports pragmas and other constructs that allow"); WX("% typesetter-independent typesetting commands to be given. The"); WX("% following macros support these features."); WX(""); WX("% The in-text literal @{sloth@} and emphasise @[walrus@] features."); WX("\\def\\fwlit#1{{\\tt #1}}"); WX("\\def\\fwemp#1{{\\it #1}}"); WX(""); WX("% The \"@p new_page\" pragma."); WX("\\def\\fwnewpage{\\vfill\\eject}"); WX(""); WX("% The \"@p vskip Nmm\" pragma."); WX("\\def\\fwvskip#1{\\null\\vskip #1mm}"); WX(""); WX("% The \"@p title \" pragma."); WX("\\def\\fwfontnormal#1{{\\fwfontnorm {#1}}}"); WX("\\def\\fwfonttitle#1{{\\fwfontboldd {#1}}}"); WX("\\def\\fwfontsmalltitle#1{{\\fwfontboldb {#1}}}"); WX("\\def\\fwleftline#1{\\leftline{#1}}"); WX("\\def\\fwcenterline#1{\\centerline{#1}}"); WX("\\def\\fwrightline#1{\\rightline{#1}}"); WX(""); WX(""); WX("% Support for Old FunnelWeb"); WX("% -------------------------"); WX("% The following macros were used extensively in the first version of"); WX("% FunnelWeb and are retained so that these older input files will still"); WX("% typeset cleanly."); WX("\\def\\p#1{{\\tt #1}} % P for Program text."); WX("\\def\\flagpage#1#2{"); WX(" \\null"); WX(" \\vfill"); WX(" \\centerline{\\fwfontboldd #1}"); WX(" \\vskip 1cm"); WX(" \\centerline{\\fwfontboldd #2}"); WX(" \\vfill"); WX(" \\null"); WX(" \\vfill"); WX("}"); WX(""); WX("%====================== End of FunnelWeb TeX Definitions =======================");