mirror of https://github.com/CGAL/cgal
147 lines
6.9 KiB
TeX
147 lines
6.9 KiB
TeX
%
|
|
\font\fwfontnote=cmr7
|
|
\font\fwfontnorm=cmr10
|
|
\font\fwfontnorma=cmr10 scaled \magstep1
|
|
\font\fwfontnormb=cmr10 scaled \magstep2
|
|
\font\fwfontbold=cmbx10
|
|
\font\fwfontbolda=cmbx10 scaled \magstep1
|
|
\font\fwfontboldb=cmbx10 scaled \magstep2
|
|
\font\fwfontboldc=cmbx10 scaled \magstep3
|
|
\font\fwfontboldd=cmbx10 scaled \magstep4
|
|
|
|
\def\customsize{\normalsize}
|
|
|
|
% Macros for Stylistic Details
|
|
% ----------------------------
|
|
% This section contains all the fiddly little macros for setting the details
|
|
% of each macro definition.
|
|
|
|
% Macro definitions are sandwiched by calls to these macros which can be used
|
|
% to sort out the spacing before and after the macro definition.
|
|
\def\fwbeginmacro{}
|
|
\def\fwendmacro{}
|
|
% These macros deal with the macro name and definition line.
|
|
\def\fwmacroname#1#2{{\customsize{\sl #1\/}$\lbrack$#2$\rbrack$}}
|
|
\def\fwfilename#1#2{{\customsize{\bf #1}$\lbrack$#2$\rbrack$}}
|
|
\def\fwzero#1{{\bf\customsize\ Z}}
|
|
\def\fwmany#1{{\bf\customsize\ M}}
|
|
\def\fwlib#1{{\bf\customsize\ L}}
|
|
\def\fwequals{{\customsize\ $\equiv$}}
|
|
\def\fwplusequals{{\customsize\ $+\equiv$}}
|
|
% Now for the actual body of the definition. It looks nice to have the tt
|
|
% code indented a little. Again, we use macros instead of writing direct TeX,
|
|
% so as to allow the user to fiddle this stuff to taste without having to
|
|
% modify the FunnelWeb C code.
|
|
\def\fwodef{\customsize\parindent=15pt\vskip0pt$\lbrace$\parindent=20pt}
|
|
\def\fwcdef{\customsize$\rbrace$\vskip0pt\parindent=0pt\normalsize}
|
|
\def\fwoquote{`}
|
|
\def\fwcquote{'}
|
|
\def\fwoparen{$($}
|
|
\def\fwcomma{$,$}
|
|
\def\fwcparen{$)$}
|
|
\def\fwparam#1{$\diamond #1$}
|
|
\def\fwparams#1{$(\diamond #1)$}
|
|
% These macros deal with the notes that are appended at the end of each
|
|
% macro definition. Note that even though \fwisafile,\fwusedin, and \fwseealso
|
|
% have the same definition, they are given different names so as to allow the
|
|
% user to redefine these macros to typeset each kind of information differently
|
|
% if desired.
|
|
\def\fwbeginmacronotes{\begingroup\baselineskip=9pt\smallskip}
|
|
\def\fwnote#1{{\fwfontnote #1}\par}
|
|
\def\fwisafile#1{\fwnote{#1}}
|
|
\def\fwusedin#1{\fwnote{#1}}
|
|
\def\fwseealso#1{\fwnote{#1}}
|
|
\def\fwendmacronotes{\endgroup}
|
|
% Macros to Typeset Program Code Verbatim
|
|
% ---------------------------------------
|
|
% This is by far the hairiest and most difficult part of the typesetting task
|
|
% because we have to turn off most of TeX's natural instincts in order to
|
|
% typeset the program text exactly as it appears in the input file.
|
|
% Two macros are defined to pull this off: \fwbtx and \fwverbatimgobble.
|
|
% Their code was inspired by the following sections of "The TeXbook":
|
|
% Appendix D: Dirty Tricks, 3.Verbatim listing, p.380-382.
|
|
% Appendix E: Example Formats, p.421.
|
|
% The \fwbtx[ (for "FunnelWeb Begin TeXt") macro does most of the hard work.
|
|
% The liberal use of "%" is because I don't understand TeX well enough to
|
|
% understand when an end of line will cause trouble, and I am playing it safe.
|
|
% Before defining the main \fwbtx macro, we have to stash away some definitions
|
|
% in the hidden part of TeX's environment. Let's hope that these "hidden"
|
|
% definitions don't affect anything except what is desired to be affected.
|
|
% The tt font in which we wish to set the text has two Latin lurking ligatures!
|
|
% These are ?` and !`. To disable them, we define the left quote when ACTIVE
|
|
% to be defined in such a way as to prevent ligatures. The main TeX text will
|
|
% normally not be exposed to this definition because normally the leftquote
|
|
% character is not active. The \fwbtx macro temporarily makes the left quote
|
|
% character active thus activating the deactivation of left quote ligatures.
|
|
% See The TeXbook p.381.
|
|
{\catcode`\`=\active \gdef`{\relax\lq}}
|
|
% TeX is fairly carefree about spaces and so we have to make it more serious.
|
|
% To do so we pull the same trick as above, setting up a definition for active
|
|
% space, but only making space active during the span of the verbatim text.
|
|
% In Plain TeX the active space is defined to be simply a space, but here we
|
|
% define it to be a control space. This ensures that the space cannot
|
|
% be gobbled up by one of TeX's mysterious mechanisms when activated.
|
|
% See The TeXbook, p.381 and p.352.
|
|
{\obeyspaces\global\let =\ }
|
|
% Here is the main \fwbtx verbatim text macro.
|
|
% Note: The order in which all these pieces of business have to be done is
|
|
% still a partial mystery to me. Don't fiddle with this stuff unless you
|
|
% think you know what you are doing.
|
|
\def\fwbtx[{%
|
|
%
|
|
% The funnies involved in getting verbatim output are safely housed inside
|
|
% this \begingroup, and the \endgroup in \fwverbatimgobble. Groups are used
|
|
% instead of curly braces because we have to be able to signal the end of
|
|
% this macro with a curly brace.
|
|
\begingroup%
|
|
%
|
|
% \pars at the end of empty lines in the verbatim text won't come out normally
|
|
% because TeX is in vertical mode and they get gobbled up. To prevent this,
|
|
% we force \par to exit vertical mode first. See The TeXbook p.381.
|
|
\def\par{\leavevmode\endgraf}%
|
|
%
|
|
% Activate the leftquote character so as to avoid ligatures (see above).
|
|
\catcode`\`=\active%
|
|
%
|
|
% The \obeylines macro simply defines end of line (^M) to be \par. This ensures
|
|
% that TeX will treat each verbatim line as a new paragraph.
|
|
\obeylines%
|
|
%
|
|
% To get verbatim output, we have to desex all the special characters. This
|
|
% is explained in detail in The TeXbook p.380.
|
|
\def\do##1{\catcode`##1=12 }\dospecials%
|
|
%
|
|
% Activate the space character so as to make TeX treat blanks seriously.
|
|
% This activation invokes an eralier definition (see above).
|
|
\obeyspaces
|
|
%
|
|
% Interparagraph skips do not help the cause.
|
|
% Note: We have to preserve the indentation though, as the code is actually
|
|
% indented in the final output. See \fwodef in an earlier section.
|
|
%
|
|
% We typeset the verbatim text in tt font (courier on the Macintosh) for a
|
|
% number of reasons:
|
|
% - tt font has the same horizontal spacing for each character.
|
|
% - tt font covers the ASCII character set.
|
|
% - tt font doesn't have many surprises (e.g. ligatures).
|
|
% - tt font looks much what you might see on a computer terminal screen.
|
|
\customsize\tt%
|
|
%
|
|
% Having set up an environment for verbatim, we are ready to use it.
|
|
% By invoking \fwverbatimgobble, this \fwbtx macro gobbles up text verbatim (as
|
|
% part of the parameter of \fwverbatimgobble) until it sees the termination
|
|
% string "]fwetx=" (the "=" was thrown in to add obscurity as this sequence
|
|
% must never occur in the verbatim text).
|
|
\fwverbatimgobble}
|
|
% The \fwverbatimgobble macro exists to allow \fwbtx to bracket verbatim text.
|
|
\def\fwverbatimgobble#1]fwetx={#1\endgroup}
|
|
% Support for Explicit Typesetting
|
|
% --------------------------------
|
|
% FunnelWeb supports pragmas and other constructs that allow
|
|
% typesetter-independent typesetting commands to be given. The
|
|
% following macros support these features.
|
|
% The in-text literal @{sloth@} and emphasise @[walrus@] features.
|
|
\def\fwlit#1{{\tt #1}}
|
|
\def\fwemp#1{{\it #1}}
|
|
%====================== End of FunnelWeb TeX Definitions =======================
|