home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-03-29 | 50.1 KB | 1,545 lines |
- Newsgroups: comp.sources.unix
- From: ejb@ERA.COM (Jay Berkenbilt)
- Subject: v28i008: bcs-2.0 - A Baseline Configuration System, Part07/25
- References: <1.764985670.1461@gw.home.vix.com>
- Sender: unix-sources-moderator@gw.home.vix.com
- Approved: vixie@gw.home.vix.com
-
- Submitted-By: ejb@ERA.COM (Jay Berkenbilt)
- Posting-Number: Volume 28, Issue 8
- Archive-Name: bcs-2.0/part07
-
- #!/bin/sh
- # this is bcs.07 (part 7 of bcs-2.0)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file bcs-2.0/doc/texinfo.tex continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 7; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping bcs-2.0/doc/texinfo.tex'
- else
- echo 'x - continuing file bcs-2.0/doc/texinfo.tex'
- sed 's/^X//' << 'SHAR_EOF' >> 'bcs-2.0/doc/texinfo.tex' &&
- \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
- }
- X
- %
- % Here are the rules for the cropmarks. Note that they are
- % offset so that the space between them is truly \outerhsize or \outervsize
- % (P. A. MacKay, 12 November, 1986)
- %
- \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
- \def\nstop{\vbox
- X {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
- \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
- \def\nsbot{\vbox
- X {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
- X
- % Parse an argument, then pass it to #1. The argument is the rest of
- % the input line (except we remove a trailing comment). #1 should be a
- % macro which expects an ordinary undelimited TeX argument.
- %
- \def\parsearg#1{%
- X \let\next = #1%
- X \begingroup
- X \obeylines
- X \futurelet\temp\parseargx
- }
- X
- % If the next token is an obeyed space (from an @example environment or
- % the like), remove it and recurse. Otherwise, we're done.
- \def\parseargx{%
- X % \obeyedspace is defined far below, after the definition of \sepspaces.
- X \ifx\obeyedspace\temp
- X \expandafter\parseargdiscardspace
- X \else
- X \expandafter\parseargline
- X \fi
- }
- X
- % Remove a single space (as the delimiter token to the macro call).
- {\obeyspaces %
- X \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
- X
- {\obeylines %
- X \gdef\parseargline#1^^M{%
- X \endgroup % End of the group started in \parsearg.
- X %
- X % First remove any @c comment, then any @comment.
- X % Result of each macro is put in \toks0.
- X \argremovec #1\c\relax %
- X \expandafter\argremovecomment \the\toks0 \comment\relax %
- X %
- X % Call the caller's macro, saved as \next in \parsearg.
- X \expandafter\next\expandafter{\the\toks0}%
- X }%
- }
- X
- % Since all \c{,omment} does is throw away the argument, we can let TeX
- % do that for us. The \relax here is matched by the \relax in the call
- % in \parseargline; it could be more or less anything, its purpose is
- % just to delimit the argument to the \c.
- \def\argremovec#1\c#2\relax{\toks0 = {#1}}
- \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
- X
- % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
- % @end itemize @c foo
- % will have two active spaces as part of the argument with the
- % `itemize'. Here we remove all active spaces from #1, and assign the
- % result to \toks0.
- %
- % This loses if there are any *other* active characters besides spaces
- % in the argument -- _ ^ +, for example -- since they get expanded.
- % Fortunately, Texinfo does not define any such commands. (If it ever
- % does, the catcode of the characters in questionwill have to be changed
- % here.) But this means we cannot call \removeactivespaces as part of
- % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
- % that \parsearg gets might well have any character at all in it.
- %
- \def\removeactivespaces#1{%
- X \begingroup
- X \ignoreactivespaces
- X \edef\temp{#1}%
- X \global\toks0 = \expandafter{\temp}%
- X \endgroup
- }
- X
- % Change the active space to expand to nothing.
- %
- \begingroup
- X \obeyspaces
- X \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
- \endgroup
- X
- X
- \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
- X
- %% These are used to keep @begin/@end levels from running away
- %% Call \inENV within environments (after a \begingroup)
- \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
- \def\ENVcheck{%
- \ifENV\errmessage{Still within an environment. Type Return to continue.}
- \endgroup\fi} % This is not perfect, but it should reduce lossage
- X
- % @begin foo is the same as @foo, for now.
- \newhelp\EMsimple{Type <Return> to continue.}
- X
- \outer\def\begin{\parsearg\beginxxx}
- X
- \def\beginxxx #1{%
- \expandafter\ifx\csname #1\endcsname\relax
- {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
- \csname #1\endcsname\fi}
- X
- % @end foo executes the definition of \Efoo.
- %
- \def\end{\parsearg\endxxx}
- \def\endxxx #1{%
- X \removeactivespaces{#1}%
- X \edef\endthing{\the\toks0}%
- X %
- X \expandafter\ifx\csname E\endthing\endcsname\relax
- X \expandafter\ifx\csname \endthing\endcsname\relax
- X % There's no \foo, i.e., no ``environment'' foo.
- X \errhelp = \EMsimple
- X \errmessage{Undefined command `@end \endthing'}%
- X \else
- X \unmatchedenderror\endthing
- X \fi
- X \else
- X % Everything's ok; the right environment has been started.
- X \csname E\endthing\endcsname
- X \fi
- }
- X
- % There is an environment #1, but it hasn't been started. Give an error.
- %
- \def\unmatchedenderror#1{%
- X \errhelp = \EMsimple
- X \errmessage{This `@end #1' doesn't have a matching `@#1'}%
- }
- X
- % Define the control sequence \E#1 to give an unmatched @end error.
- %
- \def\defineunmatchedend#1{%
- X \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
- }
- X
- X
- % Single-spacing is done by various environments (specifically, in
- % \nonfillstart and \quotations).
- \newskip\singlespaceskip \singlespaceskip = \baselineskip
- \def\singlespace{%
- % Why was this kern here? It messes up equalizing space above and below
- % environments. --karl, 6may93
- %{\advance \baselineskip by -\singlespaceskip
- %\kern \baselineskip}%
- \baselineskip=\singlespaceskip
- }
- X
- %% Simple single-character @ commands
- X
- % @@ prints an @
- % Kludge this until the fonts are right (grr).
- \def\@{{\tt \char '100}}
- X
- % This is turned off because it was never documented
- % and you can use @w{...} around a quote to suppress ligatures.
- %% Define @` and @' to be the same as ` and '
- %% but suppressing ligatures.
- %\def\`{{`}}
- %\def\'{{'}}
- X
- % Used to generate quoted braces.
- X
- \def\mylbrace {{\tt \char '173}}
- \def\myrbrace {{\tt \char '175}}
- \let\{=\mylbrace
- \let\}=\myrbrace
- X
- % @: forces normal size whitespace following.
- \def\:{\spacefactor=1000 }
- X
- % @* forces a line break.
- \def\*{\hfil\break\hbox{}\ignorespaces}
- X
- % @. is an end-of-sentence period.
- \def\.{.\spacefactor=3000 }
- X
- % @w prevents a word break. Without the \leavevmode, @w at the
- % beginning of a paragraph, when TeX is still in vertical mode, would
- % produce a whole line of output instead of starting the paragraph.
- \def\w#1{\leavevmode\hbox{#1}}
- X
- % @group ... @end group forces ... to be all on one page, by enclosing
- % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
- % to keep its height that of a normal line. According to the rules for
- % \topskip (p.114 of the TeXbook), the glue inserted is
- % max (\topskip - \ht (first item), 0). If that height is large,
- % therefore, no glue is inserted, and the space between the headline and
- % the text is small, which looks bad.
- %
- \def\group{\begingroup
- X \ifnum\catcode13=\active \else
- X \errhelp = \groupinvalidhelp
- X \errmessage{@group invalid in context where filling is enabled}%
- X \fi
- X %
- X % The \vtop we start below produces a box with normal height and large
- X % depth; thus, TeX puts \baselineskip glue before it, and (when the
- X % next line of text is done) \lineskip glue after it. (See p.82 of
- X % the TeXbook.) Thus, space below is not quite equal to space
- X % above. But it's pretty close.
- X \def\Egroup{%
- X \egroup % End the \vtop.
- X \endgroup % End the \group.
- X }%
- X %
- X \vtop\bgroup
- X % We have to put a strut on the last line in case the @group is in
- X % the midst of an example, rather than completely enclosing it.
- X % Otherwise, the interline space between the last line of the group
- X % and the first line afterwards is too small. But we can't put the
- X % strut in \Egroup, since there it would be on a line by itself.
- X % Hence this just inserts a strut at the beginning of each line.
- X \everypar = {\strut}%
- X %
- X % Since we have a strut on every line, we don't need any of TeX's
- X % normal interline spacing.
- X \offinterlineskip
- X %
- X % OK, but now we have to do something about blank
- X % lines in the input in @example-like environments, which normally
- X % just turn into \lisppar, which will insert no space now that we've
- X % turned off the interline space. Simplest is to make them be an
- X % empty paragraph.
- X \ifx\par\lisppar
- X \edef\par{\leavevmode \par}%
- X %
- X % Reset ^^M's definition to new definition of \par.
- X \obeylines
- X \fi
- X %
- X % We do @comment here in case we are called inside an environment,
- X % such as @example, where each end-of-line in the input causes an
- X % end-of-line in the output. We don't want the end-of-line after
- X % the `@group' to put extra space in the output. Since @group
- X % should appear on a line by itself (according to the Texinfo
- X % manual), we don't worry about eating any user text.
- X \comment
- }
- %
- % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
- % message, so this ends up printing `@group can only ...'.
- %
- \newhelp\groupinvalidhelp{%
- group can only be used in environments such as @example,^^J%
- where each line of input produces a line of output.}
- X
- % @need space-in-mils
- % forces a page break if there is not space-in-mils remaining.
- X
- \newdimen\mil \mil=0.001in
- X
- \def\need{\parsearg\needx}
- X
- % Old definition--didn't work.
- %\def\needx #1{\par %
- %% This method tries to make TeX break the page naturally
- %% if the depth of the box does not fit.
- %{\baselineskip=0pt%
- %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
- %\prevdepth=-1000pt
- %}}
- X
- \def\needx#1{%
- X % Go into vertical mode, so we don't make a big box in the middle of a
- X % paragraph.
- X \par
- X %
- X % Don't add any leading before our big empty box, but allow a page
- X % break, since the best break might be right here.
- X \allowbreak
- X \nointerlineskip
- X \vtop to #1\mil{\vfil}%
- X %
- X % TeX does not even consider page breaks if a penalty added to the
- X % main vertical list is 10000 or more. But in order to see if the
- X % empty box we just added fits on the page, we must make it consider
- X % page breaks. On the other hand, we don't want to actually break the
- X % page after the empty box. So we use a penalty of 9999.
- X %
- X % There is an extremely small chance that TeX will actually break the
- X % page at this \penalty, if there are no other feasible breakpoints in
- X % sight. (If the user is using lots of big @group commands, which
- X % almost-but-not-quite fill up a page, TeX will have a hard time doing
- X % good page breaking, for example.) However, I could not construct an
- X % example where a page broke at this \penalty; if it happens in a real
- X % document, then we can reconsider our strategy.
- X \penalty9999
- X %
- X % Back up by the size of the box, whether we did a page break or not.
- X \kern -#1\mil
- X %
- X % Do not allow a page break right after this kern.
- X \nobreak
- }
- X
- % @br forces paragraph break
- X
- \let\br = \par
- X
- % @dots{} output some dots
- X
- \def\dots{$\ldots$}
- X
- % @page forces the start of a new page
- X
- \def\page{\par\vfill\supereject}
- X
- % @exdent text....
- % outputs text on separate line in roman font, starting at standard page margin
- X
- % This records the amount of indent in the innermost environment.
- % That's how much \exdent should take out.
- \newskip\exdentamount
- X
- % This defn is used inside fill environments such as @defun.
- \def\exdent{\parsearg\exdentyyy}
- \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
- X
- % This defn is used inside nofill environments such as @example.
- \def\nofillexdent{\parsearg\nofillexdentyyy}
- \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
- \leftline{\hskip\leftskip{\rm#1}}}}
- X
- %\hbox{{\rm#1}}\hfil\break}}
- X
- % @include file insert text of that file as input.
- X
- \def\include{\parsearg\includezzz}
- %Use \input\thisfile to avoid blank after \input, which may be an active
- %char (in which case the blank would become the \input argument).
- %The grouping keeps the value of \thisfile correct even when @include
- %is nested.
- \def\includezzz #1{\begingroup
- \def\thisfile{#1}\input\thisfile
- \endgroup}
- X
- \def\thisfile{}
- X
- % @center line outputs that line, centered
- X
- \def\center{\parsearg\centerzzz}
- \def\centerzzz #1{{\advance\hsize by -\leftskip
- \advance\hsize by -\rightskip
- \centerline{#1}}}
- X
- % @sp n outputs n lines of vertical space
- X
- \def\sp{\parsearg\spxxx}
- \def\spxxx #1{\par \vskip #1\baselineskip}
- X
- % @comment ...line which is ignored...
- % @c is the same as @comment
- % @ignore ... @end ignore is another way to write a comment
- X
- \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
- \parsearg \commentxxx}
- X
- \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
- X
- \let\c=\comment
- X
- % Prevent errors for section commands.
- % Used in @ignore and in failing conditionals.
- \def\ignoresections{%
- \let\chapter=\relax
- \let\unnumbered=\relax
- \let\top=\relax
- \let\unnumberedsec=\relax
- \let\unnumberedsection=\relax
- \let\unnumberedsubsec=\relax
- \let\unnumberedsubsection=\relax
- \let\unnumberedsubsubsec=\relax
- \let\unnumberedsubsubsection=\relax
- \let\section=\relax
- \let\subsec=\relax
- \let\subsubsec=\relax
- \let\subsection=\relax
- \let\subsubsection=\relax
- \let\appendix=\relax
- \let\appendixsec=\relax
- \let\appendixsection=\relax
- \let\appendixsubsec=\relax
- \let\appendixsubsection=\relax
- \let\appendixsubsubsec=\relax
- \let\appendixsubsubsection=\relax
- \let\contents=\relax
- \let\smallbook=\relax
- \let\titlepage=\relax
- }
- X
- % Used in nested conditionals, where we have to parse the Texinfo source
- % and so want to turn off most commands, in case they are used
- % incorrectly.
- %
- \def\ignoremorecommands{%
- X \let\defcv = \relax
- X \let\deffn = \relax
- X \let\deffnx = \relax
- X \let\defindex = \relax
- X \let\defivar = \relax
- X \let\defmac = \relax
- X \let\defmethod = \relax
- X \let\defop = \relax
- X \let\defopt = \relax
- X \let\defspec = \relax
- X \let\deftp = \relax
- X \let\deftypefn = \relax
- X \let\deftypefun = \relax
- X \let\deftypevar = \relax
- X \let\deftypevr = \relax
- X \let\defun = \relax
- X \let\defvar = \relax
- X \let\defvr = \relax
- X \let\ref = \relax
- X \let\xref = \relax
- X \let\printindex = \relax
- X \let\pxref = \relax
- X \let\settitle = \relax
- X \let\include = \relax
- X \let\lowersections = \relax
- X \let\down = \relax
- X \let\raisesections = \relax
- X \let\up = \relax
- X \let\set = \relax
- X \let\clear = \relax
- }
- X
- % Ignore @ignore ... @end ignore.
- %
- \def\ignore{\doignore{ignore}}
- X
- % Also ignore @ifinfo, @menu, and @direntry text.
- %
- \def\ifinfo{\doignore{ifinfo}}
- \def\menu{\doignore{menu}}
- \def\direntry{\doignore{direntry}}
- X
- % Ignore text until a line `@end #1'.
- %
- \def\doignore#1{\begingroup
- X % Don't complain about control sequences we have declared \outer.
- X \ignoresections
- X %
- X % Define a command to swallow text until we reach `@end #1'.
- X \long\def\doignoretext##1\end #1{\enddoignore}%
- X %
- X % Make sure that spaces turn into tokens that match what \doignoretext wants.
- X \catcode32 = 10
- X %
- X % And now expand that command.
- X \doignoretext
- }
- X
- % What we do to finish off ignored text.
- %
- \def\enddoignore{\endgroup\ignorespaces}%
- X
- \newif\ifwarnedobs\warnedobsfalse
- \def\obstexwarn{%
- X \ifwarnedobs\relax\else
- X % We need to warn folks that they may have trouble with TeX 3.0.
- X % This uses \immediate\write16 rather than \message to get newlines.
- X \immediate\write16{}
- X \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
- X \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
- X \immediate\write16{If you are running another version of TeX, relax.}
- X \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
- X \immediate\write16{ Then upgrade your TeX installation if you can.}
- X \immediate\write16{If you are stuck with version 3.0, run the}
- X \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
- X \immediate\write16{ to use a workaround.}
- X \immediate\write16{}
- X \warnedobstrue
- X \fi
- }
- X
- % **In TeX 3.0, setting text in \nullfont hangs tex. For a
- % workaround (which requires the file ``dummy.tfm'' to be installed),
- % uncomment the following line:
- %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
- X
- % Ignore text, except that we keep track of conditional commands for
- % purposes of nesting, up to an `@end #1' command.
- %
- \def\nestedignore#1{%
- X \obstexwarn
- X % We must actually expand the ignored text to look for the @end
- X % command, so that nested ignore constructs work. Thus, we put the
- X % text into a \vbox and then do nothing with the result. To minimize
- X % the change of memory overflow, we follow the approach outlined on
- X % page 401 of the TeXbook: make the current font be a dummy font.
- X %
- X \setbox0 = \vbox\bgroup
- X % Don't complain about control sequences we have declared \outer.
- X \ignoresections
- X %
- X % Define `@end #1' to end the box, which will in turn undefine the
- X % @end command again.
- X \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
- X %
- X % We are going to be parsing Texinfo commands. Most cause no
- X % trouble when they are used incorrectly, but some commands do
- X % complicated argument parsing or otherwise get confused, so we
- X % undefine them.
- X %
- X % We can't do anything about stray @-signs, unfortunately;
- X % they'll produce `undefined control sequence' errors.
- X \ignoremorecommands
- X %
- X % Set the current font to be \nullfont, a TeX primitive, and define
- X % all the font commands to also use \nullfont. We don't use
- X % dummy.tfm, as suggested in the TeXbook, because not all sites
- X % might have that installed. Therefore, math mode will still
- X % produce output, but that should be an extremely small amount of
- X % stuff compared to the main input.
- X %
- X \nullfont
- X \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
- X \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
- X \let\tensf = \nullfont
- X %
- X % Don't complain when characters are missing from the fonts.
- X \tracinglostchars = 0
- X %
- X % Don't bother to do space factor calculations.
- X \frenchspacing
- X %
- X % Don't report underfull hboxes.
- X \hbadness = 10000
- X %
- X % Do minimal line-breaking.
- X \pretolerance = 10000
- X %
- X % Do not execute instructions in @tex
- X \def\tex{\doignore{tex}}
- }
- X
- % @set VAR sets the variable VAR to an empty value.
- % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
- %
- % Since we want to separate VAR from REST-OF-LINE (which might be
- % empty), we can't just use \parsearg; we have to insert a space of our
- % own to delimit the rest of the line, and then take it out again if we
- % didn't need it.
- %
- \def\set{\parsearg\setxxx}
- \def\setxxx#1{\setyyy#1 \endsetyyy}
- \def\setyyy#1 #2\endsetyyy{%
- X \def\temp{#2}%
- X \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
- X \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
- X \fi
- }
- \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
- X
- % @clear VAR clears (i.e., unsets) the variable VAR.
- %
- \def\clear{\parsearg\clearxxx}
- \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
- X
- % @value{foo} gets the text saved in variable foo.
- %
- \def\value#1{\expandafter
- X \ifx\csname SET#1\endcsname\relax
- X {\{No value for ``#1''\}}
- X \else \csname SET#1\endcsname \fi}
- X
- % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
- % with @set.
- %
- \def\ifset{\parsearg\ifsetxxx}
- \def\ifsetxxx #1{%
- X \expandafter\ifx\csname SET#1\endcsname\relax
- X \expandafter\ifsetfail
- X \else
- X \expandafter\ifsetsucceed
- X \fi
- }
- \def\ifsetsucceed{\conditionalsucceed{ifset}}
- \def\ifsetfail{\nestedignore{ifset}}
- \defineunmatchedend{ifset}
- X
- % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
- % defined with @set, or has been undefined with @clear.
- %
- \def\ifclear{\parsearg\ifclearxxx}
- \def\ifclearxxx #1{%
- X \expandafter\ifx\csname SET#1\endcsname\relax
- X \expandafter\ifclearsucceed
- X \else
- X \expandafter\ifclearfail
- X \fi
- }
- \def\ifclearsucceed{\conditionalsucceed{ifclear}}
- \def\ifclearfail{\nestedignore{ifclear}}
- \defineunmatchedend{ifclear}
- X
- % @iftex always succeeds; we read the text following, through @end
- % iftex). But `@end iftex' should be valid only after an @iftex.
- %
- \def\iftex{\conditionalsucceed{iftex}}
- \defineunmatchedend{iftex}
- X
- % We can't just want to start a group at @iftex (for example) and end it
- % at @end iftex, since then @set commands inside the conditional have no
- % effect (they'd get reverted at the end of the group). So we must
- % define \Eiftex to redefine itself to be its previous value. (We can't
- % just define it to fail again with an ``unmatched end'' error, since
- % the @ifset might be nested.)
- %
- \def\conditionalsucceed#1{%
- X \edef\temp{%
- X % Remember the current value of \E#1.
- X \let\nece{prevE#1} = \nece{E#1}%
- X %
- X % At the `@end #1', redefine \E#1 to be its previous value.
- X \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
- X }%
- X \temp
- }
- X
- % We need to expand lots of \csname's, but we don't want to expand the
- % control sequences after we've constructed them.
- %
- \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
- X
- % @asis just yields its argument. Used with @table, for example.
- %
- \def\asis#1{#1}
- X
- % @math means output in math mode.
- % We don't use $'s directly in the definition of \math because control
- % sequences like \math are expanded when the toc file is written. Then,
- % we read the toc file back, the $'s will be normal characters (as they
- % should be, according to the definition of Texinfo). So we must use a
- % control sequence to switch into and out of math mode.
- %
- % This isn't quite enough for @math to work properly in indices, but it
- % seems unlikely it will ever be needed there.
- %
- \let\implicitmath = $
- \def\math#1{\implicitmath #1\implicitmath}
- X
- % @bullet and @minus need the same treatment as @math, just above.
- \def\bullet{\implicitmath\ptexbullet\implicitmath}
- \def\minus{\implicitmath-\implicitmath}
- X
- \def\node{\ENVcheck\parsearg\nodezzz}
- \def\nodezzz#1{\nodexxx [#1,]}
- \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
- \let\nwnode=\node
- \let\lastnode=\relax
- X
- \def\donoderef{\ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\setref{\lastnode}\fi
- \let\lastnode=\relax}
- X
- \def\unnumbnoderef{\ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
- \let\lastnode=\relax}
- X
- \def\appendixnoderef{\ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
- \let\lastnode=\relax}
- X
- \let\refill=\relax
- X
- % @setfilename is done at the beginning of every texinfo file.
- % So open here the files we need to have open while reading the input.
- % This makes it possible to make a .fmt file for texinfo.
- \def\setfilename{%
- X \readauxfile
- X \opencontents
- X \openindices
- X \fixbackslash % Turn off hack to swallow `\input texinfo'.
- X \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
- X \comment % Ignore the actual filename.
- }
- X
- \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
- X
- \def\inforef #1{\inforefzzz #1,,,,**}
- \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
- X node \samp{\ignorespaces#1{}}}
- X
- \message{fonts,}
- X
- % Font-change commands.
- X
- % Texinfo supports the sans serif font style, which plain TeX does not.
- % So we set up a \sf analogous to plain's \rm, etc.
- \newfam\sffam
- \def\sf{\fam=\sffam \tensf}
- \let\li = \sf % Sometimes we call it \li, not \sf.
- X
- %% Try out Computer Modern fonts at \magstephalf
- \let\mainmagstep=\magstephalf
- X
- \ifx\bigger\relax
- \let\mainmagstep=\magstep1
- \font\textrm=cmr12
- \font\texttt=cmtt12
- \else
- \font\textrm=cmr10 scaled \mainmagstep
- \font\texttt=cmtt10 scaled \mainmagstep
- \fi
- % Instead of cmb10, you many want to use cmbx10.
- % cmbx10 is a prettier font on its own, but cmb10
- % looks better when embedded in a line with cmr10.
- \font\textbf=cmb10 scaled \mainmagstep
- \font\textit=cmti10 scaled \mainmagstep
- \font\textsl=cmsl10 scaled \mainmagstep
- \font\textsf=cmss10 scaled \mainmagstep
- \font\textsc=cmcsc10 scaled \mainmagstep
- \font\texti=cmmi10 scaled \mainmagstep
- \font\textsy=cmsy10 scaled \mainmagstep
- X
- % A few fonts for @defun, etc.
- \font\defbf=cmbx10 scaled \magstep1 %was 1314
- \font\deftt=cmtt10 scaled \magstep1
- \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
- X
- % Fonts for indices and small examples.
- % We actually use the slanted font rather than the italic,
- % because texinfo normally uses the slanted fonts for that.
- % Do not make many font distinctions in general in the index, since they
- % aren't very useful.
- \font\ninett=cmtt9
- \font\indrm=cmr9
- \font\indit=cmsl9
- \let\indsl=\indit
- \let\indtt=\ninett
- \let\indsf=\indrm
- \let\indbf=\indrm
- \let\indsc=\indrm
- \font\indi=cmmi9
- \font\indsy=cmsy9
- X
- % Fonts for headings
- \font\chaprm=cmbx12 scaled \magstep2
- \font\chapit=cmti12 scaled \magstep2
- \font\chapsl=cmsl12 scaled \magstep2
- \font\chaptt=cmtt12 scaled \magstep2
- \font\chapsf=cmss12 scaled \magstep2
- \let\chapbf=\chaprm
- \font\chapsc=cmcsc10 scaled\magstep3
- \font\chapi=cmmi12 scaled \magstep2
- \font\chapsy=cmsy10 scaled \magstep3
- X
- \font\secrm=cmbx12 scaled \magstep1
- \font\secit=cmti12 scaled \magstep1
- \font\secsl=cmsl12 scaled \magstep1
- \font\sectt=cmtt12 scaled \magstep1
- \font\secsf=cmss12 scaled \magstep1
- \font\secbf=cmbx12 scaled \magstep1
- \font\secsc=cmcsc10 scaled\magstep2
- \font\seci=cmmi12 scaled \magstep1
- \font\secsy=cmsy10 scaled \magstep2
- X
- % \font\ssecrm=cmbx10 scaled \magstep1 % This size an font looked bad.
- % \font\ssecit=cmti10 scaled \magstep1 % The letters were too crowded.
- % \font\ssecsl=cmsl10 scaled \magstep1
- % \font\ssectt=cmtt10 scaled \magstep1
- % \font\ssecsf=cmss10 scaled \magstep1
- X
- %\font\ssecrm=cmb10 scaled 1315 % Note the use of cmb rather than cmbx.
- %\font\ssecit=cmti10 scaled 1315 % Also, the size is a little larger than
- %\font\ssecsl=cmsl10 scaled 1315 % being scaled magstep1.
- %\font\ssectt=cmtt10 scaled 1315
- %\font\ssecsf=cmss10 scaled 1315
- X
- %\let\ssecbf=\ssecrm
- X
- \font\ssecrm=cmbx12 scaled \magstephalf
- \font\ssecit=cmti12 scaled \magstephalf
- \font\ssecsl=cmsl12 scaled \magstephalf
- \font\ssectt=cmtt12 scaled \magstephalf
- \font\ssecsf=cmss12 scaled \magstephalf
- \font\ssecbf=cmbx12 scaled \magstephalf
- \font\ssecsc=cmcsc10 scaled \magstep1
- \font\sseci=cmmi12 scaled \magstephalf
- \font\ssecsy=cmsy10 scaled \magstep1
- % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
- % but that is not a standard magnification.
- X
- % Fonts for title page:
- \font\titlerm = cmbx12 scaled \magstep3
- \let\authorrm = \secrm
- X
- % In order for the font changes to affect most math symbols and letters,
- % we have to define the \textfont of the standard families. Since
- % texinfo doesn't allow for producing subscripts and superscripts, we
- % don't bother to reset \scriptfont and \scriptscriptfont (which would
- % also require loading a lot more fonts).
- %
- \def\resetmathfonts{%
- X \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
- X \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
- X \textfont\ttfam = \tentt \textfont\sffam = \tensf
- }
- X
- X
- % The font-changing commands redefine the meanings of \tenSTYLE, instead
- % of just \STYLE. We do this so that font changes will continue to work
- % in math mode, where it is the current \fam that is relevant in most
- % cases, not the current. Plain TeX does, for example,
- % \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
- % to redefine \bf itself.
- \def\textfonts{%
- X \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
- X \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
- X \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
- X \resetmathfonts}
- \def\chapfonts{%
- X \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
- X \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
- X \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
- X \resetmathfonts}
- \def\secfonts{%
- X \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
- X \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
- X \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
- X \resetmathfonts}
- \def\subsecfonts{%
- X \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
- X \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
- X \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
- X \resetmathfonts}
- \def\indexfonts{%
- X \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
- X \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
- X \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
- X \resetmathfonts}
- X
- % Set up the default fonts, so we can use them for creating boxes.
- %
- \textfonts
- X
- % Count depth in font-changes, for error checks
- \newcount\fontdepth \fontdepth=0
- X
- % Fonts for short table of contents.
- \font\shortcontrm=cmr12
- \font\shortcontbf=cmbx12
- \font\shortcontsl=cmsl12
- X
- %% Add scribe-like font environments, plus @l for inline lisp (usually sans
- %% serif) and @ii for TeX italic
- X
- % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
- % unless the following character is such as not to need one.
- \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
- \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
- X
- \let\i=\smartitalic
- \let\var=\smartitalic
- \let\dfn=\smartitalic
- \let\emph=\smartitalic
- \let\cite=\smartitalic
- X
- \def\b#1{{\bf #1}}
- \let\strong=\b
- X
- % We can't just use \exhyphenpenalty, because that only has effect at
- % the end of a paragraph. Restore normal hyphenation at the end of the
- % group within which \nohyphenation is presumably called.
- %
- \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
- \def\restorehyphenation{\hyphenchar\font = `- }
- X
- \def\t#1{%
- X {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
- X \null
- }
- \let\ttfont = \t
- %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
- \def\samp #1{`\tclose{#1}'\null}
- \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
- \def\ctrl #1{{\tt \rawbackslash \hat}#1}
- X
- \let\file=\samp
- X
- % @code is a modification of @t,
- % which makes spaces the same size as normal in the surrounding text.
- \def\tclose#1{%
- X {%
- X % Change normal interword space to be same as for the current font.
- X \spaceskip = \fontdimen2\font
- X %
- X % Switch to typewriter.
- X \tt
- X %
- X % But `\ ' produces the large typewriter interword space.
- X \def\ {{\spaceskip = 0pt{} }}%
- X %
- X % Turn off hyphenation.
- X \nohyphenation
- X %
- X \rawbackslash
- X \frenchspacing
- X #1%
- X }%
- X \null
- }
- X
- % We *must* turn on hyphenation at `-' and `_' in \code.
- % Otherwise, it is too hard to avoid overful hboxes
- % in the Emacs manual, the Library manual, etc.
- X
- % Unfortunately, TeX uses one parameter (\hyphenchar) to control
- % both hyphenation at - and hyphenation within words.
- % We must therefore turn them both off (\tclose does that)
- % and arrange explicitly to hyphenate an a dash.
- % -- rms.
- {
- \catcode `\-=\active
- \catcode `\_=\active
- \global\def\code{\begingroup \catcode `\-=\active \let-\codedash \let_\codeunder \codex}
- }
- \def\codedash{-\discretionary{}{}{}}
- \def\codeunder{\normalunderscore\discretionary{}{}{}}
- \def\codex #1{\tclose{#1}\endgroup}
- X
- %\let\exp=\tclose %Was temporary
- X
- % @kbd is like @code, except that if the argument is just one @key command,
- % then @kbd has no effect.
- X
- \def\xkey{\key}
- \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
- \ifx\one\xkey\ifx\threex\three \key{#2}%
- \else\tclose{\look}\fi
- \else\tclose{\look}\fi}
- X
- % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
- % argument is to make the input look right: @dmn{pt} instead of
- % @dmn{}pt.
- %
- \def\dmn#1{\thinspace #1}
- X
- \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
- X
- \def\l#1{{\li #1}\null} %
- X
- \def\r#1{{\rm #1}} % roman font
- % Use of \lowercase was suggested.
- \def\sc#1{{\smallcaps#1}} % smallcaps font
- \def\ii#1{{\it #1}} % italic font
- X
- \message{page headings,}
- X
- \newskip\titlepagetopglue \titlepagetopglue = 1.5in
- \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
- X
- % First the title page. Must do @settitle before @titlepage.
- \def\titlefont#1{{\titlerm #1}}
- X
- \newif\ifseenauthor
- \newif\iffinishedtitlepage
- X
- \def\shorttitlepage{\parsearg\shorttitlepagezzz}
- \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
- X \endgroup\page\hbox{}\page}
- X
- \def\titlepage{\begingroup \parindent=0pt \textfonts
- X \let\subtitlerm=\tenrm
- % I deinstalled the following change because \cmr12 is undefined.
- % This change was not in the ChangeLog anyway. --rms.
- % \let\subtitlerm=\cmr12
- X \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
- X %
- X \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
- X %
- X % Leave some space at the very top of the page.
- X \vglue\titlepagetopglue
- X %
- X % Now you can print the title using @title.
- X \def\title{\parsearg\titlezzz}%
- X \def\titlezzz##1{\leftline{\titlefont{##1}}
- X % print a rule at the page bottom also.
- X \finishedtitlepagefalse
- X \vskip4pt \hrule height 4pt \vskip4pt}%
- X % No rule at page bottom unless we print one at the top with @title.
- X \finishedtitlepagetrue
- X %
- X % Now you can put text using @subtitle.
- X \def\subtitle{\parsearg\subtitlezzz}%
- X \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
- X %
- X % @author should come last, but may come many times.
- X \def\author{\parsearg\authorzzz}%
- X \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
- X {\authorfont \leftline{##1}}}%
- X %
- X % Most title ``pages'' are actually two pages long, with space
- X % at the top of the second. We don't want the ragged left on the second.
- X \let\oldpage = \page
- X \def\page{%
- X \iffinishedtitlepage\else
- X \finishtitlepage
- X \fi
- X \oldpage
- X \let\page = \oldpage
- X \hbox{}}%
- % \def\page{\oldpage \hbox{}}
- }
- X
- \def\Etitlepage{%
- X \iffinishedtitlepage\else
- X \finishtitlepage
- X \fi
- X % It is important to do the page break before ending the group,
- X % because the headline and footline are only empty inside the group.
- X % If we use the new definition of \page, we always get a blank page
- X % after the title page, which we certainly don't want.
- X \oldpage
- X \endgroup
- X \HEADINGSon
- }
- X
- \def\finishtitlepage{%
- X \vskip4pt \hrule height 2pt
- X \vskip\titlepagebottomglue
- X \finishedtitlepagetrue
- }
- X
- %%% Set up page headings and footings.
- X
- \let\thispage=\folio
- X
- \newtoks \evenheadline % Token sequence for heading line of even pages
- \newtoks \oddheadline % Token sequence for heading line of odd pages
- \newtoks \evenfootline % Token sequence for footing line of even pages
- \newtoks \oddfootline % Token sequence for footing line of odd pages
- X
- % Now make Tex use those variables
- \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
- X \else \the\evenheadline \fi}}
- \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
- X \else \the\evenfootline \fi}\HEADINGShook}
- \let\HEADINGShook=\relax
- X
- % Commands to set those variables.
- % For example, this is what @headings on does
- % @evenheading @thistitle|@thispage|@thischapter
- % @oddheading @thischapter|@thispage|@thistitle
- % @evenfooting @thisfile||
- % @oddfooting ||@thisfile
- X
- \def\evenheading{\parsearg\evenheadingxxx}
- \def\oddheading{\parsearg\oddheadingxxx}
- \def\everyheading{\parsearg\everyheadingxxx}
- X
- \def\evenfooting{\parsearg\evenfootingxxx}
- \def\oddfooting{\parsearg\oddfootingxxx}
- \def\everyfooting{\parsearg\everyfootingxxx}
- X
- {\catcode`\@=0 %
- X
- \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
- \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
- \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- X
- \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
- \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
- \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- X
- \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
- \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
- \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
- \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- X
- \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
- \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
- \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- X
- \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
- \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
- \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- X
- \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
- \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
- \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
- \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
- %
- }% unbind the catcode of @.
- X
- % @headings double turns headings on for double-sided printing.
- % @headings single turns headings on for single-sided printing.
- % @headings off turns them off.
- % @headings on same as @headings double, retained for compatibility.
- % @headings after turns on double-sided headings after this page.
- % @headings doubleafter turns on double-sided headings after this page.
- % @headings singleafter turns on single-sided headings after this page.
- % By default, they are off.
- X
- \def\headings #1 {\csname HEADINGS#1\endcsname}
- X
- \def\HEADINGSoff{
- \global\evenheadline={\hfil} \global\evenfootline={\hfil}
- \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
- \HEADINGSoff
- % When we turn headings on, set the page number to 1.
- % For double-sided printing, put current file name in lower left corner,
- % chapter name on inside top of right hand pages, document
- % title on inside top of left hand pages, and page numbers on outside top
- % edge of all pages.
- \def\HEADINGSdouble{
- %\pagealignmacro
- \global\pageno=1
- \global\evenfootline={\hfil}
- \global\oddfootline={\hfil}
- \global\evenheadline={\line{\folio\hfil\thistitle}}
- \global\oddheadline={\line{\thischapter\hfil\folio}}
- }
- % For single-sided printing, chapter title goes across top left of page,
- % page number on top right.
- \def\HEADINGSsingle{
- %\pagealignmacro
- \global\pageno=1
- \global\evenfootline={\hfil}
- \global\oddfootline={\hfil}
- \global\evenheadline={\line{\thischapter\hfil\folio}}
- \global\oddheadline={\line{\thischapter\hfil\folio}}
- }
- \def\HEADINGSon{\HEADINGSdouble}
- X
- \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
- \let\HEADINGSdoubleafter=\HEADINGSafter
- \def\HEADINGSdoublex{%
- \global\evenfootline={\hfil}
- \global\oddfootline={\hfil}
- \global\evenheadline={\line{\folio\hfil\thistitle}}
- \global\oddheadline={\line{\thischapter\hfil\folio}}
- }
- X
- \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
- \def\HEADINGSsinglex{%
- \global\evenfootline={\hfil}
- \global\oddfootline={\hfil}
- \global\evenheadline={\line{\thischapter\hfil\folio}}
- \global\oddheadline={\line{\thischapter\hfil\folio}}
- }
- X
- % Subroutines used in generating headings
- % Produces Day Month Year style of output.
- \def\today{\number\day\space
- \ifcase\month\or
- January\or February\or March\or April\or May\or June\or
- July\or August\or September\or October\or November\or December\fi
- \space\number\year}
- X
- % Use this if you want the Month Day, Year style of output.
- %\def\today{\ifcase\month\or
- %January\or February\or March\or April\or May\or June\or
- %July\or August\or September\or October\or November\or December\fi
- %\space\number\day, \number\year}
- X
- % @settitle line... specifies the title of the document, for headings
- % It generates no output of its own
- X
- \def\thistitle{No Title}
- \def\settitle{\parsearg\settitlezzz}
- \def\settitlezzz #1{\gdef\thistitle{#1}}
- X
- \message{tables,}
- X
- % @tabs -- simple alignment
- X
- % These don't work. For one thing, \+ is defined as outer.
- % So these macros cannot even be defined.
- X
- %\def\tabs{\parsearg\tabszzz}
- %\def\tabszzz #1{\settabs\+#1\cr}
- %\def\tabline{\parsearg\tablinezzz}
- %\def\tablinezzz #1{\+#1\cr}
- %\def\&{&}
- X
- % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
- X
- % default indentation of table text
- \newdimen\tableindent \tableindent=.8in
- % default indentation of @itemize and @enumerate text
- \newdimen\itemindent \itemindent=.3in
- % margin between end of table item and start of table text.
- \newdimen\itemmargin \itemmargin=.1in
- X
- % used internally for \itemindent minus \itemmargin
- \newdimen\itemmax
- X
- % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
- % these defs.
- % They also define \itemindex
- % to index the item name in whatever manner is desired (perhaps none).
- X
- \def\internalBitem{\smallbreak \parsearg\itemzzz}
- \def\internalBitemx{\par \parsearg\itemzzz}
- X
- \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
- \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
- X
- \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
- \def\internalBkitemx{\par \parsearg\kitemzzz}
- X
- \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
- X \itemzzz {#1}}
- X
- \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
- X \itemzzz {#1}}
- X
- \def\itemzzz #1{\begingroup %
- X \advance\hsize by -\rightskip
- X \advance\hsize by -\tableindent
- X \setbox0=\hbox{\itemfont{#1}}%
- X \itemindex{#1}%
- X \nobreak % This prevents a break before @itemx.
- X %
- X % Be sure we are not still in the middle of a paragraph.
- X {\parskip = 0in
- X \par
- X }%
- X %
- X % If the item text does not fit in the space we have, put it on a line
- X % by itself, and do not allow a page break either before or after that
- X % line. We do not start a paragraph here because then if the next
- X % command is, e.g., @kindex, the whatsit would get put into the
- X % horizontal list on a line by itself, resulting in extra blank space.
- X \ifdim \wd0>\itemmax
- X \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
- X %
- X % We're going to be starting a paragraph, but we don't want the
- X % \parskip glue -- logically it's part of the @item we just started.
- X \nobreak \vskip-\parskip
- X %
- X % Stop a page break at the \parskip glue coming up. Unfortunately
- X % we can't prevent a possible page break at the following
- X % \baselineskip glue.
- X \nobreak
- X \else
- X % The item text fits into the space. Start a paragraph, so that the
- X % following text (if any) will end up on the same line. Since that
- X % text will be indented by \tableindent, we make the item text be in
- X % a zero-width box.
- X \noindent
- X \rlap{\hskip -\tableindent\box0}%
- X \fi
- X \endgroup
- }
- X
- \def\item{\errmessage{@item while not in a table}}
- \def\itemx{\errmessage{@itemx while not in a table}}
- \def\kitem{\errmessage{@kitem while not in a table}}
- \def\kitemx{\errmessage{@kitemx while not in a table}}
- \def\xitem{\errmessage{@xitem while not in a table}}
- \def\xitemx{\errmessage{@xitemx while not in a table}}
- X
- %% Contains a kludge to get @end[description] to work
- \def\description{\tablez{\dontindex}{1}{}{}{}{}}
- X
- \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
- {\obeylines\obeyspaces%
- \gdef\tablex #1^^M{%
- \tabley\dontindex#1 \endtabley}}
- X
- \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
- {\obeylines\obeyspaces%
- \gdef\ftablex #1^^M{%
- \tabley\fnitemindex#1 \endtabley
- \def\Eftable{\endgraf\afterenvbreak\endgroup}%
- \let\Etable=\relax}}
- X
- \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
- {\obeylines\obeyspaces%
- \gdef\vtablex #1^^M{%
- \tabley\vritemindex#1 \endtabley
- \def\Evtable{\endgraf\afterenvbreak\endgroup}%
- \let\Etable=\relax}}
- X
- \def\dontindex #1{}
- \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
- \def\vritemindex #1{\doind {vr}{\code{#1}}}%
- X
- {\obeyspaces %
- \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
- \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
- X
- \def\tablez #1#2#3#4#5#6{%
- \aboveenvbreak %
- \begingroup %
- \def\Edescription{\Etable}% Neccessary kludge.
- \let\itemindex=#1%
- \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
- \ifnum 0#4>0 \tableindent=#4\mil \fi %
- \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
- \def\itemfont{#2}%
- \itemmax=\tableindent %
- \advance \itemmax by -\itemmargin %
- \advance \leftskip by \tableindent %
- \exdentamount=\tableindent
- \parindent = 0pt
- \parskip = \smallskipamount
- \ifdim \parskip=0pt \parskip=2pt \fi%
- \def\Etable{\endgraf\afterenvbreak\endgroup}%
- \let\item = \internalBitem %
- \let\itemx = \internalBitemx %
- \let\kitem = \internalBkitem %
- \let\kitemx = \internalBkitemx %
- \let\xitem = \internalBxitem %
- \let\xitemx = \internalBxitemx %
- }
- X
- % This is the counter used by @enumerate, which is really @itemize
- X
- \newcount \itemno
- X
- \def\itemize{\parsearg\itemizezzz}
- X
- \def\itemizezzz #1{%
- X \begingroup % ended by the @end itemsize
- X \itemizey {#1}{\Eitemize}
- }
- X
- \def\itemizey #1#2{%
- \aboveenvbreak %
- \itemmax=\itemindent %
- \advance \itemmax by -\itemmargin %
- \advance \leftskip by \itemindent %
- \exdentamount=\itemindent
- \parindent = 0pt %
- \parskip = \smallskipamount %
- \ifdim \parskip=0pt \parskip=2pt \fi%
- \def#2{\endgraf\afterenvbreak\endgroup}%
- \def\itemcontents{#1}%
- \let\item=\itemizeitem}
- X
- % Set sfcode to normal for the chars that usually have another value.
- % These are `.?!:;,'
- \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
- X \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
- X
- % \splitoff TOKENS\endmark defines \first to be the first token in
- % TOKENS, and \rest to be the remainder.
- %
- \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
- X
- % Allow an optional argument of an uppercase letter, lowercase letter,
- % or number, to specify the first label in the enumerated list. No
- % argument is the same as `1'.
- %
- \def\enumerate{\parsearg\enumeratezzz}
- \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
- \def\enumeratey #1 #2\endenumeratey{%
- X \begingroup % ended by the @end enumerate
- X %
- X % If we were given no argument, pretend we were given `1'.
- X \def\thearg{#1}%
- X \ifx\thearg\empty \def\thearg{1}\fi
- X %
- X % Detect if the argument is a single token. If so, it might be a
- X % letter. Otherwise, the only valid thing it can be is a number.
- X % (We will always have one token, because of the test we just made.
- X % This is a good thing, since \splitoff doesn't work given nothing at
- X % all -- the first parameter is undelimited.)
- X \expandafter\splitoff\thearg\endmark
- X \ifx\rest\empty
- X % Only one token in the argument. It could still be anything.
- X % A ``lowercase letter'' is one whose \lccode is nonzero.
- X % An ``uppercase letter'' is one whose \lccode is both nonzero, and
- X % not equal to itself.
- X % Otherwise, we assume it's a number.
- X %
- X % We need the \relax at the end of the \ifnum lines to stop TeX from
- X % continuing to look for a <number>.
- X %
- X \ifnum\lccode\expandafter`\thearg=0\relax
- X \numericenumerate % a number (we hope)
- X \else
- X % It's a letter.
- X \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
- X \lowercaseenumerate % lowercase letter
- X \else
- X \uppercaseenumerate % uppercase letter
- X \fi
- X \fi
- X \else
- X % Multiple tokens in the argument. We hope it's a number.
- X \numericenumerate
- X \fi
- }
- X
- % An @enumerate whose labels are integers. The starting integer is
- % given in \thearg.
- %
- \def\numericenumerate{%
- X \itemno = \thearg
- X \startenumeration{\the\itemno}%
- }
- X
- % The starting (lowercase) letter is in \thearg.
- \def\lowercaseenumerate{%
- X \itemno = \expandafter`\thearg
- X \startenumeration{%
- X % Be sure we're not beyond the end of the alphabet.
- X \ifnum\itemno=0
- X \errmessage{No more lowercase letters in @enumerate; get a bigger
- X alphabet}%
- X \fi
- X \char\lccode\itemno
- X }%
- }
- X
- % The starting (uppercase) letter is in \thearg.
- \def\uppercaseenumerate{%
- X \itemno = \expandafter`\thearg
- X \startenumeration{%
- X % Be sure we're not beyond the end of the alphabet.
- X \ifnum\itemno=0
- X \errmessage{No more uppercase letters in @enumerate; get a bigger
- X alphabet}
- X \fi
- X \char\uccode\itemno
- X }%
- }
- X
- % Call itemizey, adding a period to the first argument and supplying the
- % common last two arguments. Also subtract one from the initial value in
- % \itemno, since @item increments \itemno.
- %
- \def\startenumeration#1{%
- X \advance\itemno by -1
- X \itemizey{#1.}\Eenumerate\flushcr
- }
- X
- % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
- % to @enumerate.
- %
- \def\alphaenumerate{\enumerate{a}}
- \def\capsenumerate{\enumerate{A}}
- \def\Ealphaenumerate{\Eenumerate}
- \def\Ecapsenumerate{\Eenumerate}
- X
- % Definition of @item while inside @itemize.
- X
- \def\itemizeitem{%
- \advance\itemno by 1
- {\let\par=\endgraf \smallbreak}%
- \ifhmode \errmessage{\in hmode at itemizeitem}\fi
- {\parskip=0in \hskip 0pt
- \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
- \vadjust{\penalty 1200}}%
- \flushcr}
- X
- \message{indexing,}
- % Index generation facilities
- X
- % Define \newwrite to be identical to plain tex's \newwrite
- % except not \outer, so it can be used within \newindex.
- {\catcode`\@=11
- \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
- X
- % \newindex {foo} defines an index named foo.
- % It automatically defines \fooindex such that
- % \fooindex ...rest of line... puts an entry in the index foo.
- % It also defines \fooindfile to be the number of the output channel for
- % the file that accumulates this index. The file's extension is foo.
- % The name of an index should be no more than 2 characters long
- % for the sake of vms.
- X
- \def\newindex #1{
- \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
- \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
- \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
- \noexpand\doindex {#1}}
- }
- X
- % @defindex foo == \newindex{foo}
- X
- \def\defindex{\parsearg\newindex}
- X
- % Define @defcodeindex, like @defindex except put all entries in @code.
- X
- \def\newcodeindex #1{
- \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
- \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
- \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
- \noexpand\docodeindex {#1}}
- }
- X
- \def\defcodeindex{\parsearg\newcodeindex}
- X
- % @synindex foo bar makes index foo feed into index bar.
- % Do this instead of @defindex foo if you don't want it as a separate index.
- \def\synindex #1 #2 {%
- \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
- SHAR_EOF
- true || echo 'restore of bcs-2.0/doc/texinfo.tex failed'
- fi
- echo 'End of bcs-2.0 part 7'
- echo 'File bcs-2.0/doc/texinfo.tex is continued in part 8'
- echo 8 > _shar_seq_.tmp
- exit 0
-