A documentation proposal using texinfo.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/doc/etikol.texi Tue Jan 20 11:21:42 2004 +0000
1.3 @@ -0,0 +1,188 @@
1.4 +\input texinfo @c -*-texinfo-*-
1.5 +@comment $Id: etikol.texi,v 1.1 2004/01/20 11:21:42 alpar Exp $
1.6 +@comment %**start of header
1.7 +@setfilename etikol.info
1.8 +@include version.texi
1.9 +@settitle GNU ETIK-OL Optimization Library @value{VERSION}
1.10 +@syncodeindex pg cp
1.11 +
1.12 +@c @ifnottex
1.13 +@c @macro mref { nn, txt }
1.14 +@c @ref{\nn\,\txt\}
1.15 +@c @end macro
1.16 +@c @end ifnottex
1.17 +@c @iftex
1.18 +@macro mref { nn, txt }
1.19 +@ifnottex
1.20 +@ref{\nn\,\txt\}
1.21 +@end ifnottex
1.22 +@tex
1.23 +\txt\
1.24 +@end tex
1.25 +@end macro
1.26 +@c @href{\nn\}{\txt\}
1.27 +
1.28 +
1.29 +
1.30 +@c @ifplaintext
1.31 +@c Whereas this text will only appear in plain text.
1.32 +@c @end ifplaintext
1.33 +@c @ifxml
1.34 +@c And this will only appear in XML output.
1.35 +@c @end ifxm
1.36 +@c @ref{\nn\,\txt\}
1.37 +
1.38 +
1.39 +@comment %**end of header
1.40 +@copying
1.41 +This manual is for GNU ETIL-OL Optimization Library
1.42 +(version @value{VERSION}, @value{UPDATED}).
1.43 +
1.44 +Copyright @copyright{} 2003 ETIK.
1.45 +
1.46 +@quotation
1.47 +Permission is granted to copy, distribute and/or modify this document
1.48 +under the terms of the GNU Free Documentation License, Version 1.1 or
1.49 +any later version published by the Free Software Foundation; with no
1.50 +Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
1.51 +and with the Back-Cover Texts as in (a) below. A copy of the
1.52 +license is included in the section entitled ``GNU Free Documentation
1.53 +License.''
1.54 +
1.55 +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
1.56 +this GNU Manual, like GNU software. Copies published by the Free
1.57 +Software Foundation raise funds for GNU development.''
1.58 +@end quotation
1.59 +@end copying
1.60 +
1.61 +@dircategory Texinfo documentation system
1.62 +@direntry
1.63 +* ETIK-OL: ETIK-OL Optimization Library.
1.64 +@end direntry
1.65 +
1.66 +@titlepage
1.67 +@title GNU ETIL-OL Optimization Library
1.68 +@subtitle for version @value{VERSION}, @value{UPDATED}
1.69 +@author ETIK Group
1.70 +@page
1.71 +@vskip 0pt plus 1filll
1.72 +@insertcopying
1.73 +@end titlepage
1.74 +
1.75 +@contents
1.76 +
1.77 +@ifnottex
1.78 +@node Top
1.79 +@top GNU ETIK-OL Library
1.80 +
1.81 +@insertcopying
1.82 +@end ifnottex
1.83 +
1.84 +@menu
1.85 +* Basic Concepts::
1.86 +* Copying This Manual::
1.87 +* Index::
1.88 +@end menu
1.89 +
1.90 +
1.91 +@node Basic Concepts
1.92 +@chapter Basic Concepts
1.93 +
1.94 +@menu
1.95 +* The Full Feature Graph Class::
1.96 +* The BFS algorithm::
1.97 +@end menu
1.98 +
1.99 +@include flf-graph.texi
1.100 +
1.101 +@c @node A Full Feature Graph
1.102 +@c @section A Full Feature Graph
1.103 +@c @cindex Full Feature Graph
1.104 +
1.105 +@node The BFS algorithm
1.106 +@section The BFS algorithm
1.107 +@cindex The BFS algorithm
1.108 +
1.109 +@menu
1.110 +* Iterator style BFS class::
1.111 +* The BFS funcion::
1.112 +@end menu
1.113 +
1.114 +bla2
1.115 +
1.116 +@node Iterator style BFS class
1.117 +@subsection Iterator style BFS class
1.118 +@cindex BFS algorithm
1.119 +@cindex BFS concept
1.120 +
1.121 +Here is a code example.
1.122 +
1.123 +
1.124 +@quotation
1.125 +@verbatim
1.126 +class
1.127 +{
1.128 +public:
1.129 + bfs_node_data<G> NodeType::*d;
1.130 + typedef typename G::EdgeIterator value_type;
1.131 + void Put(typename G::NodeIterator &i,
1.132 + const value_type &t);
1.133 + value_type Get(const typename G::NodeIterator &i) const;
1.134 +} tree;
1.135 +@end verbatim
1.136 +@end quotation
1.137 +
1.138 +
1.139 +The same code with a remark.
1.140 +
1.141 +@comment @quotation
1.142 +@example
1.143 +class
1.144 +@{
1.145 +public:
1.146 + bfs_node_data<G> NodeType::*d;
1.147 + typedef typename G::EdgeIterator value_type;
1.148 + void Put(typename G::NodeIterator &i,
1.149 + const value_type &t); @r{This is a long funcion declaration.}
1.150 + value_type Get(const typename G::NodeIterator &i) const;
1.151 +@} tree;
1.152 +@end example
1.153 +@comment @end quotation
1.154 +
1.155 +@node The BFS funcion
1.156 +@subsection The BFS funcion
1.157 +@cindex BFS algorithm
1.158 +
1.159 +@enumerate
1.160 +@item
1.161 +This is the first item.
1.162 +
1.163 +@item
1.164 +This is the second item.
1.165 +@end enumerate
1.166 +
1.167 +
1.168 +@node Copying This Manual
1.169 +@appendix Copying This Manual
1.170 +
1.171 +@menu
1.172 +* GNU Free Documentation License:: License for copying this manual.
1.173 +@end menu
1.174 +
1.175 +@include fdl.texi
1.176 +
1.177 +
1.178 +@node Index
1.179 +@unnumbered Concept Index
1.180 +@printindex cp
1.181 +
1.182 +@c @node Function Index
1.183 +@unnumbered Function Index
1.184 +@printindex fn
1.185 +
1.186 +@c @node Type Index
1.187 +@unnumbered Type Index
1.188 +@printindex tp
1.189 +
1.190 +@bye
1.191 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/doc/flf-graph.texi Tue Jan 20 11:21:42 2004 +0000
2.3 @@ -0,0 +1,227 @@
2.4 +@node The Full Feature Graph Class
2.5 +@section The Full Feature Graph Class
2.6 +@cindex Full Feature Graph Class
2.7 +
2.8 +This section describes what an imaginary full feature graph class knows.
2.9 +The set of features provided by a real graph implementation is typically
2.10 +a subset of the features below.
2.11 +
2.12 +On the other hand, each graph algorithm requires the underlying graph
2.13 +structure to provide a certain (typically small) set of features in order
2.14 +to be able to run.
2.15 +
2.16 +@subsection Declaration
2.17 +
2.18 +@deftp {Class} {class Graph}
2.19 +@code{Graph} is the imaginary @emph{full feature graph class}.
2.20 +@code{G} denotes the instance of this class in the exaples below.
2.21 +@c Each node and edge has a user defined data sturcure
2.22 +@c @var{N} and @var{E} statically attached to it.
2.23 +@end deftp
2.24 +
2.25 +@subsection Types
2.26 +
2.27 +@deftp {Type} Graph::NodeType
2.28 +@deftpx {Type} Graph::EdgeType
2.29 +The type of the data stored statically for each node and edge.
2.30 +@end deftp
2.31 +
2.32 +@anchor{Graph-NodeIterator}
2.33 +@deftp {Type} Graph::NodePoint
2.34 +@deftpx {Type} Graph::NodeIterator
2.35 +These types points a node uniquely. The difference between the
2.36 +@code{NodePoint} and the @code{NodeIterator} is that @code{NodePoint}
2.37 +requires the graph structure itself for most of the operations.
2.38 +For examples using iterators you can go through all nodes as follows.
2.39 +@quotation
2.40 +@verbatim
2.41 +Graph G;
2.42 +int nodenum=0;
2.43 +for(Graph::NodeIterator n(G);n.Valid();++n) ++nodenum;
2.44 +@end verbatim
2.45 +@end quotation
2.46 +Using @code{NodePoint} the last line looks like this.
2.47 +@quotation
2.48 +@verbatim
2.49 +for(MyGraph::NodePoint n(G);n.Valid();n=G.Next(n)) ++nodenum;
2.50 +@end verbatim
2.51 +@end quotation
2.52 +or
2.53 +@quotation
2.54 +@verbatim
2.55 +MyGraph::NodePoint n;
2.56 +for(G.GetFirst(n);G.Valid(n);G.GoNext(n)) ++nodenum;
2.57 +@end verbatim
2.58 +@end quotation
2.59 +@end deftp
2.60 +
2.61 +@deftp {Type} Graph::EdgePoint
2.62 +@deftpx {Type} Graph::InEdgePoint
2.63 +@deftpx {Type} Graph::OutEdgePoint
2.64 +@deftpx {Type} Graph::BiEdgePoint
2.65 +@deftpx {Type} Graph::SymEdgePoint
2.66 +Each of these types points an edge uniquely. The difference between the
2.67 +@code{EdgePoint} and the
2.68 +@c @mref{Graph-NodeIterator,@code{EdgeIterator}}
2.69 +@mref{Graph-NodeIterator , EdgeIterator}
2.70 +series is that
2.71 +@code{EdgePoint} requires the graph structure itself for most of the
2.72 +operations.
2.73 +@end deftp
2.74 +
2.75 +@anchor{Graph-EdgeIterator}
2.76 +@deftp {Type} Graph::EdgeIterator
2.77 +@deftpx {Type} Graph::InEdgeIterator
2.78 +@deftpx {Type} Graph::OutEdgeIterator
2.79 +@deftpx {Type} Graph::BiEdgeIterator
2.80 +@deftpx {Type} Graph::SymEdgeIterator
2.81 +@deftpx {Type} Graph::AllEdgeIterator
2.82 +Each of these types points an edge uniquely. The difference between the
2.83 +@code{EdgePoint} and the @code{EdgeIterator} series is that
2.84 +@code{EdgePoint} requires the graph structure itself for most of the
2.85 +operations.
2.86 +
2.87 +For the @code{EdgeIterator} types you can use operator @code{++}
2.88 +(both the prefix and the posfix one) to obtain the next edge.
2.89 +@end deftp
2.90 +
2.91 +@deftp {Type} Graph::NodeMap
2.92 +@deftpx {Type} Graph::EdgeMap
2.93 +There are the default property maps for the edges and the nodes.
2.94 +@end deftp
2.95 +
2.96 +
2.97 +@subsection Member Functions
2.98 +
2.99 +@subsubsection Constructors
2.100 +
2.101 +
2.102 +@deftypefun { } Graph::Graph ()
2.103 +The default constructor.
2.104 +@end deftypefun
2.105 +
2.106 +@deftypefun { } Graph::Graph (Graph@tie{}&)
2.107 +The copy constructor. Not yet implemented.
2.108 +@end deftypefun
2.109 +
2.110 +@subsubsection Graph Maintenence Operations
2.111 +
2.112 +@deftypefun NodeIterator Graph::AddNode ()
2.113 +Adds a new node to the graph and returns a @code{NodeIterator} pointing to it.
2.114 +@end deftypefun
2.115 +
2.116 +@deftypefun EdgeIterator Graph::AddEdge (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIterator} @var{to}})
2.117 +Adds a new edge with tail @var{from} and head @var{to} to the graph
2.118 +and returns an @code{EdgeIterator} pointing to it.
2.119 +@end deftypefun
2.120 +
2.121 +@deftypefun void Graph::Delete (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{n}})
2.122 +Deletes the node @var{n}. It also deletes the adjacent edges.
2.123 +@end deftypefun
2.124 +
2.125 +@deftypefun void Graph::Delete (@w{const @mref{Graph-EdgeIterator,EdgeIterator} @var{e}})
2.126 +Deletes the edge @var{n}.
2.127 +@end deftypefun
2.128 +
2.129 +@deftypefun void Graph::Clean ()
2.130 +Deletes all edges and nodes from the graph.
2.131 +@end deftypefun
2.132 +
2.133 +@deftypefun int Graph::NodeNum ()
2.134 +Returns the number of the nodes in the graph.
2.135 +@end deftypefun
2.136 +
2.137 +@subsubsection NodePoint Operations
2.138 +
2.139 +@deftypefun NodePoint Graph::GetFirst (NodePoint &@var{n})
2.140 +@deftypefunx NodePoint Graph::Next (const NodePoint @var{n})
2.141 +@deftypefunx {NodePoint &} Graph::GoNext (NodePoint &@var{n})
2.142 +The nodes in the graph forms a list. @code{GetFirst(n)} sets @var{n} to
2.143 +be the first node. @code{Next(n)} gives back the subsequent
2.144 +node. @code{Next(n)} is equivalent to @code{n=Next(n)}, though it
2.145 +might be faster. ??? What should be the return value ???
2.146 +@end deftypefun
2.147 +
2.148 +@deftypefun bool Graph::Valid (NodePoint &@var{e})
2.149 +@deftypefunx bool NodePoint::Valid ()
2.150 +These functions check if and NodePoint is valid or not.
2.151 +??? Which one should be implemented ???
2.152 +@end deftypefun
2.153 +
2.154 +@subsubsection EdgePoint Operations
2.155 +
2.156 +@deftypefun AllEdgePoint Graph::GetFirst (const AllEdgePoint & @var{e})
2.157 +@deftypefunx AllEdgePoint Graph::Next (const AllEdgePoint @var{n})
2.158 +@deftypefunx {AllEdgePoint &} Graph::GoNext (AllEdgePoint &@var{n})
2.159 +With these functions you can go though all the edges of the graph.
2.160 +??? What should be the return value ???
2.161 +@end deftypefun
2.162 +
2.163 +@deftypefun InEdgePoint Graph::GetFirst (const InEdgePoint & @var{e}, const NodePoint @var{n})
2.164 +@deftypefunx OutEdgePoint Graph::GetFirst (const OutEdgePoint & @var{e}, const NodePoint @var{n})
2.165 +@deftypefunx SymEdgePoint Graph::GetFirst (const SymEdgePoint & @var{e}, const NodePoint @var{n})
2.166 +The edges leaving from, arriving at or adjacent with a node forms a
2.167 +list. These functions give back the first elements of these
2.168 +lists. The exact behavior depends on the type of @var{e}.
2.169 +
2.170 +If @var{e} is an @code{InEdgePoint} or an @code{OutEdgePoint} then
2.171 +@code{GetFirst} sets @var{e} to be the first incoming or outgoing edge
2.172 +of the node @var{n}, respectively.
2.173 +
2.174 +If @var{e} is a @code{SymEdgePoint} then
2.175 +@code{GetFirst} sets @var{e} to be the first incoming if there exists one
2.176 +otherwise the first outgoing edge.
2.177 +
2.178 +If there are no such edges, @var{e} will be invalid.
2.179 +
2.180 +@end deftypefun
2.181 +
2.182 +@deftypefun InEdgePoint Graph::Next (const InEdgePoint @var{e})
2.183 +@deftypefunx OutEdgePoint Graph::Next (const OutEdgePoint @var{e})
2.184 +@deftypefunx SymEdgePoint Graph::Next (const SymEdgePoint @var{e})
2.185 +These functions give back the edge that follows @var{e}
2.186 +@end deftypefun
2.187 +
2.188 +@deftypefun {InEdgePoint &} Graph::GoNext (InEdgePoint &@var{e})
2.189 +@deftypefunx {OutEdgePoint &} Graph::GoNext (OutEdgePoint &@var{e})
2.190 +@deftypefunx {SymEdgePoint &} Graph::GoNext (SymEdgePoint &@var{e})
2.191 +@code{G.GoNext(e)} is equivalent to @code{e=G.Next(e)}, though it
2.192 +might be faster.
2.193 +??? What should be the return value ???
2.194 +@end deftypefun
2.195 +
2.196 +@deftypefun bool Graph::Valid (EdgePoint &@var{e})
2.197 +@deftypefunx bool EdgePoint::Valid ()
2.198 +These functions check if and EdgePoint is valid or not.
2.199 +??? Which one should be implemented ???
2.200 +@end deftypefun
2.201 +
2.202 +@deftypefun NodePoint Graph::From (const EdgePoint @var{e})
2.203 +@deftypefunx NodePoint Graph::To (const EdgePoint @var{e})
2.204 +@deftypefunx NodePoint Graph::ANode (const InEdgePoint @var{e})
2.205 +@deftypefunx NodePoint Graph::ANode (const OutEdgePoint @var{e})
2.206 +@deftypefunx NodePoint Graph::ANode (const SymEdgePoint @var{e})
2.207 +@deftypefunx NodePoint Graph::BNode (const InEdgePoint @var{e})
2.208 +@deftypefunx NodePoint Graph::BNode (const OutEdgePoint @var{e})
2.209 +@deftypefunx NodePoint Graph::BNode (const SymEdgePoint @var{e})
2.210 +There queries give back the two endpoints of the edge @var{e}. For a
2.211 +directed edge @var{e}, @code{From(e)} and @code{To(e)} is its tail and
2.212 +its head, respectively. For an undirected @var{e}, they are two
2.213 +endpoints, but you should not rely on which end is which.
2.214 +
2.215 +@code{ANode(e)} is the node which @var{e} is bounded to, i.e. it is
2.216 +equal to @code{From(e)} if @var{e} is an @code{OutEdgePoint} and
2.217 +@code{To(e)} if @var{e} is an @code{InEdgePoint}. If @var{e} is a
2.218 +@code{SymEdgePoint} and it or its first preceding edge was created by
2.219 +@code{GetFirst(e,n)}, then @code{ANode(e)} is equal to @var{n}.
2.220 +
2.221 +@code{BNode(e)} is the other end of the edge.
2.222 +
2.223 +???It it implemented in an other way now. (Member function <-> Graph global)???
2.224 +@end deftypefun
2.225 +
2.226 +
2.227 +
2.228 +@c @deftypevar int from
2.229 +@c the tail of the created edge.
2.230 +@c @end deftypevar
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/doc/makefile Tue Jan 20 11:21:42 2004 +0000
3.3 @@ -0,0 +1,2 @@
3.4 +all: etikol.texi flf-graph.texi
3.5 + makeinfo etikol.texi&&makeinfo --html etikol.texi&&texi2pdf etikol.texi
3.6 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/doc/texinfo.tex Tue Jan 20 11:21:42 2004 +0000
4.3 @@ -0,0 +1,6615 @@
4.4 +% texinfo.tex -- TeX macros to handle Texinfo files.
4.5 +%
4.6 +% Load plain if necessary, i.e., if running under initex.
4.7 +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
4.8 +%
4.9 +\def\texinfoversion{2003-07-28.08}
4.10 +%
4.11 +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
4.12 +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4.13 +%
4.14 +% This texinfo.tex file is free software; you can redistribute it and/or
4.15 +% modify it under the terms of the GNU General Public License as
4.16 +% published by the Free Software Foundation; either version 2, or (at
4.17 +% your option) any later version.
4.18 +%
4.19 +% This texinfo.tex file is distributed in the hope that it will be
4.20 +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
4.21 +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4.22 +% General Public License for more details.
4.23 +%
4.24 +% You should have received a copy of the GNU General Public License
4.25 +% along with this texinfo.tex file; see the file COPYING. If not, write
4.26 +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
4.27 +% Boston, MA 02111-1307, USA.
4.28 +%
4.29 +% In other words, you are welcome to use, share and improve this program.
4.30 +% You are forbidden to forbid anyone else to use, share and improve
4.31 +% what you give them. Help stamp out software-hoarding!
4.32 +%
4.33 +% Please try the latest version of texinfo.tex before submitting bug
4.34 +% reports; you can get the latest version from:
4.35 +% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
4.36 +% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
4.37 +% ftp://tug.org/tex/texinfo.tex
4.38 +% (and all CTAN mirrors, see http://www.ctan.org),
4.39 +% and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
4.40 +%
4.41 +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
4.42 +%
4.43 +% The texinfo.tex in any given Texinfo distribution could well be out
4.44 +% of date, so if that's what you're using, please check.
4.45 +%
4.46 +% Send bug reports to bug-texinfo@gnu.org. Please include including a
4.47 +% complete document in each bug report with which we can reproduce the
4.48 +% problem. Patches are, of course, greatly appreciated.
4.49 +%
4.50 +% To process a Texinfo manual with TeX, it's most reliable to use the
4.51 +% texi2dvi shell script that comes with the distribution. For a simple
4.52 +% manual foo.texi, however, you can get away with this:
4.53 +% tex foo.texi
4.54 +% texindex foo.??
4.55 +% tex foo.texi
4.56 +% tex foo.texi
4.57 +% dvips foo.dvi -o # or whatever; this makes foo.ps.
4.58 +% The extra TeX runs get the cross-reference information correct.
4.59 +% Sometimes one run after texindex suffices, and sometimes you need more
4.60 +% than two; texi2dvi does it as many times as necessary.
4.61 +%
4.62 +% It is possible to adapt texinfo.tex for other languages, to some
4.63 +% extent. You can get the existing language-specific files from the
4.64 +% full Texinfo distribution.
4.65 +
4.66 +\message{Loading texinfo [version \texinfoversion]:}
4.67 +
4.68 +% If in a .fmt file, print the version number
4.69 +% and turn on active characters that we couldn't do earlier because
4.70 +% they might have appeared in the input file name.
4.71 +\everyjob{\message{[Texinfo version \texinfoversion]}%
4.72 + \catcode`+=\active \catcode`\_=\active}
4.73 +
4.74 +\message{Basics,}
4.75 +\chardef\other=12
4.76 +
4.77 +% We never want plain's \outer definition of \+ in Texinfo.
4.78 +% For @tex, we can use \tabalign.
4.79 +\let\+ = \relax
4.80 +
4.81 +% Save some plain tex macros whose names we will redefine.
4.82 +\let\ptexb=\b
4.83 +\let\ptexbullet=\bullet
4.84 +\let\ptexc=\c
4.85 +\let\ptexcomma=\,
4.86 +\let\ptexdot=\.
4.87 +\let\ptexdots=\dots
4.88 +\let\ptexend=\end
4.89 +\let\ptexequiv=\equiv
4.90 +\let\ptexexclam=\!
4.91 +\let\ptexgtr=>
4.92 +\let\ptexhat=^
4.93 +\let\ptexi=\i
4.94 +\let\ptexindent=\indent
4.95 +\let\ptexlbrace=\{
4.96 +\let\ptexless=<
4.97 +\let\ptexplus=+
4.98 +\let\ptexrbrace=\}
4.99 +\let\ptexslash=\/
4.100 +\let\ptexstar=\*
4.101 +\let\ptext=\t
4.102 +
4.103 +% If this character appears in an error message or help string, it
4.104 +% starts a new line in the output.
4.105 +\newlinechar = `^^J
4.106 +
4.107 +% Set up fixed words for English if not already set.
4.108 +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
4.109 +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
4.110 +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
4.111 +\ifx\putwordin\undefined \gdef\putwordin{in}\fi
4.112 +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
4.113 +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
4.114 +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
4.115 +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
4.116 +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
4.117 +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
4.118 +\ifx\putwordof\undefined \gdef\putwordof{of}\fi
4.119 +\ifx\putwordon\undefined \gdef\putwordon{on}\fi
4.120 +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
4.121 +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
4.122 +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
4.123 +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
4.124 +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
4.125 +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
4.126 +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
4.127 +%
4.128 +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
4.129 +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
4.130 +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
4.131 +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
4.132 +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
4.133 +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
4.134 +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
4.135 +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
4.136 +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
4.137 +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
4.138 +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
4.139 +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
4.140 +%
4.141 +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
4.142 +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
4.143 +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
4.144 +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
4.145 +\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
4.146 +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
4.147 +\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
4.148 +
4.149 +% In some macros, we cannot use the `\? notation---the left quote is
4.150 +% in some cases the escape char.
4.151 +\chardef\colonChar = `\:
4.152 +\chardef\commaChar = `\,
4.153 +\chardef\dotChar = `\.
4.154 +\chardef\equalChar = `\=
4.155 +\chardef\exclamChar= `\!
4.156 +\chardef\questChar = `\?
4.157 +\chardef\semiChar = `\;
4.158 +\chardef\spaceChar = `\ %
4.159 +\chardef\underChar = `\_
4.160 +
4.161 +% Ignore a token.
4.162 +%
4.163 +\def\gobble#1{}
4.164 +
4.165 +% True if #1 is the empty string, i.e., called like `\ifempty{}'.
4.166 +%
4.167 +\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
4.168 +\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
4.169 +
4.170 +% Hyphenation fixes.
4.171 +\hyphenation{ap-pen-dix}
4.172 +\hyphenation{eshell}
4.173 +\hyphenation{mini-buf-fer mini-buf-fers}
4.174 +\hyphenation{time-stamp}
4.175 +\hyphenation{white-space}
4.176 +
4.177 +% Margin to add to right of even pages, to left of odd pages.
4.178 +\newdimen\bindingoffset
4.179 +\newdimen\normaloffset
4.180 +\newdimen\pagewidth \newdimen\pageheight
4.181 +
4.182 +% Sometimes it is convenient to have everything in the transcript file
4.183 +% and nothing on the terminal. We don't just call \tracingall here,
4.184 +% since that produces some useless output on the terminal. We also make
4.185 +% some effort to order the tracing commands to reduce output in the log
4.186 +% file; cf. trace.sty in LaTeX.
4.187 +%
4.188 +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
4.189 +\def\loggingall{%
4.190 + \tracingstats2
4.191 + \tracingpages1
4.192 + \tracinglostchars2 % 2 gives us more in etex
4.193 + \tracingparagraphs1
4.194 + \tracingoutput1
4.195 + \tracingmacros2
4.196 + \tracingrestores1
4.197 + \showboxbreadth\maxdimen \showboxdepth\maxdimen
4.198 + \ifx\eTeXversion\undefined\else % etex gives us more logging
4.199 + \tracingscantokens1
4.200 + \tracingifs1
4.201 + \tracinggroups1
4.202 + \tracingnesting2
4.203 + \tracingassigns1
4.204 + \fi
4.205 + \tracingcommands3 % 3 gives us more in etex
4.206 + \errorcontextlines\maxdimen
4.207 +}%
4.208 +
4.209 +% add check for \lastpenalty to plain's definitions. If the last thing
4.210 +% we did was a \nobreak, we don't want to insert more space.
4.211 +%
4.212 +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
4.213 + \removelastskip\penalty-50\smallskip\fi\fi}
4.214 +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
4.215 + \removelastskip\penalty-100\medskip\fi\fi}
4.216 +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
4.217 + \removelastskip\penalty-200\bigskip\fi\fi}
4.218 +
4.219 +% For @cropmarks command.
4.220 +% Do @cropmarks to get crop marks.
4.221 +%
4.222 +\newif\ifcropmarks
4.223 +\let\cropmarks = \cropmarkstrue
4.224 +%
4.225 +% Dimensions to add cropmarks at corners.
4.226 +% Added by P. A. MacKay, 12 Nov. 1986
4.227 +%
4.228 +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
4.229 +\newdimen\cornerlong \cornerlong=1pc
4.230 +\newdimen\cornerthick \cornerthick=.3pt
4.231 +\newdimen\topandbottommargin \topandbottommargin=.75in
4.232 +
4.233 +% Main output routine.
4.234 +\chardef\PAGE = 255
4.235 +\output = {\onepageout{\pagecontents\PAGE}}
4.236 +
4.237 +\newbox\headlinebox
4.238 +\newbox\footlinebox
4.239 +
4.240 +% \onepageout takes a vbox as an argument. Note that \pagecontents
4.241 +% does insertions, but you have to call it yourself.
4.242 +\def\onepageout#1{%
4.243 + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
4.244 + %
4.245 + \ifodd\pageno \advance\hoffset by \bindingoffset
4.246 + \else \advance\hoffset by -\bindingoffset\fi
4.247 + %
4.248 + % Do this outside of the \shipout so @code etc. will be expanded in
4.249 + % the headline as they should be, not taken literally (outputting ''code).
4.250 + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
4.251 + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
4.252 + %
4.253 + {%
4.254 + % Have to do this stuff outside the \shipout because we want it to
4.255 + % take effect in \write's, yet the group defined by the \vbox ends
4.256 + % before the \shipout runs.
4.257 + %
4.258 + \escapechar = `\\ % use backslash in output files.
4.259 + \indexdummies % don't expand commands in the output.
4.260 + \normalturnoffactive % \ in index entries must not stay \, e.g., if
4.261 + % the page break happens to be in the middle of an example.
4.262 + \shipout\vbox{%
4.263 + % Do this early so pdf references go to the beginning of the page.
4.264 + \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
4.265 + %
4.266 + \ifcropmarks \vbox to \outervsize\bgroup
4.267 + \hsize = \outerhsize
4.268 + \vskip-\topandbottommargin
4.269 + \vtop to0pt{%
4.270 + \line{\ewtop\hfil\ewtop}%
4.271 + \nointerlineskip
4.272 + \line{%
4.273 + \vbox{\moveleft\cornerthick\nstop}%
4.274 + \hfill
4.275 + \vbox{\moveright\cornerthick\nstop}%
4.276 + }%
4.277 + \vss}%
4.278 + \vskip\topandbottommargin
4.279 + \line\bgroup
4.280 + \hfil % center the page within the outer (page) hsize.
4.281 + \ifodd\pageno\hskip\bindingoffset\fi
4.282 + \vbox\bgroup
4.283 + \fi
4.284 + %
4.285 + \unvbox\headlinebox
4.286 + \pagebody{#1}%
4.287 + \ifdim\ht\footlinebox > 0pt
4.288 + % Only leave this space if the footline is nonempty.
4.289 + % (We lessened \vsize for it in \oddfootingxxx.)
4.290 + % The \baselineskip=24pt in plain's \makefootline has no effect.
4.291 + \vskip 2\baselineskip
4.292 + \unvbox\footlinebox
4.293 + \fi
4.294 + %
4.295 + \ifcropmarks
4.296 + \egroup % end of \vbox\bgroup
4.297 + \hfil\egroup % end of (centering) \line\bgroup
4.298 + \vskip\topandbottommargin plus1fill minus1fill
4.299 + \boxmaxdepth = \cornerthick
4.300 + \vbox to0pt{\vss
4.301 + \line{%
4.302 + \vbox{\moveleft\cornerthick\nsbot}%
4.303 + \hfill
4.304 + \vbox{\moveright\cornerthick\nsbot}%
4.305 + }%
4.306 + \nointerlineskip
4.307 + \line{\ewbot\hfil\ewbot}%
4.308 + }%
4.309 + \egroup % \vbox from first cropmarks clause
4.310 + \fi
4.311 + }% end of \shipout\vbox
4.312 + }% end of group with \normalturnoffactive
4.313 + \advancepageno
4.314 + \ifnum\outputpenalty>-20000 \else\dosupereject\fi
4.315 +}
4.316 +
4.317 +\newinsert\margin \dimen\margin=\maxdimen
4.318 +
4.319 +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
4.320 +{\catcode`\@ =11
4.321 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
4.322 +% marginal hacks, juha@viisa.uucp (Juha Takala)
4.323 +\ifvoid\margin\else % marginal info is present
4.324 + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
4.325 +\dimen@=\dp#1 \unvbox#1
4.326 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
4.327 +\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
4.328 +}
4.329 +
4.330 +% Here are the rules for the cropmarks. Note that they are
4.331 +% offset so that the space between them is truly \outerhsize or \outervsize
4.332 +% (P. A. MacKay, 12 November, 1986)
4.333 +%
4.334 +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
4.335 +\def\nstop{\vbox
4.336 + {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
4.337 +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
4.338 +\def\nsbot{\vbox
4.339 + {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
4.340 +
4.341 +% Parse an argument, then pass it to #1. The argument is the rest of
4.342 +% the input line (except we remove a trailing comment). #1 should be a
4.343 +% macro which expects an ordinary undelimited TeX argument.
4.344 +%
4.345 +\def\parsearg#1{%
4.346 + \let\next = #1%
4.347 + \begingroup
4.348 + \obeylines
4.349 + \futurelet\temp\parseargx
4.350 +}
4.351 +
4.352 +% If the next token is an obeyed space (from an @example environment or
4.353 +% the like), remove it and recurse. Otherwise, we're done.
4.354 +\def\parseargx{%
4.355 + % \obeyedspace is defined far below, after the definition of \sepspaces.
4.356 + \ifx\obeyedspace\temp
4.357 + \expandafter\parseargdiscardspace
4.358 + \else
4.359 + \expandafter\parseargline
4.360 + \fi
4.361 +}
4.362 +
4.363 +% Remove a single space (as the delimiter token to the macro call).
4.364 +{\obeyspaces %
4.365 + \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
4.366 +
4.367 +{\obeylines %
4.368 + \gdef\parseargline#1^^M{%
4.369 + \endgroup % End of the group started in \parsearg.
4.370 + %
4.371 + % First remove any @c comment, then any @comment.
4.372 + % Result of each macro is put in \toks0.
4.373 + \argremovec #1\c\relax %
4.374 + \expandafter\argremovecomment \the\toks0 \comment\relax %
4.375 + %
4.376 + % Call the caller's macro, saved as \next in \parsearg.
4.377 + \expandafter\next\expandafter{\the\toks0}%
4.378 + }%
4.379 +}
4.380 +
4.381 +% Since all \c{,omment} does is throw away the argument, we can let TeX
4.382 +% do that for us. The \relax here is matched by the \relax in the call
4.383 +% in \parseargline; it could be more or less anything, its purpose is
4.384 +% just to delimit the argument to the \c.
4.385 +\def\argremovec#1\c#2\relax{\toks0 = {#1}}
4.386 +\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
4.387 +
4.388 +% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
4.389 +% @end itemize @c foo
4.390 +% will have two active spaces as part of the argument with the
4.391 +% `itemize'. Here we remove all active spaces from #1, and assign the
4.392 +% result to \toks0.
4.393 +%
4.394 +% This loses if there are any *other* active characters besides spaces
4.395 +% in the argument -- _ ^ +, for example -- since they get expanded.
4.396 +% Fortunately, Texinfo does not define any such commands. (If it ever
4.397 +% does, the catcode of the characters in questionwill have to be changed
4.398 +% here.) But this means we cannot call \removeactivespaces as part of
4.399 +% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
4.400 +% that \parsearg gets might well have any character at all in it.
4.401 +%
4.402 +\def\removeactivespaces#1{%
4.403 + \begingroup
4.404 + \ignoreactivespaces
4.405 + \edef\temp{#1}%
4.406 + \global\toks0 = \expandafter{\temp}%
4.407 + \endgroup
4.408 +}
4.409 +
4.410 +% Change the active space to expand to nothing.
4.411 +%
4.412 +\begingroup
4.413 + \obeyspaces
4.414 + \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
4.415 +\endgroup
4.416 +
4.417 +
4.418 +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
4.419 +
4.420 +%% These are used to keep @begin/@end levels from running away
4.421 +%% Call \inENV within environments (after a \begingroup)
4.422 +\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
4.423 +\def\ENVcheck{%
4.424 +\ifENV\errmessage{Still within an environment; press RETURN to continue}
4.425 +\endgroup\fi} % This is not perfect, but it should reduce lossage
4.426 +
4.427 +% @begin foo is the same as @foo, for now.
4.428 +\newhelp\EMsimple{Press RETURN to continue.}
4.429 +
4.430 +\outer\def\begin{\parsearg\beginxxx}
4.431 +
4.432 +\def\beginxxx #1{%
4.433 +\expandafter\ifx\csname #1\endcsname\relax
4.434 +{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
4.435 +\csname #1\endcsname\fi}
4.436 +
4.437 +% @end foo executes the definition of \Efoo.
4.438 +%
4.439 +\def\end{\parsearg\endxxx}
4.440 +\def\endxxx #1{%
4.441 + \removeactivespaces{#1}%
4.442 + \edef\endthing{\the\toks0}%
4.443 + %
4.444 + \expandafter\ifx\csname E\endthing\endcsname\relax
4.445 + \expandafter\ifx\csname \endthing\endcsname\relax
4.446 + % There's no \foo, i.e., no ``environment'' foo.
4.447 + \errhelp = \EMsimple
4.448 + \errmessage{Undefined command `@end \endthing'}%
4.449 + \else
4.450 + \unmatchedenderror\endthing
4.451 + \fi
4.452 + \else
4.453 + % Everything's ok; the right environment has been started.
4.454 + \csname E\endthing\endcsname
4.455 + \fi
4.456 +}
4.457 +
4.458 +% There is an environment #1, but it hasn't been started. Give an error.
4.459 +%
4.460 +\def\unmatchedenderror#1{%
4.461 + \errhelp = \EMsimple
4.462 + \errmessage{This `@end #1' doesn't have a matching `@#1'}%
4.463 +}
4.464 +
4.465 +% Define the control sequence \E#1 to give an unmatched @end error.
4.466 +%
4.467 +\def\defineunmatchedend#1{%
4.468 + \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
4.469 +}
4.470 +
4.471 +
4.472 +%% Simple single-character @ commands
4.473 +
4.474 +% @@ prints an @
4.475 +% Kludge this until the fonts are right (grr).
4.476 +\def\@{{\tt\char64}}
4.477 +
4.478 +% This is turned off because it was never documented
4.479 +% and you can use @w{...} around a quote to suppress ligatures.
4.480 +%% Define @` and @' to be the same as ` and '
4.481 +%% but suppressing ligatures.
4.482 +%\def\`{{`}}
4.483 +%\def\'{{'}}
4.484 +
4.485 +% Used to generate quoted braces.
4.486 +\def\mylbrace {{\tt\char123}}
4.487 +\def\myrbrace {{\tt\char125}}
4.488 +\let\{=\mylbrace
4.489 +\let\}=\myrbrace
4.490 +\begingroup
4.491 + % Definitions to produce \{ and \} commands for indices,
4.492 + % and @{ and @} for the aux file.
4.493 + \catcode`\{ = \other \catcode`\} = \other
4.494 + \catcode`\[ = 1 \catcode`\] = 2
4.495 + \catcode`\! = 0 \catcode`\\ = \other
4.496 + !gdef!lbracecmd[\{]%
4.497 + !gdef!rbracecmd[\}]%
4.498 + !gdef!lbraceatcmd[@{]%
4.499 + !gdef!rbraceatcmd[@}]%
4.500 +!endgroup
4.501 +
4.502 +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
4.503 +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
4.504 +\let\, = \c
4.505 +\let\dotaccent = \.
4.506 +\def\ringaccent#1{{\accent23 #1}}
4.507 +\let\tieaccent = \t
4.508 +\let\ubaraccent = \b
4.509 +\let\udotaccent = \d
4.510 +
4.511 +% Other special characters: @questiondown @exclamdown
4.512 +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
4.513 +\def\questiondown{?`}
4.514 +\def\exclamdown{!`}
4.515 +
4.516 +% Dotless i and dotless j, used for accents.
4.517 +\def\imacro{i}
4.518 +\def\jmacro{j}
4.519 +\def\dotless#1{%
4.520 + \def\temp{#1}%
4.521 + \ifx\temp\imacro \ptexi
4.522 + \else\ifx\temp\jmacro \j
4.523 + \else \errmessage{@dotless can be used only with i or j}%
4.524 + \fi\fi
4.525 +}
4.526 +
4.527 +% Be sure we're in horizontal mode when doing a tie, since we make space
4.528 +% equivalent to this in @example-like environments. Otherwise, a space
4.529 +% at the beginning of a line will start with \penalty -- and
4.530 +% since \penalty is valid in vertical mode, we'd end up putting the
4.531 +% penalty on the vertical list instead of in the new paragraph.
4.532 +{\catcode`@ = 11
4.533 + % Avoid using \@M directly, because that causes trouble
4.534 + % if the definition is written into an index file.
4.535 + \global\let\tiepenalty = \@M
4.536 + \gdef\tie{\leavevmode\penalty\tiepenalty\ }
4.537 +}
4.538 +
4.539 +% @: forces normal size whitespace following.
4.540 +\def\:{\spacefactor=1000 }
4.541 +
4.542 +% @* forces a line break.
4.543 +\def\*{\hfil\break\hbox{}\ignorespaces}
4.544 +
4.545 +% @/ allows a line break.
4.546 +\let\/=\allowbreak
4.547 +
4.548 +% @. is an end-of-sentence period.
4.549 +\def\.{.\spacefactor=3000 }
4.550 +
4.551 +% @! is an end-of-sentence bang.
4.552 +\def\!{!\spacefactor=3000 }
4.553 +
4.554 +% @? is an end-of-sentence query.
4.555 +\def\?{?\spacefactor=3000 }
4.556 +
4.557 +% @w prevents a word break. Without the \leavevmode, @w at the
4.558 +% beginning of a paragraph, when TeX is still in vertical mode, would
4.559 +% produce a whole line of output instead of starting the paragraph.
4.560 +\def\w#1{\leavevmode\hbox{#1}}
4.561 +
4.562 +% @group ... @end group forces ... to be all on one page, by enclosing
4.563 +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
4.564 +% to keep its height that of a normal line. According to the rules for
4.565 +% \topskip (p.114 of the TeXbook), the glue inserted is
4.566 +% max (\topskip - \ht (first item), 0). If that height is large,
4.567 +% therefore, no glue is inserted, and the space between the headline and
4.568 +% the text is small, which looks bad.
4.569 +%
4.570 +% Another complication is that the group might be very large. This can
4.571 +% cause the glue on the previous page to be unduly stretched, because it
4.572 +% does not have much material. In this case, it's better to add an
4.573 +% explicit \vfill so that the extra space is at the bottom. The
4.574 +% threshold for doing this is if the group is more than \vfilllimit
4.575 +% percent of a page (\vfilllimit can be changed inside of @tex).
4.576 +%
4.577 +\newbox\groupbox
4.578 +\def\vfilllimit{0.7}
4.579 +%
4.580 +\def\group{\begingroup
4.581 + \ifnum\catcode13=\active \else
4.582 + \errhelp = \groupinvalidhelp
4.583 + \errmessage{@group invalid in context where filling is enabled}%
4.584 + \fi
4.585 + %
4.586 + % The \vtop we start below produces a box with normal height and large
4.587 + % depth; thus, TeX puts \baselineskip glue before it, and (when the
4.588 + % next line of text is done) \lineskip glue after it. (See p.82 of
4.589 + % the TeXbook.) Thus, space below is not quite equal to space
4.590 + % above. But it's pretty close.
4.591 + \def\Egroup{%
4.592 + \egroup % End the \vtop.
4.593 + % \dimen0 is the vertical size of the group's box.
4.594 + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
4.595 + % \dimen2 is how much space is left on the page (more or less).
4.596 + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
4.597 + % if the group doesn't fit on the current page, and it's a big big
4.598 + % group, force a page break.
4.599 + \ifdim \dimen0 > \dimen2
4.600 + \ifdim \pagetotal < \vfilllimit\pageheight
4.601 + \page
4.602 + \fi
4.603 + \fi
4.604 + \copy\groupbox
4.605 + \endgroup % End the \group.
4.606 + }%
4.607 + %
4.608 + \setbox\groupbox = \vtop\bgroup
4.609 + % We have to put a strut on the last line in case the @group is in
4.610 + % the midst of an example, rather than completely enclosing it.
4.611 + % Otherwise, the interline space between the last line of the group
4.612 + % and the first line afterwards is too small. But we can't put the
4.613 + % strut in \Egroup, since there it would be on a line by itself.
4.614 + % Hence this just inserts a strut at the beginning of each line.
4.615 + \everypar = {\strut}%
4.616 + %
4.617 + % Since we have a strut on every line, we don't need any of TeX's
4.618 + % normal interline spacing.
4.619 + \offinterlineskip
4.620 + %
4.621 + % OK, but now we have to do something about blank
4.622 + % lines in the input in @example-like environments, which normally
4.623 + % just turn into \lisppar, which will insert no space now that we've
4.624 + % turned off the interline space. Simplest is to make them be an
4.625 + % empty paragraph.
4.626 + \ifx\par\lisppar
4.627 + \edef\par{\leavevmode \par}%
4.628 + %
4.629 + % Reset ^^M's definition to new definition of \par.
4.630 + \obeylines
4.631 + \fi
4.632 + %
4.633 + % Do @comment since we are called inside an environment such as
4.634 + % @example, where each end-of-line in the input causes an
4.635 + % end-of-line in the output. We don't want the end-of-line after
4.636 + % the `@group' to put extra space in the output. Since @group
4.637 + % should appear on a line by itself (according to the Texinfo
4.638 + % manual), we don't worry about eating any user text.
4.639 + \comment
4.640 +}
4.641 +%
4.642 +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
4.643 +% message, so this ends up printing `@group can only ...'.
4.644 +%
4.645 +\newhelp\groupinvalidhelp{%
4.646 +group can only be used in environments such as @example,^^J%
4.647 +where each line of input produces a line of output.}
4.648 +
4.649 +% @need space-in-mils
4.650 +% forces a page break if there is not space-in-mils remaining.
4.651 +
4.652 +\newdimen\mil \mil=0.001in
4.653 +
4.654 +\def\need{\parsearg\needx}
4.655 +
4.656 +% Old definition--didn't work.
4.657 +%\def\needx #1{\par %
4.658 +%% This method tries to make TeX break the page naturally
4.659 +%% if the depth of the box does not fit.
4.660 +%{\baselineskip=0pt%
4.661 +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
4.662 +%\prevdepth=-1000pt
4.663 +%}}
4.664 +
4.665 +\def\needx#1{%
4.666 + % Ensure vertical mode, so we don't make a big box in the middle of a
4.667 + % paragraph.
4.668 + \par
4.669 + %
4.670 + % If the @need value is less than one line space, it's useless.
4.671 + \dimen0 = #1\mil
4.672 + \dimen2 = \ht\strutbox
4.673 + \advance\dimen2 by \dp\strutbox
4.674 + \ifdim\dimen0 > \dimen2
4.675 + %
4.676 + % Do a \strut just to make the height of this box be normal, so the
4.677 + % normal leading is inserted relative to the preceding line.
4.678 + % And a page break here is fine.
4.679 + \vtop to #1\mil{\strut\vfil}%
4.680 + %
4.681 + % TeX does not even consider page breaks if a penalty added to the
4.682 + % main vertical list is 10000 or more. But in order to see if the
4.683 + % empty box we just added fits on the page, we must make it consider
4.684 + % page breaks. On the other hand, we don't want to actually break the
4.685 + % page after the empty box. So we use a penalty of 9999.
4.686 + %
4.687 + % There is an extremely small chance that TeX will actually break the
4.688 + % page at this \penalty, if there are no other feasible breakpoints in
4.689 + % sight. (If the user is using lots of big @group commands, which
4.690 + % almost-but-not-quite fill up a page, TeX will have a hard time doing
4.691 + % good page breaking, for example.) However, I could not construct an
4.692 + % example where a page broke at this \penalty; if it happens in a real
4.693 + % document, then we can reconsider our strategy.
4.694 + \penalty9999
4.695 + %
4.696 + % Back up by the size of the box, whether we did a page break or not.
4.697 + \kern -#1\mil
4.698 + %
4.699 + % Do not allow a page break right after this kern.
4.700 + \nobreak
4.701 + \fi
4.702 +}
4.703 +
4.704 +% @br forces paragraph break
4.705 +
4.706 +\let\br = \par
4.707 +
4.708 +% @dots{} output an ellipsis using the current font.
4.709 +% We do .5em per period so that it has the same spacing in a typewriter
4.710 +% font as three actual period characters.
4.711 +%
4.712 +\def\dots{%
4.713 + \leavevmode
4.714 + \hbox to 1.5em{%
4.715 + \hskip 0pt plus 0.25fil minus 0.25fil
4.716 + .\hss.\hss.%
4.717 + \hskip 0pt plus 0.5fil minus 0.5fil
4.718 + }%
4.719 +}
4.720 +
4.721 +% @enddots{} is an end-of-sentence ellipsis.
4.722 +%
4.723 +\def\enddots{%
4.724 + \leavevmode
4.725 + \hbox to 2em{%
4.726 + \hskip 0pt plus 0.25fil minus 0.25fil
4.727 + .\hss.\hss.\hss.%
4.728 + \hskip 0pt plus 0.5fil minus 0.5fil
4.729 + }%
4.730 + \spacefactor=3000
4.731 +}
4.732 +
4.733 +% @page forces the start of a new page.
4.734 +%
4.735 +\def\page{\par\vfill\supereject}
4.736 +
4.737 +% @exdent text....
4.738 +% outputs text on separate line in roman font, starting at standard page margin
4.739 +
4.740 +% This records the amount of indent in the innermost environment.
4.741 +% That's how much \exdent should take out.
4.742 +\newskip\exdentamount
4.743 +
4.744 +% This defn is used inside fill environments such as @defun.
4.745 +\def\exdent{\parsearg\exdentyyy}
4.746 +\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
4.747 +
4.748 +% This defn is used inside nofill environments such as @example.
4.749 +\def\nofillexdent{\parsearg\nofillexdentyyy}
4.750 +\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
4.751 +\leftline{\hskip\leftskip{\rm#1}}}}
4.752 +
4.753 +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
4.754 +% paragraph. For more general purposes, use the \margin insertion
4.755 +% class. WHICH is `l' or `r'.
4.756 +%
4.757 +\newskip\inmarginspacing \inmarginspacing=1cm
4.758 +\def\strutdepth{\dp\strutbox}
4.759 +%
4.760 +\def\doinmargin#1#2{\strut\vadjust{%
4.761 + \nobreak
4.762 + \kern-\strutdepth
4.763 + \vtop to \strutdepth{%
4.764 + \baselineskip=\strutdepth
4.765 + \vss
4.766 + % if you have multiple lines of stuff to put here, you'll need to
4.767 + % make the vbox yourself of the appropriate size.
4.768 + \ifx#1l%
4.769 + \llap{\ignorespaces #2\hskip\inmarginspacing}%
4.770 + \else
4.771 + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
4.772 + \fi
4.773 + \null
4.774 + }%
4.775 +}}
4.776 +\def\inleftmargin{\doinmargin l}
4.777 +\def\inrightmargin{\doinmargin r}
4.778 +%
4.779 +% @inmargin{TEXT [, RIGHT-TEXT]}
4.780 +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
4.781 +% else use TEXT for both).
4.782 +%
4.783 +\def\inmargin#1{\parseinmargin #1,,\finish}
4.784 +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
4.785 + \setbox0 = \hbox{\ignorespaces #2}%
4.786 + \ifdim\wd0 > 0pt
4.787 + \def\lefttext{#1}% have both texts
4.788 + \def\righttext{#2}%
4.789 + \else
4.790 + \def\lefttext{#1}% have only one text
4.791 + \def\righttext{#1}%
4.792 + \fi
4.793 + %
4.794 + \ifodd\pageno
4.795 + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
4.796 + \else
4.797 + \def\temp{\inleftmargin\lefttext}%
4.798 + \fi
4.799 + \temp
4.800 +}
4.801 +
4.802 +% @include file insert text of that file as input.
4.803 +% Allow normal characters that we make active in the argument (a file name).
4.804 +\def\include{\begingroup
4.805 + \catcode`\\=\other
4.806 + \catcode`~=\other
4.807 + \catcode`^=\other
4.808 + \catcode`_=\other
4.809 + \catcode`|=\other
4.810 + \catcode`<=\other
4.811 + \catcode`>=\other
4.812 + \catcode`+=\other
4.813 + \parsearg\includezzz}
4.814 +% Restore active chars for included file.
4.815 +\def\includezzz#1{\endgroup\begingroup
4.816 + % Read the included file in a group so nested @include's work.
4.817 + \def\thisfile{#1}%
4.818 + \let\value=\expandablevalue
4.819 + \input\thisfile
4.820 +\endgroup}
4.821 +
4.822 +\def\thisfile{}
4.823 +
4.824 +% @center line
4.825 +% outputs that line, centered.
4.826 +%
4.827 +\def\center{\parsearg\docenter}
4.828 +\def\docenter#1{{%
4.829 + \ifhmode \hfil\break \fi
4.830 + \advance\hsize by -\leftskip
4.831 + \advance\hsize by -\rightskip
4.832 + \line{\hfil \ignorespaces#1\unskip \hfil}%
4.833 + \ifhmode \break \fi
4.834 +}}
4.835 +
4.836 +% @sp n outputs n lines of vertical space
4.837 +
4.838 +\def\sp{\parsearg\spxxx}
4.839 +\def\spxxx #1{\vskip #1\baselineskip}
4.840 +
4.841 +% @comment ...line which is ignored...
4.842 +% @c is the same as @comment
4.843 +% @ignore ... @end ignore is another way to write a comment
4.844 +
4.845 +\def\comment{\begingroup \catcode`\^^M=\other%
4.846 +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
4.847 +\commentxxx}
4.848 +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
4.849 +
4.850 +\let\c=\comment
4.851 +
4.852 +% @paragraphindent NCHARS
4.853 +% We'll use ems for NCHARS, close enough.
4.854 +% NCHARS can also be the word `asis' or `none'.
4.855 +% We cannot feasibly implement @paragraphindent asis, though.
4.856 +%
4.857 +\def\asisword{asis} % no translation, these are keywords
4.858 +\def\noneword{none}
4.859 +%
4.860 +\def\paragraphindent{\parsearg\doparagraphindent}
4.861 +\def\doparagraphindent#1{%
4.862 + \def\temp{#1}%
4.863 + \ifx\temp\asisword
4.864 + \else
4.865 + \ifx\temp\noneword
4.866 + \defaultparindent = 0pt
4.867 + \else
4.868 + \defaultparindent = #1em
4.869 + \fi
4.870 + \fi
4.871 + \parindent = \defaultparindent
4.872 +}
4.873 +
4.874 +% @exampleindent NCHARS
4.875 +% We'll use ems for NCHARS like @paragraphindent.
4.876 +% It seems @exampleindent asis isn't necessary, but
4.877 +% I preserve it to make it similar to @paragraphindent.
4.878 +\def\exampleindent{\parsearg\doexampleindent}
4.879 +\def\doexampleindent#1{%
4.880 + \def\temp{#1}%
4.881 + \ifx\temp\asisword
4.882 + \else
4.883 + \ifx\temp\noneword
4.884 + \lispnarrowing = 0pt
4.885 + \else
4.886 + \lispnarrowing = #1em
4.887 + \fi
4.888 + \fi
4.889 +}
4.890 +
4.891 +% @firstparagraphindent WORD
4.892 +% If WORD is `none', then suppress indentation of the first paragraph
4.893 +% after a section heading. If WORD is `insert', then do indent at such
4.894 +% paragraphs.
4.895 +%
4.896 +% The paragraph indentation is suppressed or not by calling
4.897 +% \suppressfirstparagraphindent, which the sectioning commands do.
4.898 +% We switch the definition of this back and forth according to WORD.
4.899 +% By default, we suppress indentation.
4.900 +%
4.901 +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
4.902 +\newdimen\currentparindent
4.903 +%
4.904 +\def\insertword{insert}
4.905 +%
4.906 +\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
4.907 +\def\dofirstparagraphindent#1{%
4.908 + \def\temp{#1}%
4.909 + \ifx\temp\noneword
4.910 + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
4.911 + \else\ifx\temp\insertword
4.912 + \let\suppressfirstparagraphindent = \relax
4.913 + \else
4.914 + \errhelp = \EMsimple
4.915 + \errmessage{Unknown @firstparagraphindent option `\temp'}%
4.916 + \fi\fi
4.917 +}
4.918 +
4.919 +% Here is how we actually suppress indentation. Redefine \everypar to
4.920 +% \kern backwards by \parindent, and then reset itself to empty.
4.921 +%
4.922 +% We also make \indent itself not actually do anything until the next
4.923 +% paragraph.
4.924 +%
4.925 +\gdef\dosuppressfirstparagraphindent{%
4.926 + \gdef\indent{%
4.927 + \global\let\indent=\ptexindent
4.928 + \global\everypar = {}%
4.929 + }%
4.930 + \global\everypar = {%
4.931 + \kern-\parindent
4.932 + \global\let\indent=\ptexindent
4.933 + \global\everypar = {}%
4.934 + }%
4.935 +}%
4.936 +
4.937 +
4.938 +% @asis just yields its argument. Used with @table, for example.
4.939 +%
4.940 +\def\asis#1{#1}
4.941 +
4.942 +% @math outputs its argument in math mode.
4.943 +% We don't use $'s directly in the definition of \math because we need
4.944 +% to set catcodes according to plain TeX first, to allow for subscripts,
4.945 +% superscripts, special math chars, etc.
4.946 +%
4.947 +\let\implicitmath = $%$ font-lock fix
4.948 +%
4.949 +% One complication: _ usually means subscripts, but it could also mean
4.950 +% an actual _ character, as in @math{@var{some_variable} + 1}. So make
4.951 +% _ within @math be active (mathcode "8000), and distinguish by seeing
4.952 +% if the current family is \slfam, which is what @var uses.
4.953 +%
4.954 +{\catcode\underChar = \active
4.955 +\gdef\mathunderscore{%
4.956 + \catcode\underChar=\active
4.957 + \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
4.958 +}}
4.959 +%
4.960 +% Another complication: we want \\ (and @\) to output a \ character.
4.961 +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
4.962 +% this is not advertised and we don't care. Texinfo does not
4.963 +% otherwise define @\.
4.964 +%
4.965 +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
4.966 +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
4.967 +%
4.968 +\def\math{%
4.969 + \tex
4.970 + \mathcode`\_="8000 \mathunderscore
4.971 + \let\\ = \mathbackslash
4.972 + \mathactive
4.973 + \implicitmath\finishmath}
4.974 +\def\finishmath#1{#1\implicitmath\Etex}
4.975 +
4.976 +% Some active characters (such as <) are spaced differently in math.
4.977 +% We have to reset their definitions in case the @math was an
4.978 +% argument to a command which set the catcodes (such as @item or @section).
4.979 +%
4.980 +{
4.981 + \catcode`^ = \active
4.982 + \catcode`< = \active
4.983 + \catcode`> = \active
4.984 + \catcode`+ = \active
4.985 + \gdef\mathactive{%
4.986 + \let^ = \ptexhat
4.987 + \let< = \ptexless
4.988 + \let> = \ptexgtr
4.989 + \let+ = \ptexplus
4.990 + }
4.991 +}
4.992 +
4.993 +% @bullet and @minus need the same treatment as @math, just above.
4.994 +\def\bullet{\implicitmath\ptexbullet\implicitmath}
4.995 +\def\minus{\implicitmath-\implicitmath}
4.996 +
4.997 +% @refill is a no-op.
4.998 +\let\refill=\relax
4.999 +
4.1000 +% If working on a large document in chapters, it is convenient to
4.1001 +% be able to disable indexing, cross-referencing, and contents, for test runs.
4.1002 +% This is done with @novalidate (before @setfilename).
4.1003 +%
4.1004 +\newif\iflinks \linkstrue % by default we want the aux files.
4.1005 +\let\novalidate = \linksfalse
4.1006 +
4.1007 +% @setfilename is done at the beginning of every texinfo file.
4.1008 +% So open here the files we need to have open while reading the input.
4.1009 +% This makes it possible to make a .fmt file for texinfo.
4.1010 +\def\setfilename{%
4.1011 + \iflinks
4.1012 + \readauxfile
4.1013 + \fi % \openindices needs to do some work in any case.
4.1014 + \openindices
4.1015 + \fixbackslash % Turn off hack to swallow `\input texinfo'.
4.1016 + \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
4.1017 + %
4.1018 + % If texinfo.cnf is present on the system, read it.
4.1019 + % Useful for site-wide @afourpaper, etc.
4.1020 + % Just to be on the safe side, close the input stream before the \input.
4.1021 + \openin 1 texinfo.cnf
4.1022 + \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
4.1023 + \closein1
4.1024 + \temp
4.1025 + %
4.1026 + \comment % Ignore the actual filename.
4.1027 +}
4.1028 +
4.1029 +% Called from \setfilename.
4.1030 +%
4.1031 +\def\openindices{%
4.1032 + \newindex{cp}%
4.1033 + \newcodeindex{fn}%
4.1034 + \newcodeindex{vr}%
4.1035 + \newcodeindex{tp}%
4.1036 + \newcodeindex{ky}%
4.1037 + \newcodeindex{pg}%
4.1038 +}
4.1039 +
4.1040 +% @bye.
4.1041 +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
4.1042 +
4.1043 +
4.1044 +\message{pdf,}
4.1045 +% adobe `portable' document format
4.1046 +\newcount\tempnum
4.1047 +\newcount\lnkcount
4.1048 +\newtoks\filename
4.1049 +\newcount\filenamelength
4.1050 +\newcount\pgn
4.1051 +\newtoks\toksA
4.1052 +\newtoks\toksB
4.1053 +\newtoks\toksC
4.1054 +\newtoks\toksD
4.1055 +\newbox\boxA
4.1056 +\newcount\countA
4.1057 +\newif\ifpdf
4.1058 +\newif\ifpdfmakepagedest
4.1059 +
4.1060 +\ifx\pdfoutput\undefined
4.1061 + \pdffalse
4.1062 + \let\pdfmkdest = \gobble
4.1063 + \let\pdfurl = \gobble
4.1064 + \let\endlink = \relax
4.1065 + \let\linkcolor = \relax
4.1066 + \let\pdfmakeoutlines = \relax
4.1067 +\else
4.1068 + \pdftrue
4.1069 + \pdfoutput = 1
4.1070 + \input pdfcolor
4.1071 + \def\dopdfimage#1#2#3{%
4.1072 + \def\imagewidth{#2}%
4.1073 + \def\imageheight{#3}%
4.1074 + % without \immediate, pdftex seg faults when the same image is
4.1075 + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
4.1076 + \ifnum\pdftexversion < 14
4.1077 + \immediate\pdfimage
4.1078 + \else
4.1079 + \immediate\pdfximage
4.1080 + \fi
4.1081 + \ifx\empty\imagewidth\else width \imagewidth \fi
4.1082 + \ifx\empty\imageheight\else height \imageheight \fi
4.1083 + \ifnum\pdftexversion<13
4.1084 + #1.pdf%
4.1085 + \else
4.1086 + {#1.pdf}%
4.1087 + \fi
4.1088 + \ifnum\pdftexversion < 14 \else
4.1089 + \pdfrefximage \pdflastximage
4.1090 + \fi}
4.1091 + \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
4.1092 + \def\pdfmkpgn#1{#1}
4.1093 + \let\linkcolor = \Blue % was Cyan, but that seems light?
4.1094 + \def\endlink{\Black\pdfendlink}
4.1095 + % Adding outlines to PDF; macros for calculating structure of outlines
4.1096 + % come from Petr Olsak
4.1097 + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
4.1098 + \else \csname#1\endcsname \fi}
4.1099 + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
4.1100 + \advance\tempnum by1
4.1101 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
4.1102 + \def\pdfmakeoutlines{{%
4.1103 + \openin 1 \jobname.toc
4.1104 + \ifeof 1\else\begingroup
4.1105 + \closein 1
4.1106 + % Thanh's hack / proper braces in bookmarks
4.1107 + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
4.1108 + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
4.1109 + %
4.1110 + \def\chapentry ##1##2##3{}
4.1111 + \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
4.1112 + \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
4.1113 + \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
4.1114 + \let\appendixentry = \chapentry
4.1115 + \let\unnumbchapentry = \chapentry
4.1116 + \let\unnumbsecentry = \secentry
4.1117 + \let\unnumbsubsecentry = \subsecentry
4.1118 + \let\unnumbsubsubsecentry = \subsubsecentry
4.1119 + \input \jobname.toc
4.1120 + \def\chapentry ##1##2##3{%
4.1121 + \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
4.1122 + \def\secentry ##1##2##3##4{%
4.1123 + \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
4.1124 + \def\subsecentry ##1##2##3##4##5{%
4.1125 + \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
4.1126 + \def\subsubsecentry ##1##2##3##4##5##6{%
4.1127 + \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
4.1128 + \let\appendixentry = \chapentry
4.1129 + \let\unnumbchapentry = \chapentry
4.1130 + \let\unnumbsecentry = \secentry
4.1131 + \let\unnumbsubsecentry = \subsecentry
4.1132 + \let\unnumbsubsubsecentry = \subsubsecentry
4.1133 + %
4.1134 + % Make special characters normal for writing to the pdf file.
4.1135 + %
4.1136 + \indexnofonts
4.1137 + \let\tt=\relax
4.1138 + \turnoffactive
4.1139 + \input \jobname.toc
4.1140 + \endgroup\fi
4.1141 + }}
4.1142 + \def\makelinks #1,{%
4.1143 + \def\params{#1}\def\E{END}%
4.1144 + \ifx\params\E
4.1145 + \let\nextmakelinks=\relax
4.1146 + \else
4.1147 + \let\nextmakelinks=\makelinks
4.1148 + \ifnum\lnkcount>0,\fi
4.1149 + \picknum{#1}%
4.1150 + \startlink attr{/Border [0 0 0]}
4.1151 + goto name{\pdfmkpgn{\the\pgn}}%
4.1152 + \linkcolor #1%
4.1153 + \advance\lnkcount by 1%
4.1154 + \endlink
4.1155 + \fi
4.1156 + \nextmakelinks
4.1157 + }
4.1158 + \def\picknum#1{\expandafter\pn#1}
4.1159 + \def\pn#1{%
4.1160 + \def\p{#1}%
4.1161 + \ifx\p\lbrace
4.1162 + \let\nextpn=\ppn
4.1163 + \else
4.1164 + \let\nextpn=\ppnn
4.1165 + \def\first{#1}
4.1166 + \fi
4.1167 + \nextpn
4.1168 + }
4.1169 + \def\ppn#1{\pgn=#1\gobble}
4.1170 + \def\ppnn{\pgn=\first}
4.1171 + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
4.1172 + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
4.1173 + \def\skipspaces#1{\def\PP{#1}\def\D{|}%
4.1174 + \ifx\PP\D\let\nextsp\relax
4.1175 + \else\let\nextsp\skipspaces
4.1176 + \ifx\p\space\else\addtokens{\filename}{\PP}%
4.1177 + \advance\filenamelength by 1
4.1178 + \fi
4.1179 + \fi
4.1180 + \nextsp}
4.1181 + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
4.1182 + \ifnum\pdftexversion < 14
4.1183 + \let \startlink \pdfannotlink
4.1184 + \else
4.1185 + \let \startlink \pdfstartlink
4.1186 + \fi
4.1187 + \def\pdfurl#1{%
4.1188 + \begingroup
4.1189 + \normalturnoffactive\def\@{@}%
4.1190 + \let\value=\expandablevalue
4.1191 + \leavevmode\Red
4.1192 + \startlink attr{/Border [0 0 0]}%
4.1193 + user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
4.1194 + % #1
4.1195 + \endgroup}
4.1196 + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
4.1197 + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
4.1198 + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
4.1199 + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
4.1200 + \def\maketoks{%
4.1201 + \expandafter\poptoks\the\toksA|ENDTOKS|
4.1202 + \ifx\first0\adn0
4.1203 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
4.1204 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
4.1205 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
4.1206 + \else
4.1207 + \ifnum0=\countA\else\makelink\fi
4.1208 + \ifx\first.\let\next=\done\else
4.1209 + \let\next=\maketoks
4.1210 + \addtokens{\toksB}{\the\toksD}
4.1211 + \ifx\first,\addtokens{\toksB}{\space}\fi
4.1212 + \fi
4.1213 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
4.1214 + \next}
4.1215 + \def\makelink{\addtokens{\toksB}%
4.1216 + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
4.1217 + \def\pdflink#1{%
4.1218 + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
4.1219 + \linkcolor #1\endlink}
4.1220 + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
4.1221 +\fi % \ifx\pdfoutput
4.1222 +
4.1223 +
4.1224 +\message{fonts,}
4.1225 +% Font-change commands.
4.1226 +
4.1227 +% Texinfo sort of supports the sans serif font style, which plain TeX does not.
4.1228 +% So we set up a \sf analogous to plain's \rm, etc.
4.1229 +\newfam\sffam
4.1230 +\def\sf{\fam=\sffam \tensf}
4.1231 +\let\li = \sf % Sometimes we call it \li, not \sf.
4.1232 +
4.1233 +% We don't need math for this one.
4.1234 +\def\ttsl{\tenttsl}
4.1235 +
4.1236 +% Default leading.
4.1237 +\newdimen\textleading \textleading = 13.2pt
4.1238 +
4.1239 +% Set the baselineskip to #1, and the lineskip and strut size
4.1240 +% correspondingly. There is no deep meaning behind these magic numbers
4.1241 +% used as factors; they just match (closely enough) what Knuth defined.
4.1242 +%
4.1243 +\def\lineskipfactor{.08333}
4.1244 +\def\strutheightpercent{.70833}
4.1245 +\def\strutdepthpercent {.29167}
4.1246 +%
4.1247 +\def\setleading#1{%
4.1248 + \normalbaselineskip = #1\relax
4.1249 + \normallineskip = \lineskipfactor\normalbaselineskip
4.1250 + \normalbaselines
4.1251 + \setbox\strutbox =\hbox{%
4.1252 + \vrule width0pt height\strutheightpercent\baselineskip
4.1253 + depth \strutdepthpercent \baselineskip
4.1254 + }%
4.1255 +}
4.1256 +
4.1257 +% Set the font macro #1 to the font named #2, adding on the
4.1258 +% specified font prefix (normally `cm').
4.1259 +% #3 is the font's design size, #4 is a scale factor
4.1260 +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
4.1261 +
4.1262 +% Use cm as the default font prefix.
4.1263 +% To specify the font prefix, you must define \fontprefix
4.1264 +% before you read in texinfo.tex.
4.1265 +\ifx\fontprefix\undefined
4.1266 +\def\fontprefix{cm}
4.1267 +\fi
4.1268 +% Support font families that don't use the same naming scheme as CM.
4.1269 +\def\rmshape{r}
4.1270 +\def\rmbshape{bx} %where the normal face is bold
4.1271 +\def\bfshape{b}
4.1272 +\def\bxshape{bx}
4.1273 +\def\ttshape{tt}
4.1274 +\def\ttbshape{tt}
4.1275 +\def\ttslshape{sltt}
4.1276 +\def\itshape{ti}
4.1277 +\def\itbshape{bxti}
4.1278 +\def\slshape{sl}
4.1279 +\def\slbshape{bxsl}
4.1280 +\def\sfshape{ss}
4.1281 +\def\sfbshape{ss}
4.1282 +\def\scshape{csc}
4.1283 +\def\scbshape{csc}
4.1284 +
4.1285 +\newcount\mainmagstep
4.1286 +\ifx\bigger\relax
4.1287 + % not really supported.
4.1288 + \mainmagstep=\magstep1
4.1289 + \setfont\textrm\rmshape{12}{1000}
4.1290 + \setfont\texttt\ttshape{12}{1000}
4.1291 +\else
4.1292 + \mainmagstep=\magstephalf
4.1293 + \setfont\textrm\rmshape{10}{\mainmagstep}
4.1294 + \setfont\texttt\ttshape{10}{\mainmagstep}
4.1295 +\fi
4.1296 +% Instead of cmb10, you may want to use cmbx10.
4.1297 +% cmbx10 is a prettier font on its own, but cmb10
4.1298 +% looks better when embedded in a line with cmr10
4.1299 +% (in Bob's opinion).
4.1300 +\setfont\textbf\bfshape{10}{\mainmagstep}
4.1301 +\setfont\textit\itshape{10}{\mainmagstep}
4.1302 +\setfont\textsl\slshape{10}{\mainmagstep}
4.1303 +\setfont\textsf\sfshape{10}{\mainmagstep}
4.1304 +\setfont\textsc\scshape{10}{\mainmagstep}
4.1305 +\setfont\textttsl\ttslshape{10}{\mainmagstep}
4.1306 +\font\texti=cmmi10 scaled \mainmagstep
4.1307 +\font\textsy=cmsy10 scaled \mainmagstep
4.1308 +
4.1309 +% A few fonts for @defun, etc.
4.1310 +\setfont\defbf\bxshape{10}{\magstep1} %was 1314
4.1311 +\setfont\deftt\ttshape{10}{\magstep1}
4.1312 +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
4.1313 +
4.1314 +% Fonts for indices, footnotes, small examples (9pt).
4.1315 +\setfont\smallrm\rmshape{9}{1000}
4.1316 +\setfont\smalltt\ttshape{9}{1000}
4.1317 +\setfont\smallbf\bfshape{10}{900}
4.1318 +\setfont\smallit\itshape{9}{1000}
4.1319 +\setfont\smallsl\slshape{9}{1000}
4.1320 +\setfont\smallsf\sfshape{9}{1000}
4.1321 +\setfont\smallsc\scshape{10}{900}
4.1322 +\setfont\smallttsl\ttslshape{10}{900}
4.1323 +\font\smalli=cmmi9
4.1324 +\font\smallsy=cmsy9
4.1325 +
4.1326 +% Fonts for small examples (8pt).
4.1327 +\setfont\smallerrm\rmshape{8}{1000}
4.1328 +\setfont\smallertt\ttshape{8}{1000}
4.1329 +\setfont\smallerbf\bfshape{10}{800}
4.1330 +\setfont\smallerit\itshape{8}{1000}
4.1331 +\setfont\smallersl\slshape{8}{1000}
4.1332 +\setfont\smallersf\sfshape{8}{1000}
4.1333 +\setfont\smallersc\scshape{10}{800}
4.1334 +\setfont\smallerttsl\ttslshape{10}{800}
4.1335 +\font\smalleri=cmmi8
4.1336 +\font\smallersy=cmsy8
4.1337 +
4.1338 +% Fonts for title page:
4.1339 +\setfont\titlerm\rmbshape{12}{\magstep3}
4.1340 +\setfont\titleit\itbshape{10}{\magstep4}
4.1341 +\setfont\titlesl\slbshape{10}{\magstep4}
4.1342 +\setfont\titlett\ttbshape{12}{\magstep3}
4.1343 +\setfont\titlettsl\ttslshape{10}{\magstep4}
4.1344 +\setfont\titlesf\sfbshape{17}{\magstep1}
4.1345 +\let\titlebf=\titlerm
4.1346 +\setfont\titlesc\scbshape{10}{\magstep4}
4.1347 +\font\titlei=cmmi12 scaled \magstep3
4.1348 +\font\titlesy=cmsy10 scaled \magstep4
4.1349 +\def\authorrm{\secrm}
4.1350 +\def\authortt{\sectt}
4.1351 +
4.1352 +% Chapter (and unnumbered) fonts (17.28pt).
4.1353 +\setfont\chaprm\rmbshape{12}{\magstep2}
4.1354 +\setfont\chapit\itbshape{10}{\magstep3}
4.1355 +\setfont\chapsl\slbshape{10}{\magstep3}
4.1356 +\setfont\chaptt\ttbshape{12}{\magstep2}
4.1357 +\setfont\chapttsl\ttslshape{10}{\magstep3}
4.1358 +\setfont\chapsf\sfbshape{17}{1000}
4.1359 +\let\chapbf=\chaprm
4.1360 +\setfont\chapsc\scbshape{10}{\magstep3}
4.1361 +\font\chapi=cmmi12 scaled \magstep2
4.1362 +\font\chapsy=cmsy10 scaled \magstep3
4.1363 +
4.1364 +% Section fonts (14.4pt).
4.1365 +\setfont\secrm\rmbshape{12}{\magstep1}
4.1366 +\setfont\secit\itbshape{10}{\magstep2}
4.1367 +\setfont\secsl\slbshape{10}{\magstep2}
4.1368 +\setfont\sectt\ttbshape{12}{\magstep1}
4.1369 +\setfont\secttsl\ttslshape{10}{\magstep2}
4.1370 +\setfont\secsf\sfbshape{12}{\magstep1}
4.1371 +\let\secbf\secrm
4.1372 +\setfont\secsc\scbshape{10}{\magstep2}
4.1373 +\font\seci=cmmi12 scaled \magstep1
4.1374 +\font\secsy=cmsy10 scaled \magstep2
4.1375 +
4.1376 +% Subsection fonts (13.15pt).
4.1377 +\setfont\ssecrm\rmbshape{12}{\magstephalf}
4.1378 +\setfont\ssecit\itbshape{10}{1315}
4.1379 +\setfont\ssecsl\slbshape{10}{1315}
4.1380 +\setfont\ssectt\ttbshape{12}{\magstephalf}
4.1381 +\setfont\ssecttsl\ttslshape{10}{1315}
4.1382 +\setfont\ssecsf\sfbshape{12}{\magstephalf}
4.1383 +\let\ssecbf\ssecrm
4.1384 +\setfont\ssecsc\scbshape{10}{\magstep1}
4.1385 +\font\sseci=cmmi12 scaled \magstephalf
4.1386 +\font\ssecsy=cmsy10 scaled 1315
4.1387 +% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
4.1388 +% but that is not a standard magnification.
4.1389 +
4.1390 +% In order for the font changes to affect most math symbols and letters,
4.1391 +% we have to define the \textfont of the standard families. Since
4.1392 +% texinfo doesn't allow for producing subscripts and superscripts except
4.1393 +% in the main text, we don't bother to reset \scriptfont and
4.1394 +% \scriptscriptfont (which would also require loading a lot more fonts).
4.1395 +%
4.1396 +\def\resetmathfonts{%
4.1397 + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
4.1398 + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
4.1399 + \textfont\ttfam=\tentt \textfont\sffam=\tensf
4.1400 +}
4.1401 +
4.1402 +% The font-changing commands redefine the meanings of \tenSTYLE, instead
4.1403 +% of just \STYLE. We do this so that font changes will continue to work
4.1404 +% in math mode, where it is the current \fam that is relevant in most
4.1405 +% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
4.1406 +% \tenbf}, for example. By redefining \tenbf, we obviate the need to
4.1407 +% redefine \bf itself.
4.1408 +\def\textfonts{%
4.1409 + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
4.1410 + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
4.1411 + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
4.1412 + \resetmathfonts \setleading{\textleading}}
4.1413 +\def\titlefonts{%
4.1414 + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
4.1415 + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
4.1416 + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
4.1417 + \let\tenttsl=\titlettsl
4.1418 + \resetmathfonts \setleading{25pt}}
4.1419 +\def\titlefont#1{{\titlefonts\rm #1}}
4.1420 +\def\chapfonts{%
4.1421 + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
4.1422 + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
4.1423 + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
4.1424 + \resetmathfonts \setleading{19pt}}
4.1425 +\def\secfonts{%
4.1426 + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
4.1427 + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
4.1428 + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
4.1429 + \resetmathfonts \setleading{16pt}}
4.1430 +\def\subsecfonts{%
4.1431 + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
4.1432 + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
4.1433 + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
4.1434 + \resetmathfonts \setleading{15pt}}
4.1435 +\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
4.1436 +\def\smallfonts{%
4.1437 + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
4.1438 + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
4.1439 + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
4.1440 + \let\tenttsl=\smallttsl
4.1441 + \resetmathfonts \setleading{10.5pt}}
4.1442 +\def\smallerfonts{%
4.1443 + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
4.1444 + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
4.1445 + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
4.1446 + \let\tenttsl=\smallerttsl
4.1447 + \resetmathfonts \setleading{9.5pt}}
4.1448 +
4.1449 +% Set the fonts to use with the @small... environments.
4.1450 +\let\smallexamplefonts = \smallfonts
4.1451 +
4.1452 +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
4.1453 +% can fit this many characters:
4.1454 +% 8.5x11=86 smallbook=72 a4=90 a5=69
4.1455 +% If we use \smallerfonts (8pt), then we can fit this many characters:
4.1456 +% 8.5x11=90+ smallbook=80 a4=90+ a5=77
4.1457 +% For me, subjectively, the few extra characters that fit aren't worth
4.1458 +% the additional smallness of 8pt. So I'm making the default 9pt.
4.1459 +%
4.1460 +% By the way, for comparison, here's what fits with @example (10pt):
4.1461 +% 8.5x11=71 smallbook=60 a4=75 a5=58
4.1462 +%
4.1463 +% I wish we used A4 paper on this side of the Atlantic.
4.1464 +%
4.1465 +% --karl, 24jan03.
4.1466 +
4.1467 +
4.1468 +% Set up the default fonts, so we can use them for creating boxes.
4.1469 +%
4.1470 +\textfonts
4.1471 +
4.1472 +% Define these so they can be easily changed for other fonts.
4.1473 +\def\angleleft{$\langle$}
4.1474 +\def\angleright{$\rangle$}
4.1475 +
4.1476 +% Count depth in font-changes, for error checks
4.1477 +\newcount\fontdepth \fontdepth=0
4.1478 +
4.1479 +% Fonts for short table of contents.
4.1480 +\setfont\shortcontrm\rmshape{12}{1000}
4.1481 +\setfont\shortcontbf\bxshape{12}{1000}
4.1482 +\setfont\shortcontsl\slshape{12}{1000}
4.1483 +\setfont\shortconttt\ttshape{12}{1000}
4.1484 +
4.1485 +%% Add scribe-like font environments, plus @l for inline lisp (usually sans
4.1486 +%% serif) and @ii for TeX italic
4.1487 +
4.1488 +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
4.1489 +% unless the following character is such as not to need one.
4.1490 +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
4.1491 + \ptexslash\fi\fi\fi}
4.1492 +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
4.1493 +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
4.1494 +
4.1495 +\let\i=\smartitalic
4.1496 +\let\var=\smartslanted
4.1497 +\let\dfn=\smartslanted
4.1498 +\let\emph=\smartitalic
4.1499 +\let\cite=\smartslanted
4.1500 +
4.1501 +\def\b#1{{\bf #1}}
4.1502 +\let\strong=\b
4.1503 +
4.1504 +% We can't just use \exhyphenpenalty, because that only has effect at
4.1505 +% the end of a paragraph. Restore normal hyphenation at the end of the
4.1506 +% group within which \nohyphenation is presumably called.
4.1507 +%
4.1508 +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
4.1509 +\def\restorehyphenation{\hyphenchar\font = `- }
4.1510 +
4.1511 +% Set sfcode to normal for the chars that usually have another value.
4.1512 +% Can't use plain's \frenchspacing because it uses the `\x notation, and
4.1513 +% sometimes \x has an active definition that messes things up.
4.1514 +%
4.1515 +\catcode`@=11
4.1516 + \def\frenchspacing{%
4.1517 + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
4.1518 + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
4.1519 + }
4.1520 +\catcode`@=\other
4.1521 +
4.1522 +\def\t#1{%
4.1523 + {\tt \rawbackslash \frenchspacing #1}%
4.1524 + \null
4.1525 +}
4.1526 +\let\ttfont=\t
4.1527 +\def\samp#1{`\tclose{#1}'\null}
4.1528 +\setfont\keyrm\rmshape{8}{1000}
4.1529 +\font\keysy=cmsy9
4.1530 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
4.1531 + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
4.1532 + \vbox{\hrule\kern-0.4pt
4.1533 + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
4.1534 + \kern-0.4pt\hrule}%
4.1535 + \kern-.06em\raise0.4pt\hbox{\angleright}}}}
4.1536 +% The old definition, with no lozenge:
4.1537 +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
4.1538 +\def\ctrl #1{{\tt \rawbackslash \hat}#1}
4.1539 +
4.1540 +% @file, @option are the same as @samp.
4.1541 +\let\file=\samp
4.1542 +\let\option=\samp
4.1543 +
4.1544 +% @code is a modification of @t,
4.1545 +% which makes spaces the same size as normal in the surrounding text.
4.1546 +\def\tclose#1{%
4.1547 + {%
4.1548 + % Change normal interword space to be same as for the current font.
4.1549 + \spaceskip = \fontdimen2\font
4.1550 + %
4.1551 + % Switch to typewriter.
4.1552 + \tt
4.1553 + %
4.1554 + % But `\ ' produces the large typewriter interword space.
4.1555 + \def\ {{\spaceskip = 0pt{} }}%
4.1556 + %
4.1557 + % Turn off hyphenation.
4.1558 + \nohyphenation
4.1559 + %
4.1560 + \rawbackslash
4.1561 + \frenchspacing
4.1562 + #1%
4.1563 + }%
4.1564 + \null
4.1565 +}
4.1566 +
4.1567 +% We *must* turn on hyphenation at `-' and `_' in \code.
4.1568 +% Otherwise, it is too hard to avoid overfull hboxes
4.1569 +% in the Emacs manual, the Library manual, etc.
4.1570 +
4.1571 +% Unfortunately, TeX uses one parameter (\hyphenchar) to control
4.1572 +% both hyphenation at - and hyphenation within words.
4.1573 +% We must therefore turn them both off (\tclose does that)
4.1574 +% and arrange explicitly to hyphenate at a dash.
4.1575 +% -- rms.
4.1576 +{
4.1577 + \catcode`\-=\active
4.1578 + \catcode`\_=\active
4.1579 + %
4.1580 + \global\def\code{\begingroup
4.1581 + \catcode`\-=\active \let-\codedash
4.1582 + \catcode`\_=\active \let_\codeunder
4.1583 + \codex
4.1584 + }
4.1585 + %
4.1586 + % If we end up with any active - characters when handling the index,
4.1587 + % just treat them as a normal -.
4.1588 + \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
4.1589 +}
4.1590 +
4.1591 +\def\realdash{-}
4.1592 +\def\codedash{-\discretionary{}{}{}}
4.1593 +\def\codeunder{%
4.1594 + % this is all so @math{@code{var_name}+1} can work. In math mode, _
4.1595 + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
4.1596 + % will therefore expand the active definition of _, which is us
4.1597 + % (inside @code that is), therefore an endless loop.
4.1598 + \ifusingtt{\ifmmode
4.1599 + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
4.1600 + \else\normalunderscore \fi
4.1601 + \discretionary{}{}{}}%
4.1602 + {\_}%
4.1603 +}
4.1604 +\def\codex #1{\tclose{#1}\endgroup}
4.1605 +
4.1606 +% @kbd is like @code, except that if the argument is just one @key command,
4.1607 +% then @kbd has no effect.
4.1608 +
4.1609 +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
4.1610 +% `example' (@kbd uses ttsl only inside of @example and friends),
4.1611 +% or `code' (@kbd uses normal tty font always).
4.1612 +\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
4.1613 +\def\kbdinputstylexxx#1{%
4.1614 + \def\arg{#1}%
4.1615 + \ifx\arg\worddistinct
4.1616 + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
4.1617 + \else\ifx\arg\wordexample
4.1618 + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
4.1619 + \else\ifx\arg\wordcode
4.1620 + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
4.1621 + \else
4.1622 + \errhelp = \EMsimple
4.1623 + \errmessage{Unknown @kbdinputstyle option `\arg'}%
4.1624 + \fi\fi\fi
4.1625 +}
4.1626 +\def\worddistinct{distinct}
4.1627 +\def\wordexample{example}
4.1628 +\def\wordcode{code}
4.1629 +
4.1630 +% Default is `distinct.'
4.1631 +\kbdinputstyle distinct
4.1632 +
4.1633 +\def\xkey{\key}
4.1634 +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
4.1635 +\ifx\one\xkey\ifx\threex\three \key{#2}%
4.1636 +\else{\tclose{\kbdfont\look}}\fi
4.1637 +\else{\tclose{\kbdfont\look}}\fi}
4.1638 +
4.1639 +% For @url, @env, @command quotes seem unnecessary, so use \code.
4.1640 +\let\url=\code
4.1641 +\let\env=\code
4.1642 +\let\command=\code
4.1643 +
4.1644 +% @uref (abbreviation for `urlref') takes an optional (comma-separated)
4.1645 +% second argument specifying the text to display and an optional third
4.1646 +% arg as text to display instead of (rather than in addition to) the url
4.1647 +% itself. First (mandatory) arg is the url. Perhaps eventually put in
4.1648 +% a hypertex \special here.
4.1649 +%
4.1650 +\def\uref#1{\douref #1,,,\finish}
4.1651 +\def\douref#1,#2,#3,#4\finish{\begingroup
4.1652 + \unsepspaces
4.1653 + \pdfurl{#1}%
4.1654 + \setbox0 = \hbox{\ignorespaces #3}%
4.1655 + \ifdim\wd0 > 0pt
4.1656 + \unhbox0 % third arg given, show only that
4.1657 + \else
4.1658 + \setbox0 = \hbox{\ignorespaces #2}%
4.1659 + \ifdim\wd0 > 0pt
4.1660 + \ifpdf
4.1661 + \unhbox0 % PDF: 2nd arg given, show only it
4.1662 + \else
4.1663 + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
4.1664 + \fi
4.1665 + \else
4.1666 + \code{#1}% only url given, so show it
4.1667 + \fi
4.1668 + \fi
4.1669 + \endlink
4.1670 +\endgroup}
4.1671 +
4.1672 +% rms does not like angle brackets --karl, 17may97.
4.1673 +% So now @email is just like @uref, unless we are pdf.
4.1674 +%
4.1675 +%\def\email#1{\angleleft{\tt #1}\angleright}
4.1676 +\ifpdf
4.1677 + \def\email#1{\doemail#1,,\finish}
4.1678 + \def\doemail#1,#2,#3\finish{\begingroup
4.1679 + \unsepspaces
4.1680 + \pdfurl{mailto:#1}%
4.1681 + \setbox0 = \hbox{\ignorespaces #2}%
4.1682 + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
4.1683 + \endlink
4.1684 + \endgroup}
4.1685 +\else
4.1686 + \let\email=\uref
4.1687 +\fi
4.1688 +
4.1689 +% Check if we are currently using a typewriter font. Since all the
4.1690 +% Computer Modern typewriter fonts have zero interword stretch (and
4.1691 +% shrink), and it is reasonable to expect all typewriter fonts to have
4.1692 +% this property, we can check that font parameter.
4.1693 +%
4.1694 +\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
4.1695 +
4.1696 +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
4.1697 +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
4.1698 +%
4.1699 +\def\dmn#1{\thinspace #1}
4.1700 +
4.1701 +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
4.1702 +
4.1703 +% @l was never documented to mean ``switch to the Lisp font'',
4.1704 +% and it is not used as such in any manual I can find. We need it for
4.1705 +% Polish suppressed-l. --karl, 22sep96.
4.1706 +%\def\l#1{{\li #1}\null}
4.1707 +
4.1708 +% Explicit font changes: @r, @sc, undocumented @ii.
4.1709 +\def\r#1{{\rm #1}} % roman font
4.1710 +\def\sc#1{{\smallcaps#1}} % smallcaps font
4.1711 +\def\ii#1{{\it #1}} % italic font
4.1712 +
4.1713 +% @acronym downcases the argument and prints in smallcaps.
4.1714 +\def\acronym#1{{\smallcaps \lowercase{#1}}}
4.1715 +
4.1716 +% @pounds{} is a sterling sign.
4.1717 +\def\pounds{{\it\$}}
4.1718 +
4.1719 +% @registeredsymbol - R in a circle. For now, only works in text size;
4.1720 +% we'd have to redo the font mechanism to change the \scriptstyle and
4.1721 +% \scriptscriptstyle font sizes to make it look right in headings.
4.1722 +% Adapted from the plain.tex definition of \copyright.
4.1723 +%
4.1724 +\def\registeredsymbol{%
4.1725 + $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
4.1726 + }$%
4.1727 +}
4.1728 +
4.1729 +
4.1730 +\message{page headings,}
4.1731 +
4.1732 +\newskip\titlepagetopglue \titlepagetopglue = 1.5in
4.1733 +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
4.1734 +
4.1735 +% First the title page. Must do @settitle before @titlepage.
4.1736 +\newif\ifseenauthor
4.1737 +\newif\iffinishedtitlepage
4.1738 +
4.1739 +% Do an implicit @contents or @shortcontents after @end titlepage if the
4.1740 +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
4.1741 +%
4.1742 +\newif\ifsetcontentsaftertitlepage
4.1743 + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
4.1744 +\newif\ifsetshortcontentsaftertitlepage
4.1745 + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
4.1746 +
4.1747 +\def\shorttitlepage{\parsearg\shorttitlepagezzz}
4.1748 +\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
4.1749 + \endgroup\page\hbox{}\page}
4.1750 +
4.1751 +\def\titlepage{\begingroup \parindent=0pt \textfonts
4.1752 + \let\subtitlerm=\tenrm
4.1753 + \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
4.1754 + %
4.1755 + \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
4.1756 + \let\tt=\authortt}%
4.1757 + %
4.1758 + % Leave some space at the very top of the page.
4.1759 + \vglue\titlepagetopglue
4.1760 + %
4.1761 + % Now you can print the title using @title.
4.1762 + \def\title{\parsearg\titlezzz}%
4.1763 + \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
4.1764 + % print a rule at the page bottom also.
4.1765 + \finishedtitlepagefalse
4.1766 + \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
4.1767 + % No rule at page bottom unless we print one at the top with @title.
4.1768 + \finishedtitlepagetrue
4.1769 + %
4.1770 + % Now you can put text using @subtitle.
4.1771 + \def\subtitle{\parsearg\subtitlezzz}%
4.1772 + \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
4.1773 + %
4.1774 + % @author should come last, but may come many times.
4.1775 + \def\author{\parsearg\authorzzz}%
4.1776 + \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
4.1777 + {\authorfont \leftline{##1}}}%
4.1778 + %
4.1779 + % Most title ``pages'' are actually two pages long, with space
4.1780 + % at the top of the second. We don't want the ragged left on the second.
4.1781 + \let\oldpage = \page
4.1782 + \def\page{%
4.1783 + \iffinishedtitlepage\else
4.1784 + \finishtitlepage
4.1785 + \fi
4.1786 + \oldpage
4.1787 + \let\page = \oldpage
4.1788 + \hbox{}}%
4.1789 +% \def\page{\oldpage \hbox{}}
4.1790 +}
4.1791 +
4.1792 +\def\Etitlepage{%
4.1793 + \iffinishedtitlepage\else
4.1794 + \finishtitlepage
4.1795 + \fi
4.1796 + % It is important to do the page break before ending the group,
4.1797 + % because the headline and footline are only empty inside the group.
4.1798 + % If we use the new definition of \page, we always get a blank page
4.1799 + % after the title page, which we certainly don't want.
4.1800 + \oldpage
4.1801 + \endgroup
4.1802 + %
4.1803 + % Need this before the \...aftertitlepage checks so that if they are
4.1804 + % in effect the toc pages will come out with page numbers.
4.1805 + \HEADINGSon
4.1806 + %
4.1807 + % If they want short, they certainly want long too.
4.1808 + \ifsetshortcontentsaftertitlepage
4.1809 + \shortcontents
4.1810 + \contents
4.1811 + \global\let\shortcontents = \relax
4.1812 + \global\let\contents = \relax
4.1813 + \fi
4.1814 + %
4.1815 + \ifsetcontentsaftertitlepage
4.1816 + \contents
4.1817 + \global\let\contents = \relax
4.1818 + \global\let\shortcontents = \relax
4.1819 + \fi
4.1820 +}
4.1821 +
4.1822 +\def\finishtitlepage{%
4.1823 + \vskip4pt \hrule height 2pt width \hsize
4.1824 + \vskip\titlepagebottomglue
4.1825 + \finishedtitlepagetrue
4.1826 +}
4.1827 +
4.1828 +%%% Set up page headings and footings.
4.1829 +
4.1830 +\let\thispage=\folio
4.1831 +
4.1832 +\newtoks\evenheadline % headline on even pages
4.1833 +\newtoks\oddheadline % headline on odd pages
4.1834 +\newtoks\evenfootline % footline on even pages
4.1835 +\newtoks\oddfootline % footline on odd pages
4.1836 +
4.1837 +% Now make Tex use those variables
4.1838 +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
4.1839 + \else \the\evenheadline \fi}}
4.1840 +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
4.1841 + \else \the\evenfootline \fi}\HEADINGShook}
4.1842 +\let\HEADINGShook=\relax
4.1843 +
4.1844 +% Commands to set those variables.
4.1845 +% For example, this is what @headings on does
4.1846 +% @evenheading @thistitle|@thispage|@thischapter
4.1847 +% @oddheading @thischapter|@thispage|@thistitle
4.1848 +% @evenfooting @thisfile||
4.1849 +% @oddfooting ||@thisfile
4.1850 +
4.1851 +\def\evenheading{\parsearg\evenheadingxxx}
4.1852 +\def\oddheading{\parsearg\oddheadingxxx}
4.1853 +\def\everyheading{\parsearg\everyheadingxxx}
4.1854 +
4.1855 +\def\evenfooting{\parsearg\evenfootingxxx}
4.1856 +\def\oddfooting{\parsearg\oddfootingxxx}
4.1857 +\def\everyfooting{\parsearg\everyfootingxxx}
4.1858 +
4.1859 +{\catcode`\@=0 %
4.1860 +
4.1861 +\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
4.1862 +\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
4.1863 +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
4.1864 +
4.1865 +\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
4.1866 +\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
4.1867 +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
4.1868 +
4.1869 +\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
4.1870 +
4.1871 +\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
4.1872 +\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
4.1873 +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
4.1874 +
4.1875 +\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
4.1876 +\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
4.1877 + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
4.1878 + %
4.1879 + % Leave some space for the footline. Hopefully ok to assume
4.1880 + % @evenfooting will not be used by itself.
4.1881 + \global\advance\pageheight by -\baselineskip
4.1882 + \global\advance\vsize by -\baselineskip
4.1883 +}
4.1884 +
4.1885 +\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
4.1886 +%
4.1887 +}% unbind the catcode of @.
4.1888 +
4.1889 +% @headings double turns headings on for double-sided printing.
4.1890 +% @headings single turns headings on for single-sided printing.
4.1891 +% @headings off turns them off.
4.1892 +% @headings on same as @headings double, retained for compatibility.
4.1893 +% @headings after turns on double-sided headings after this page.
4.1894 +% @headings doubleafter turns on double-sided headings after this page.
4.1895 +% @headings singleafter turns on single-sided headings after this page.
4.1896 +% By default, they are off at the start of a document,
4.1897 +% and turned `on' after @end titlepage.
4.1898 +
4.1899 +\def\headings #1 {\csname HEADINGS#1\endcsname}
4.1900 +
4.1901 +\def\HEADINGSoff{
4.1902 +\global\evenheadline={\hfil} \global\evenfootline={\hfil}
4.1903 +\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
4.1904 +\HEADINGSoff
4.1905 +% When we turn headings on, set the page number to 1.
4.1906 +% For double-sided printing, put current file name in lower left corner,
4.1907 +% chapter name on inside top of right hand pages, document
4.1908 +% title on inside top of left hand pages, and page numbers on outside top
4.1909 +% edge of all pages.
4.1910 +\def\HEADINGSdouble{
4.1911 +\global\pageno=1
4.1912 +\global\evenfootline={\hfil}
4.1913 +\global\oddfootline={\hfil}
4.1914 +\global\evenheadline={\line{\folio\hfil\thistitle}}
4.1915 +\global\oddheadline={\line{\thischapter\hfil\folio}}
4.1916 +\global\let\contentsalignmacro = \chapoddpage
4.1917 +}
4.1918 +\let\contentsalignmacro = \chappager
4.1919 +
4.1920 +% For single-sided printing, chapter title goes across top left of page,
4.1921 +% page number on top right.
4.1922 +\def\HEADINGSsingle{
4.1923 +\global\pageno=1
4.1924 +\global\evenfootline={\hfil}
4.1925 +\global\oddfootline={\hfil}
4.1926 +\global\evenheadline={\line{\thischapter\hfil\folio}}
4.1927 +\global\oddheadline={\line{\thischapter\hfil\folio}}
4.1928 +\global\let\contentsalignmacro = \chappager
4.1929 +}
4.1930 +\def\HEADINGSon{\HEADINGSdouble}
4.1931 +
4.1932 +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
4.1933 +\let\HEADINGSdoubleafter=\HEADINGSafter
4.1934 +\def\HEADINGSdoublex{%
4.1935 +\global\evenfootline={\hfil}
4.1936 +\global\oddfootline={\hfil}
4.1937 +\global\evenheadline={\line{\folio\hfil\thistitle}}
4.1938 +\global\oddheadline={\line{\thischapter\hfil\folio}}
4.1939 +\global\let\contentsalignmacro = \chapoddpage
4.1940 +}
4.1941 +
4.1942 +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
4.1943 +\def\HEADINGSsinglex{%
4.1944 +\global\evenfootline={\hfil}
4.1945 +\global\oddfootline={\hfil}
4.1946 +\global\evenheadline={\line{\thischapter\hfil\folio}}
4.1947 +\global\oddheadline={\line{\thischapter\hfil\folio}}
4.1948 +\global\let\contentsalignmacro = \chappager
4.1949 +}
4.1950 +
4.1951 +% Subroutines used in generating headings
4.1952 +% This produces Day Month Year style of output.
4.1953 +% Only define if not already defined, in case a txi-??.tex file has set
4.1954 +% up a different format (e.g., txi-cs.tex does this).
4.1955 +\ifx\today\undefined
4.1956 +\def\today{%
4.1957 + \number\day\space
4.1958 + \ifcase\month
4.1959 + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4.1960 + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4.1961 + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4.1962 + \fi
4.1963 + \space\number\year}
4.1964 +\fi
4.1965 +
4.1966 +% @settitle line... specifies the title of the document, for headings.
4.1967 +% It generates no output of its own.
4.1968 +\def\thistitle{\putwordNoTitle}
4.1969 +\def\settitle{\parsearg\settitlezzz}
4.1970 +\def\settitlezzz #1{\gdef\thistitle{#1}}
4.1971 +
4.1972 +
4.1973 +\message{tables,}
4.1974 +% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
4.1975 +
4.1976 +% default indentation of table text
4.1977 +\newdimen\tableindent \tableindent=.8in
4.1978 +% default indentation of @itemize and @enumerate text
4.1979 +\newdimen\itemindent \itemindent=.3in
4.1980 +% margin between end of table item and start of table text.
4.1981 +\newdimen\itemmargin \itemmargin=.1in
4.1982 +
4.1983 +% used internally for \itemindent minus \itemmargin
4.1984 +\newdimen\itemmax
4.1985 +
4.1986 +% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
4.1987 +% these defs.
4.1988 +% They also define \itemindex
4.1989 +% to index the item name in whatever manner is desired (perhaps none).
4.1990 +
4.1991 +\newif\ifitemxneedsnegativevskip
4.1992 +
4.1993 +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4.1994 +
4.1995 +\def\internalBitem{\smallbreak \parsearg\itemzzz}
4.1996 +\def\internalBitemx{\itemxpar \parsearg\itemzzz}
4.1997 +
4.1998 +\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
4.1999 +\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
4.2000 +
4.2001 +\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
4.2002 +\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
4.2003 +
4.2004 +\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
4.2005 + \itemzzz {#1}}
4.2006 +
4.2007 +\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
4.2008 + \itemzzz {#1}}
4.2009 +
4.2010 +\def\itemzzz #1{\begingroup %
4.2011 + \advance\hsize by -\rightskip
4.2012 + \advance\hsize by -\tableindent
4.2013 + \setbox0=\hbox{\itemfont{#1}}%
4.2014 + \itemindex{#1}%
4.2015 + \nobreak % This prevents a break before @itemx.
4.2016 + %
4.2017 + % If the item text does not fit in the space we have, put it on a line
4.2018 + % by itself, and do not allow a page break either before or after that
4.2019 + % line. We do not start a paragraph here because then if the next
4.2020 + % command is, e.g., @kindex, the whatsit would get put into the
4.2021 + % horizontal list on a line by itself, resulting in extra blank space.
4.2022 + \ifdim \wd0>\itemmax
4.2023 + %
4.2024 + % Make this a paragraph so we get the \parskip glue and wrapping,
4.2025 + % but leave it ragged-right.
4.2026 + \begingroup
4.2027 + \advance\leftskip by-\tableindent
4.2028 + \advance\hsize by\tableindent
4.2029 + \advance\rightskip by0pt plus1fil
4.2030 + \leavevmode\unhbox0\par
4.2031 + \endgroup
4.2032 + %
4.2033 + % We're going to be starting a paragraph, but we don't want the
4.2034 + % \parskip glue -- logically it's part of the @item we just started.
4.2035 + \nobreak \vskip-\parskip
4.2036 + %
4.2037 + % Stop a page break at the \parskip glue coming up. (Unfortunately
4.2038 + % we can't prevent a possible page break at the following
4.2039 + % \baselineskip glue.) However, if what follows is an environment
4.2040 + % such as @example, there will be no \parskip glue; then
4.2041 + % the negative vskip we just would cause the example and the item to
4.2042 + % crash together. So we use this bizarre value of 10001 as a signal
4.2043 + % to \aboveenvbreak to insert \parskip glue after all.
4.2044 + % (Possibly there are other commands that could be followed by
4.2045 + % @example which need the same treatment, but not section titles; or
4.2046 + % maybe section titles are the only special case and they should be
4.2047 + % penalty 10001...)
4.2048 + \penalty 10001
4.2049 + \endgroup
4.2050 + \itemxneedsnegativevskipfalse
4.2051 + \else
4.2052 + % The item text fits into the space. Start a paragraph, so that the
4.2053 + % following text (if any) will end up on the same line.
4.2054 + \noindent
4.2055 + % Do this with kerns and \unhbox so that if there is a footnote in
4.2056 + % the item text, it can migrate to the main vertical list and
4.2057 + % eventually be printed.
4.2058 + \nobreak\kern-\tableindent
4.2059 + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4.2060 + \unhbox0
4.2061 + \nobreak\kern\dimen0
4.2062 + \endgroup
4.2063 + \itemxneedsnegativevskiptrue
4.2064 + \fi
4.2065 +}
4.2066 +
4.2067 +\def\item{\errmessage{@item while not in a table}}
4.2068 +\def\itemx{\errmessage{@itemx while not in a table}}
4.2069 +\def\kitem{\errmessage{@kitem while not in a table}}
4.2070 +\def\kitemx{\errmessage{@kitemx while not in a table}}
4.2071 +\def\xitem{\errmessage{@xitem while not in a table}}
4.2072 +\def\xitemx{\errmessage{@xitemx while not in a table}}
4.2073 +
4.2074 +% Contains a kludge to get @end[description] to work.
4.2075 +\def\description{\tablez{\dontindex}{1}{}{}{}{}}
4.2076 +
4.2077 +% @table, @ftable, @vtable.
4.2078 +\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
4.2079 +{\obeylines\obeyspaces%
4.2080 +\gdef\tablex #1^^M{%
4.2081 +\tabley\dontindex#1 \endtabley}}
4.2082 +
4.2083 +\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
4.2084 +{\obeylines\obeyspaces%
4.2085 +\gdef\ftablex #1^^M{%
4.2086 +\tabley\fnitemindex#1 \endtabley
4.2087 +\def\Eftable{\endgraf\afterenvbreak\endgroup}%
4.2088 +\let\Etable=\relax}}
4.2089 +
4.2090 +\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
4.2091 +{\obeylines\obeyspaces%
4.2092 +\gdef\vtablex #1^^M{%
4.2093 +\tabley\vritemindex#1 \endtabley
4.2094 +\def\Evtable{\endgraf\afterenvbreak\endgroup}%
4.2095 +\let\Etable=\relax}}
4.2096 +
4.2097 +\def\dontindex #1{}
4.2098 +\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
4.2099 +\def\vritemindex #1{\doind {vr}{\code{#1}}}%
4.2100 +
4.2101 +{\obeyspaces %
4.2102 +\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
4.2103 +\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
4.2104 +
4.2105 +\def\tablez #1#2#3#4#5#6{%
4.2106 +\aboveenvbreak %
4.2107 +\begingroup %
4.2108 +\def\Edescription{\Etable}% Necessary kludge.
4.2109 +\let\itemindex=#1%
4.2110 +\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
4.2111 +\ifnum 0#4>0 \tableindent=#4\mil \fi %
4.2112 +\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
4.2113 +\def\itemfont{#2}%
4.2114 +\itemmax=\tableindent %
4.2115 +\advance \itemmax by -\itemmargin %
4.2116 +\advance \leftskip by \tableindent %
4.2117 +\exdentamount=\tableindent
4.2118 +\parindent = 0pt
4.2119 +\parskip = \smallskipamount
4.2120 +\ifdim \parskip=0pt \parskip=2pt \fi%
4.2121 +\def\Etable{\endgraf\afterenvbreak\endgroup}%
4.2122 +\let\item = \internalBitem %
4.2123 +\let\itemx = \internalBitemx %
4.2124 +\let\kitem = \internalBkitem %
4.2125 +\let\kitemx = \internalBkitemx %
4.2126 +\let\xitem = \internalBxitem %
4.2127 +\let\xitemx = \internalBxitemx %
4.2128 +}
4.2129 +
4.2130 +% This is the counter used by @enumerate, which is really @itemize
4.2131 +
4.2132 +\newcount \itemno
4.2133 +
4.2134 +\def\itemize{\parsearg\itemizezzz}
4.2135 +
4.2136 +\def\itemizezzz #1{%
4.2137 + \begingroup % ended by the @end itemize
4.2138 + \itemizey {#1}{\Eitemize}
4.2139 +}
4.2140 +
4.2141 +\def\itemizey#1#2{%
4.2142 + \aboveenvbreak
4.2143 + \itemmax=\itemindent
4.2144 + \advance\itemmax by -\itemmargin
4.2145 + \advance\leftskip by \itemindent
4.2146 + \exdentamount=\itemindent
4.2147 + \parindent=0pt
4.2148 + \parskip=\smallskipamount
4.2149 + \ifdim\parskip=0pt \parskip=2pt \fi
4.2150 + \def#2{\endgraf\afterenvbreak\endgroup}%
4.2151 + \def\itemcontents{#1}%
4.2152 + % @itemize with no arg is equivalent to @itemize @bullet.
4.2153 + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4.2154 + \let\item=\itemizeitem
4.2155 +}
4.2156 +
4.2157 +% \splitoff TOKENS\endmark defines \first to be the first token in
4.2158 +% TOKENS, and \rest to be the remainder.
4.2159 +%
4.2160 +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4.2161 +
4.2162 +% Allow an optional argument of an uppercase letter, lowercase letter,
4.2163 +% or number, to specify the first label in the enumerated list. No
4.2164 +% argument is the same as `1'.
4.2165 +%
4.2166 +\def\enumerate{\parsearg\enumeratezzz}
4.2167 +\def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
4.2168 +\def\enumeratey #1 #2\endenumeratey{%
4.2169 + \begingroup % ended by the @end enumerate
4.2170 + %
4.2171 + % If we were given no argument, pretend we were given `1'.
4.2172 + \def\thearg{#1}%
4.2173 + \ifx\thearg\empty \def\thearg{1}\fi
4.2174 + %
4.2175 + % Detect if the argument is a single token. If so, it might be a
4.2176 + % letter. Otherwise, the only valid thing it can be is a number.
4.2177 + % (We will always have one token, because of the test we just made.
4.2178 + % This is a good thing, since \splitoff doesn't work given nothing at
4.2179 + % all -- the first parameter is undelimited.)
4.2180 + \expandafter\splitoff\thearg\endmark
4.2181 + \ifx\rest\empty
4.2182 + % Only one token in the argument. It could still be anything.
4.2183 + % A ``lowercase letter'' is one whose \lccode is nonzero.
4.2184 + % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4.2185 + % not equal to itself.
4.2186 + % Otherwise, we assume it's a number.
4.2187 + %
4.2188 + % We need the \relax at the end of the \ifnum lines to stop TeX from
4.2189 + % continuing to look for a <number>.
4.2190 + %
4.2191 + \ifnum\lccode\expandafter`\thearg=0\relax
4.2192 + \numericenumerate % a number (we hope)
4.2193 + \else
4.2194 + % It's a letter.
4.2195 + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4.2196 + \lowercaseenumerate % lowercase letter
4.2197 + \else
4.2198 + \uppercaseenumerate % uppercase letter
4.2199 + \fi
4.2200 + \fi
4.2201 + \else
4.2202 + % Multiple tokens in the argument. We hope it's a number.
4.2203 + \numericenumerate
4.2204 + \fi
4.2205 +}
4.2206 +
4.2207 +% An @enumerate whose labels are integers. The starting integer is
4.2208 +% given in \thearg.
4.2209 +%
4.2210 +\def\numericenumerate{%
4.2211 + \itemno = \thearg
4.2212 + \startenumeration{\the\itemno}%
4.2213 +}
4.2214 +
4.2215 +% The starting (lowercase) letter is in \thearg.
4.2216 +\def\lowercaseenumerate{%
4.2217 + \itemno = \expandafter`\thearg
4.2218 + \startenumeration{%
4.2219 + % Be sure we're not beyond the end of the alphabet.
4.2220 + \ifnum\itemno=0
4.2221 + \errmessage{No more lowercase letters in @enumerate; get a bigger
4.2222 + alphabet}%
4.2223 + \fi
4.2224 + \char\lccode\itemno
4.2225 + }%
4.2226 +}
4.2227 +
4.2228 +% The starting (uppercase) letter is in \thearg.
4.2229 +\def\uppercaseenumerate{%
4.2230 + \itemno = \expandafter`\thearg
4.2231 + \startenumeration{%
4.2232 + % Be sure we're not beyond the end of the alphabet.
4.2233 + \ifnum\itemno=0
4.2234 + \errmessage{No more uppercase letters in @enumerate; get a bigger
4.2235 + alphabet}
4.2236 + \fi
4.2237 + \char\uccode\itemno
4.2238 + }%
4.2239 +}
4.2240 +
4.2241 +% Call itemizey, adding a period to the first argument and supplying the
4.2242 +% common last two arguments. Also subtract one from the initial value in
4.2243 +% \itemno, since @item increments \itemno.
4.2244 +%
4.2245 +\def\startenumeration#1{%
4.2246 + \advance\itemno by -1
4.2247 + \itemizey{#1.}\Eenumerate\flushcr
4.2248 +}
4.2249 +
4.2250 +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
4.2251 +% to @enumerate.
4.2252 +%
4.2253 +\def\alphaenumerate{\enumerate{a}}
4.2254 +\def\capsenumerate{\enumerate{A}}
4.2255 +\def\Ealphaenumerate{\Eenumerate}
4.2256 +\def\Ecapsenumerate{\Eenumerate}
4.2257 +
4.2258 +% Definition of @item while inside @itemize.
4.2259 +
4.2260 +\def\itemizeitem{%
4.2261 +\advance\itemno by 1
4.2262 +{\let\par=\endgraf \smallbreak}%
4.2263 +\ifhmode \errmessage{In hmode at itemizeitem}\fi
4.2264 +{\parskip=0in \hskip 0pt
4.2265 +\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
4.2266 +\vadjust{\penalty 1200}}%
4.2267 +\flushcr}
4.2268 +
4.2269 +% @multitable macros
4.2270 +% Amy Hendrickson, 8/18/94, 3/6/96
4.2271 +%
4.2272 +% @multitable ... @end multitable will make as many columns as desired.
4.2273 +% Contents of each column will wrap at width given in preamble. Width
4.2274 +% can be specified either with sample text given in a template line,
4.2275 +% or in percent of \hsize, the current width of text on page.
4.2276 +
4.2277 +% Table can continue over pages but will only break between lines.
4.2278 +
4.2279 +% To make preamble:
4.2280 +%
4.2281 +% Either define widths of columns in terms of percent of \hsize:
4.2282 +% @multitable @columnfractions .25 .3 .45
4.2283 +% @item ...
4.2284 +%
4.2285 +% Numbers following @columnfractions are the percent of the total
4.2286 +% current hsize to be used for each column. You may use as many
4.2287 +% columns as desired.
4.2288 +
4.2289 +
4.2290 +% Or use a template:
4.2291 +% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4.2292 +% @item ...
4.2293 +% using the widest term desired in each column.
4.2294 +%
4.2295 +% For those who want to use more than one line's worth of words in
4.2296 +% the preamble, break the line within one argument and it
4.2297 +% will parse correctly, i.e.,
4.2298 +%
4.2299 +% @multitable {Column 1 template} {Column 2 template} {Column 3
4.2300 +% template}
4.2301 +% Not:
4.2302 +% @multitable {Column 1 template} {Column 2 template}
4.2303 +% {Column 3 template}
4.2304 +
4.2305 +% Each new table line starts with @item, each subsequent new column
4.2306 +% starts with @tab. Empty columns may be produced by supplying @tab's
4.2307 +% with nothing between them for as many times as empty columns are needed,
4.2308 +% ie, @tab@tab@tab will produce two empty columns.
4.2309 +
4.2310 +% @item, @tab, @multitable or @end multitable do not need to be on their
4.2311 +% own lines, but it will not hurt if they are.
4.2312 +
4.2313 +% Sample multitable:
4.2314 +
4.2315 +% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4.2316 +% @item first col stuff @tab second col stuff @tab third col
4.2317 +% @item
4.2318 +% first col stuff
4.2319 +% @tab
4.2320 +% second col stuff
4.2321 +% @tab
4.2322 +% third col
4.2323 +% @item first col stuff @tab second col stuff
4.2324 +% @tab Many paragraphs of text may be used in any column.
4.2325 +%
4.2326 +% They will wrap at the width determined by the template.
4.2327 +% @item@tab@tab This will be in third column.
4.2328 +% @end multitable
4.2329 +
4.2330 +% Default dimensions may be reset by user.
4.2331 +% @multitableparskip is vertical space between paragraphs in table.
4.2332 +% @multitableparindent is paragraph indent in table.
4.2333 +% @multitablecolmargin is horizontal space to be left between columns.
4.2334 +% @multitablelinespace is space to leave between table items, baseline
4.2335 +% to baseline.
4.2336 +% 0pt means it depends on current normal line spacing.
4.2337 +%
4.2338 +\newskip\multitableparskip
4.2339 +\newskip\multitableparindent
4.2340 +\newdimen\multitablecolspace
4.2341 +\newskip\multitablelinespace
4.2342 +\multitableparskip=0pt
4.2343 +\multitableparindent=6pt
4.2344 +\multitablecolspace=12pt
4.2345 +\multitablelinespace=0pt
4.2346 +
4.2347 +% Macros used to set up halign preamble:
4.2348 +%
4.2349 +\let\endsetuptable\relax
4.2350 +\def\xendsetuptable{\endsetuptable}
4.2351 +\let\columnfractions\relax
4.2352 +\def\xcolumnfractions{\columnfractions}
4.2353 +\newif\ifsetpercent
4.2354 +
4.2355 +% #1 is the part of the @columnfraction before the decimal point, which
4.2356 +% is presumably either 0 or the empty string (but we don't check, we
4.2357 +% just throw it away). #2 is the decimal part, which we use as the
4.2358 +% percent of \hsize for this column.
4.2359 +\def\pickupwholefraction#1.#2 {%
4.2360 + \global\advance\colcount by 1
4.2361 + \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
4.2362 + \setuptable
4.2363 +}
4.2364 +
4.2365 +\newcount\colcount
4.2366 +\def\setuptable#1{%
4.2367 + \def\firstarg{#1}%
4.2368 + \ifx\firstarg\xendsetuptable
4.2369 + \let\go = \relax
4.2370 + \else
4.2371 + \ifx\firstarg\xcolumnfractions
4.2372 + \global\setpercenttrue
4.2373 + \else
4.2374 + \ifsetpercent
4.2375 + \let\go\pickupwholefraction
4.2376 + \else
4.2377 + \global\advance\colcount by 1
4.2378 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4.2379 + % separator; typically that is always in the input, anyway.
4.2380 + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4.2381 + \fi
4.2382 + \fi
4.2383 + \ifx\go\pickupwholefraction
4.2384 + % Put the argument back for the \pickupwholefraction call, so
4.2385 + % we'll always have a period there to be parsed.
4.2386 + \def\go{\pickupwholefraction#1}%
4.2387 + \else
4.2388 + \let\go = \setuptable
4.2389 + \fi%
4.2390 + \fi
4.2391 + \go
4.2392 +}
4.2393 +
4.2394 +% @multitable ... @end multitable definitions:
4.2395 +%
4.2396 +\def\multitable{\parsearg\dotable}
4.2397 +\def\dotable#1{\bgroup
4.2398 + \vskip\parskip
4.2399 + \let\item=\crcrwithfootnotes
4.2400 + % A \tab used to include \hskip1sp. But then the space in a template
4.2401 + % line is not enough. That is bad. So let's go back to just & until
4.2402 + % we encounter the problem it was intended to solve again. --karl,
4.2403 + % nathan@acm.org, 20apr99.
4.2404 + \let\tab=&%
4.2405 + \let\startfootins=\startsavedfootnote
4.2406 + \tolerance=9500
4.2407 + \hbadness=9500
4.2408 + \setmultitablespacing
4.2409 + \parskip=\multitableparskip
4.2410 + \parindent=\multitableparindent
4.2411 + \overfullrule=0pt
4.2412 + \global\colcount=0
4.2413 + \def\Emultitable{%
4.2414 + \global\setpercentfalse
4.2415 + \crcrwithfootnotes\crcr
4.2416 + \egroup\egroup
4.2417 + }%
4.2418 + %
4.2419 + % To parse everything between @multitable and @item:
4.2420 + \setuptable#1 \endsetuptable
4.2421 + %
4.2422 + % \everycr will reset column counter, \colcount, at the end of
4.2423 + % each line. Every column entry will cause \colcount to advance by one.
4.2424 + % The table preamble
4.2425 + % looks at the current \colcount to find the correct column width.
4.2426 + \everycr{\noalign{%
4.2427 + %
4.2428 + % \filbreak%% keeps underfull box messages off when table breaks over pages.
4.2429 + % Maybe so, but it also creates really weird page breaks when the table
4.2430 + % breaks over pages. Wouldn't \vfil be better? Wait until the problem
4.2431 + % manifests itself, so it can be fixed for real --karl.
4.2432 + \global\colcount=0\relax}}%
4.2433 + %
4.2434 + % This preamble sets up a generic column definition, which will
4.2435 + % be used as many times as user calls for columns.
4.2436 + % \vtop will set a single line and will also let text wrap and
4.2437 + % continue for many paragraphs if desired.
4.2438 + \halign\bgroup&\global\advance\colcount by 1\relax
4.2439 + \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
4.2440 + %
4.2441 + % In order to keep entries from bumping into each other
4.2442 + % we will add a \leftskip of \multitablecolspace to all columns after
4.2443 + % the first one.
4.2444 + %
4.2445 + % If a template has been used, we will add \multitablecolspace
4.2446 + % to the width of each template entry.
4.2447 + %
4.2448 + % If the user has set preamble in terms of percent of \hsize we will
4.2449 + % use that dimension as the width of the column, and the \leftskip
4.2450 + % will keep entries from bumping into each other. Table will start at
4.2451 + % left margin and final column will justify at right margin.
4.2452 + %
4.2453 + % Make sure we don't inherit \rightskip from the outer environment.
4.2454 + \rightskip=0pt
4.2455 + \ifnum\colcount=1
4.2456 + % The first column will be indented with the surrounding text.
4.2457 + \advance\hsize by\leftskip
4.2458 + \else
4.2459 + \ifsetpercent \else
4.2460 + % If user has not set preamble in terms of percent of \hsize
4.2461 + % we will advance \hsize by \multitablecolspace.
4.2462 + \advance\hsize by \multitablecolspace
4.2463 + \fi
4.2464 + % In either case we will make \leftskip=\multitablecolspace:
4.2465 + \leftskip=\multitablecolspace
4.2466 + \fi
4.2467 + % Ignoring space at the beginning and end avoids an occasional spurious
4.2468 + % blank line, when TeX decides to break the line at the space before the
4.2469 + % box from the multistrut, so the strut ends up on a line by itself.
4.2470 + % For example:
4.2471 + % @multitable @columnfractions .11 .89
4.2472 + % @item @code{#}
4.2473 + % @tab Legal holiday which is valid in major parts of the whole country.
4.2474 + % Is automatically provided with highlighting sequences respectively marking
4.2475 + % characters.
4.2476 + \noindent\ignorespaces##\unskip\multistrut}\cr
4.2477 +}
4.2478 +
4.2479 +\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
4.2480 +% If so, do nothing. If not, give it an appropriate dimension based on
4.2481 +% current baselineskip.
4.2482 +\ifdim\multitablelinespace=0pt
4.2483 +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4.2484 +\global\advance\multitablelinespace by-\ht0
4.2485 +%% strut to put in table in case some entry doesn't have descenders,
4.2486 +%% to keep lines equally spaced
4.2487 +\let\multistrut = \strut
4.2488 +\else
4.2489 +%% FIXME: what is \box0 supposed to be?
4.2490 +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
4.2491 +width0pt\relax} \fi
4.2492 +%% Test to see if parskip is larger than space between lines of
4.2493 +%% table. If not, do nothing.
4.2494 +%% If so, set to same dimension as multitablelinespace.
4.2495 +\ifdim\multitableparskip>\multitablelinespace
4.2496 +\global\multitableparskip=\multitablelinespace
4.2497 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
4.2498 + %% than skip between lines in the table.
4.2499 +\fi%
4.2500 +\ifdim\multitableparskip=0pt
4.2501 +\global\multitableparskip=\multitablelinespace
4.2502 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
4.2503 + %% than skip between lines in the table.
4.2504 +\fi}
4.2505 +
4.2506 +% In case a @footnote appears inside an alignment, save the footnote
4.2507 +% text to a box and make the \insert when a row of the table is
4.2508 +% finished. Otherwise, the insertion is lost, it never migrates to the
4.2509 +% main vertical list. --kasal, 22jan03.
4.2510 +%
4.2511 +\newbox\savedfootnotes
4.2512 +%
4.2513 +% \dotable \let's \startfootins to this, so that \dofootnote will call
4.2514 +% it instead of starting the insertion right away.
4.2515 +\def\startsavedfootnote{%
4.2516 + \global\setbox\savedfootnotes = \vbox\bgroup
4.2517 + \unvbox\savedfootnotes
4.2518 +}
4.2519 +\def\crcrwithfootnotes{%
4.2520 + \crcr
4.2521 + \ifvoid\savedfootnotes \else
4.2522 + \noalign{\insert\footins{\box\savedfootnotes}}%
4.2523 + \fi
4.2524 +}
4.2525 +
4.2526 +\message{conditionals,}
4.2527 +% Prevent errors for section commands.
4.2528 +% Used in @ignore and in failing conditionals.
4.2529 +\def\ignoresections{%
4.2530 + \let\appendix=\relax
4.2531 + \let\appendixsec=\relax
4.2532 + \let\appendixsection=\relax
4.2533 + \let\appendixsubsec=\relax
4.2534 + \let\appendixsubsection=\relax
4.2535 + \let\appendixsubsubsec=\relax
4.2536 + \let\appendixsubsubsection=\relax
4.2537 + %\let\begin=\relax
4.2538 + %\let\bye=\relax
4.2539 + \let\centerchap=\relax
4.2540 + \let\chapter=\relax
4.2541 + \let\contents=\relax
4.2542 + \let\section=\relax
4.2543 + \let\smallbook=\relax
4.2544 + \let\subsec=\relax
4.2545 + \let\subsection=\relax
4.2546 + \let\subsubsec=\relax
4.2547 + \let\subsubsection=\relax
4.2548 + \let\titlepage=\relax
4.2549 + \let\top=\relax
4.2550 + \let\unnumbered=\relax
4.2551 + \let\unnumberedsec=\relax
4.2552 + \let\unnumberedsection=\relax
4.2553 + \let\unnumberedsubsec=\relax
4.2554 + \let\unnumberedsubsection=\relax
4.2555 + \let\unnumberedsubsubsec=\relax
4.2556 + \let\unnumberedsubsubsection=\relax
4.2557 +}
4.2558 +
4.2559 +% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4.2560 +%
4.2561 +\def\direntry{\doignore{direntry}}
4.2562 +\def\documentdescriptionword{documentdescription}
4.2563 +\def\documentdescription{\doignore{documentdescription}}
4.2564 +\def\html{\doignore{html}}
4.2565 +\def\ifhtml{\doignore{ifhtml}}
4.2566 +\def\ifinfo{\doignore{ifinfo}}
4.2567 +\def\ifnottex{\doignore{ifnottex}}
4.2568 +\def\ifplaintext{\doignore{ifplaintext}}
4.2569 +\def\ifxml{\doignore{ifxml}}
4.2570 +\def\ignore{\doignore{ignore}}
4.2571 +\def\menu{\doignore{menu}}
4.2572 +\def\xml{\doignore{xml}}
4.2573 +
4.2574 +% @dircategory CATEGORY -- specify a category of the dir file
4.2575 +% which this file should belong to. Ignore this in TeX.
4.2576 +\let\dircategory = \comment
4.2577 +
4.2578 +% Ignore text until a line `@end #1', keeping track of nested conditionals.
4.2579 +%
4.2580 +% A count to remember the depth of nesting.
4.2581 +\newcount\doignorecount \doignorecount = 0
4.2582 +
4.2583 +\def\doignore#1{\begingroup
4.2584 + % Don't complain about control sequences we have declared \outer.
4.2585 + \ignoresections
4.2586 + %
4.2587 + % Make sure that spaces turn into tokens that match what \doignoretext wants.
4.2588 + \catcode\spaceChar = 10
4.2589 + %
4.2590 + % Ignore braces, so mismatched braces don't cause trouble.
4.2591 + \catcode`\{ = 9
4.2592 + \catcode`\} = 9
4.2593 + %
4.2594 + % Count number of #1's that we've seen.
4.2595 + \doignorecount = 0
4.2596 + %
4.2597 + % Swallow text until we reach the matching `@end #1'.
4.2598 + \expandafter \dodoignore \csname#1\endcsname {#1}%
4.2599 +}
4.2600 +
4.2601 +{ \catcode`@=11 % We want to use \ST@P which cannot appear in texinfo source.
4.2602 + \obeylines %
4.2603 + %
4.2604 + \gdef\dodoignore#1#2{%
4.2605 + % #1 contains, e.g., \ifinfo, a.k.a. @ifinfo.
4.2606 + % #2 contains the string `ifinfo'.
4.2607 + %
4.2608 + % Define a command to find the next `@end #2', which must be on a line
4.2609 + % by itself.
4.2610 + \long\def\doignoretext##1^^M\end #2{\doignoretextyyy##1^^M#1\ST@P}%
4.2611 + % And this command to find another #1 command, at the beginning of a
4.2612 + % line. (Otherwise, we would consider a line `@c @ifset', for
4.2613 + % example, to count as an @ifset for nesting.)
4.2614 + \long\def\doignoretextyyy##1^^M#1##2\ST@P{\doignoreyyy{##2}\ST@P}%
4.2615 + %
4.2616 + % And now expand that command.
4.2617 + \obeylines %
4.2618 + \doignoretext ^^M%
4.2619 + }%
4.2620 +}
4.2621 +
4.2622 +\def\doignoreyyy#1{%
4.2623 + \def\temp{#1}%
4.2624 + \ifx\temp\empty % Nothing found.
4.2625 + \let\next\doignoretextzzz
4.2626 + \else % Found a nested condition, ...
4.2627 + \advance\doignorecount by 1
4.2628 + \let\next\doignoretextyyy % ..., look for another.
4.2629 + % If we're here, #1 ends with \ifinfo (for example).
4.2630 + \fi
4.2631 + \next #1% the token \ST@P is present just after this macro.
4.2632 +}
4.2633 +
4.2634 +% We have to swallow the remaining "\ST@P".
4.2635 +%
4.2636 +\def\doignoretextzzz#1{%
4.2637 + \ifnum\doignorecount = 0 % We have just found the outermost @end.
4.2638 + \let\next\enddoignore
4.2639 + \else % Still inside a nested condition.
4.2640 + \advance\doignorecount by -1
4.2641 + \let\next\doignoretext % Look for the next @end.
4.2642 + \fi
4.2643 + \next
4.2644 +}
4.2645 +
4.2646 +% Finish off ignored text.
4.2647 +\def\enddoignore{\endgroup\ignorespaces}
4.2648 +
4.2649 +
4.2650 +% @set VAR sets the variable VAR to an empty value.
4.2651 +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4.2652 +%
4.2653 +% Since we want to separate VAR from REST-OF-LINE (which might be
4.2654 +% empty), we can't just use \parsearg; we have to insert a space of our
4.2655 +% own to delimit the rest of the line, and then take it out again if we
4.2656 +% didn't need it. Make sure the catcode of space is correct to avoid
4.2657 +% losing inside @example, for instance.
4.2658 +%
4.2659 +\def\set{\begingroup\catcode` =10
4.2660 + \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
4.2661 + \parsearg\setxxx}
4.2662 +\def\setxxx#1{\setyyy#1 \endsetyyy}
4.2663 +\def\setyyy#1 #2\endsetyyy{%
4.2664 + \def\temp{#2}%
4.2665 + \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
4.2666 + \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
4.2667 + \fi
4.2668 + \endgroup
4.2669 +}
4.2670 +% Can't use \xdef to pre-expand #2 and save some time, since \temp or
4.2671 +% \next or other control sequences that we've defined might get us into
4.2672 +% an infinite loop. Consider `@set foo @cite{bar}'.
4.2673 +\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
4.2674 +
4.2675 +% @clear VAR clears (i.e., unsets) the variable VAR.
4.2676 +%
4.2677 +\def\clear{\parsearg\clearxxx}
4.2678 +\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
4.2679 +
4.2680 +% @value{foo} gets the text saved in variable foo.
4.2681 +{
4.2682 + \catcode`\_ = \active
4.2683 + %
4.2684 + % We might end up with active _ or - characters in the argument if
4.2685 + % we're called from @code, as @code{@value{foo-bar_}}. So \let any
4.2686 + % such active characters to their normal equivalents.
4.2687 + \gdef\value{\begingroup
4.2688 + \catcode`\-=\other \catcode`\_=\other
4.2689 + \indexbreaks \let_\normalunderscore
4.2690 + \valuexxx}
4.2691 +}
4.2692 +\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4.2693 +
4.2694 +% We have this subroutine so that we can handle at least some @value's
4.2695 +% properly in indexes (we \let\value to this in \indexdummies). Ones
4.2696 +% whose names contain - or _ still won't work, but we can't do anything
4.2697 +% about that. The command has to be fully expandable (if the variable
4.2698 +% is set), since the result winds up in the index file. This means that
4.2699 +% if the variable's value contains other Texinfo commands, it's almost
4.2700 +% certain it will fail (although perhaps we could fix that with
4.2701 +% sufficient work to do a one-level expansion on the result, instead of
4.2702 +% complete).
4.2703 +%
4.2704 +\def\expandablevalue#1{%
4.2705 + \expandafter\ifx\csname SET#1\endcsname\relax
4.2706 + {[No value for ``#1'']}%
4.2707 + \message{Variable `#1', used in @value, is not set.}%
4.2708 + \else
4.2709 + \csname SET#1\endcsname
4.2710 + \fi
4.2711 +}
4.2712 +
4.2713 +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4.2714 +% with @set.
4.2715 +%
4.2716 +\def\ifset{\parsearg\doifset}
4.2717 +\def\doifset#1{%
4.2718 + \expandafter\ifx\csname SET#1\endcsname\relax
4.2719 + \let\next=\ifsetfail
4.2720 + \else
4.2721 + \let\next=\ifsetsucceed
4.2722 + \fi
4.2723 + \next
4.2724 +}
4.2725 +\def\ifsetsucceed{\conditionalsucceed{ifset}}
4.2726 +\def\ifsetfail{\doignore{ifset}}
4.2727 +\defineunmatchedend{ifset}
4.2728 +
4.2729 +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
4.2730 +% defined with @set, or has been undefined with @clear.
4.2731 +%
4.2732 +\def\ifclear{\parsearg\doifclear}
4.2733 +\def\doifclear#1{%
4.2734 + \expandafter\ifx\csname SET#1\endcsname\relax
4.2735 + \let\next=\ifclearsucceed
4.2736 + \else
4.2737 + \let\next=\ifclearfail
4.2738 + \fi
4.2739 + \next
4.2740 +}
4.2741 +\def\ifclearsucceed{\conditionalsucceed{ifclear}}
4.2742 +\def\ifclearfail{\doignore{ifclear}}
4.2743 +\defineunmatchedend{ifclear}
4.2744 +
4.2745 +% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
4.2746 +% read the text following, through the first @end iftex (etc.). Make
4.2747 +% `@end iftex' (etc.) valid only after an @iftex.
4.2748 +%
4.2749 +\def\iftex{\conditionalsucceed{iftex}}
4.2750 +\def\ifnothtml{\conditionalsucceed{ifnothtml}}
4.2751 +\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
4.2752 +\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
4.2753 +\defineunmatchedend{iftex}
4.2754 +\defineunmatchedend{ifnothtml}
4.2755 +\defineunmatchedend{ifnotinfo}
4.2756 +\defineunmatchedend{ifnotplaintext}
4.2757 +
4.2758 +% True conditional. Since \set globally defines its variables, we can
4.2759 +% just start and end a group (to keep the @end definition undefined at
4.2760 +% the outer level).
4.2761 +%
4.2762 +\def\conditionalsucceed#1{\begingroup
4.2763 + \expandafter\def\csname E#1\endcsname{\endgroup}%
4.2764 +}
4.2765 +
4.2766 +% @defininfoenclose.
4.2767 +\let\definfoenclose=\comment
4.2768 +
4.2769 +
4.2770 +\message{indexing,}
4.2771 +% Index generation facilities
4.2772 +
4.2773 +% Define \newwrite to be identical to plain tex's \newwrite
4.2774 +% except not \outer, so it can be used within \newindex.
4.2775 +{\catcode`\@=11
4.2776 +\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
4.2777 +
4.2778 +% \newindex {foo} defines an index named foo.
4.2779 +% It automatically defines \fooindex such that
4.2780 +% \fooindex ...rest of line... puts an entry in the index foo.
4.2781 +% It also defines \fooindfile to be the number of the output channel for
4.2782 +% the file that accumulates this index. The file's extension is foo.
4.2783 +% The name of an index should be no more than 2 characters long
4.2784 +% for the sake of vms.
4.2785 +%
4.2786 +\def\newindex#1{%
4.2787 + \iflinks
4.2788 + \expandafter\newwrite \csname#1indfile\endcsname
4.2789 + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
4.2790 + \fi
4.2791 + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4.2792 + \noexpand\doindex{#1}}
4.2793 +}
4.2794 +
4.2795 +% @defindex foo == \newindex{foo}
4.2796 +%
4.2797 +\def\defindex{\parsearg\newindex}
4.2798 +
4.2799 +% Define @defcodeindex, like @defindex except put all entries in @code.
4.2800 +%
4.2801 +\def\defcodeindex{\parsearg\newcodeindex}
4.2802 +%
4.2803 +\def\newcodeindex#1{%
4.2804 + \iflinks
4.2805 + \expandafter\newwrite \csname#1indfile\endcsname
4.2806 + \openout \csname#1indfile\endcsname \jobname.#1
4.2807 + \fi
4.2808 + \expandafter\xdef\csname#1index\endcsname{%
4.2809 + \noexpand\docodeindex{#1}}%
4.2810 +}
4.2811 +
4.2812 +
4.2813 +% @synindex foo bar makes index foo feed into index bar.
4.2814 +% Do this instead of @defindex foo if you don't want it as a separate index.
4.2815 +%
4.2816 +% @syncodeindex foo bar similar, but put all entries made for index foo
4.2817 +% inside @code.
4.2818 +%
4.2819 +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4.2820 +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4.2821 +
4.2822 +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4.2823 +% #3 the target index (bar).
4.2824 +\def\dosynindex#1#2#3{%
4.2825 + % Only do \closeout if we haven't already done it, else we'll end up
4.2826 + % closing the target index.
4.2827 + \expandafter \ifx\csname donesynindex#2\endcsname \undefined
4.2828 + % The \closeout helps reduce unnecessary open files; the limit on the
4.2829 + % Acorn RISC OS is a mere 16 files.
4.2830 + \expandafter\closeout\csname#2indfile\endcsname
4.2831 + \expandafter\let\csname\donesynindex#2\endcsname = 1
4.2832 + \fi
4.2833 + % redefine \fooindfile:
4.2834 + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4.2835 + \expandafter\let\csname#2indfile\endcsname=\temp
4.2836 + % redefine \fooindex:
4.2837 + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4.2838 +}
4.2839 +
4.2840 +% Define \doindex, the driver for all \fooindex macros.
4.2841 +% Argument #1 is generated by the calling \fooindex macro,
4.2842 +% and it is "foo", the name of the index.
4.2843 +
4.2844 +% \doindex just uses \parsearg; it calls \doind for the actual work.
4.2845 +% This is because \doind is more useful to call from other macros.
4.2846 +
4.2847 +% There is also \dosubind {index}{topic}{subtopic}
4.2848 +% which makes an entry in a two-level index such as the operation index.
4.2849 +
4.2850 +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
4.2851 +\def\singleindexer #1{\doind{\indexname}{#1}}
4.2852 +
4.2853 +% like the previous two, but they put @code around the argument.
4.2854 +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
4.2855 +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
4.2856 +
4.2857 +% Take care of Texinfo commands that can appear in an index entry.
4.2858 +% Since there are some commands we want to expand, and others we don't,
4.2859 +% we have to laboriously prevent expansion for those that we don't.
4.2860 +%
4.2861 +\def\indexdummies{%
4.2862 + \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4.2863 + \def\ {\realbackslash\space }%
4.2864 + % Need these in case \tex is in effect and \{ is a \delimiter again.
4.2865 + % But can't use \lbracecmd and \rbracecmd because texindex assumes
4.2866 + % braces and backslashes are used only as delimiters.
4.2867 + \let\{ = \mylbrace
4.2868 + \let\} = \myrbrace
4.2869 + %
4.2870 + % \definedummyword defines \#1 as \realbackslash #1\space, thus
4.2871 + % effectively preventing its expansion. This is used only for control
4.2872 + % words, not control letters, because the \space would be incorrect
4.2873 + % for control characters, but is needed to separate the control word
4.2874 + % from whatever follows.
4.2875 + %
4.2876 + % For control letters, we have \definedummyletter, which omits the
4.2877 + % space.
4.2878 + %
4.2879 + % These can be used both for control words that take an argument and
4.2880 + % those that do not. If it is followed by {arg} in the input, then
4.2881 + % that will dutifully get written to the index (or wherever).
4.2882 + %
4.2883 + \def\definedummyword##1{%
4.2884 + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
4.2885 + }%
4.2886 + \def\definedummyletter##1{%
4.2887 + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
4.2888 + }%
4.2889 + %
4.2890 + % Do the redefinitions.
4.2891 + \commondummies
4.2892 +}
4.2893 +
4.2894 +% For the aux file, @ is the escape character. So we want to redefine
4.2895 +% everything using @ instead of \realbackslash. When everything uses
4.2896 +% @, this will be simpler.
4.2897 +%
4.2898 +\def\atdummies{%
4.2899 + \def\@{@@}%
4.2900 + \def\ {@ }%
4.2901 + \let\{ = \lbraceatcmd
4.2902 + \let\} = \rbraceatcmd
4.2903 + %
4.2904 + % (See comments in \indexdummies.)
4.2905 + \def\definedummyword##1{%
4.2906 + \expandafter\def\csname ##1\endcsname{@##1\space}%
4.2907 + }%
4.2908 + \def\definedummyletter##1{%
4.2909 + \expandafter\def\csname ##1\endcsname{@##1}%
4.2910 + }%
4.2911 + %
4.2912 + % Do the redefinitions.
4.2913 + \commondummies
4.2914 +}
4.2915 +
4.2916 +% Called from \indexdummies and \atdummies. \definedummyword and
4.2917 +% \definedummyletter must be defined first.
4.2918 +%
4.2919 +\def\commondummies{%
4.2920 + %
4.2921 + \normalturnoffactive
4.2922 + %
4.2923 + % Control letters and accents.
4.2924 + \definedummyletter{_}%
4.2925 + \definedummyletter{,}%
4.2926 + \definedummyletter{"}%
4.2927 + \definedummyletter{`}%
4.2928 + \definedummyletter{'}%
4.2929 + \definedummyletter{^}%
4.2930 + \definedummyletter{~}%
4.2931 + \definedummyletter{=}%
4.2932 + \definedummyword{u}%
4.2933 + \definedummyword{v}%
4.2934 + \definedummyword{H}%
4.2935 + \definedummyword{dotaccent}%
4.2936 + \definedummyword{ringaccent}%
4.2937 + \definedummyword{tieaccent}%
4.2938 + \definedummyword{ubaraccent}%
4.2939 + \definedummyword{udotaccent}%
4.2940 + \definedummyword{dotless}%
4.2941 + %
4.2942 + % Other non-English letters.
4.2943 + \definedummyword{AA}%
4.2944 + \definedummyword{AE}%
4.2945 + \definedummyword{L}%
4.2946 + \definedummyword{OE}%
4.2947 + \definedummyword{O}%
4.2948 + \definedummyword{aa}%
4.2949 + \definedummyword{ae}%
4.2950 + \definedummyword{l}%
4.2951 + \definedummyword{oe}%
4.2952 + \definedummyword{o}%
4.2953 + \definedummyword{ss}%
4.2954 + %
4.2955 + % Although these internal commands shouldn't show up, sometimes they do.
4.2956 + \definedummyword{bf}%
4.2957 + \definedummyword{gtr}%
4.2958 + \definedummyword{hat}%
4.2959 + \definedummyword{less}%
4.2960 + \definedummyword{sf}%
4.2961 + \definedummyword{sl}%
4.2962 + \definedummyword{tclose}%
4.2963 + \definedummyword{tt}%
4.2964 + %
4.2965 + % Texinfo font commands.
4.2966 + \definedummyword{b}%
4.2967 + \definedummyword{i}%
4.2968 + \definedummyword{r}%
4.2969 + \definedummyword{sc}%
4.2970 + \definedummyword{t}%
4.2971 + %
4.2972 + \definedummyword{TeX}%
4.2973 + \definedummyword{acronym}%
4.2974 + \definedummyword{cite}%
4.2975 + \definedummyword{code}%
4.2976 + \definedummyword{command}%
4.2977 + \definedummyword{dfn}%
4.2978 + \definedummyword{dots}%
4.2979 + \definedummyword{emph}%
4.2980 + \definedummyword{env}%
4.2981 + \definedummyword{file}%
4.2982 + \definedummyword{kbd}%
4.2983 + \definedummyword{key}%
4.2984 + \definedummyword{math}%
4.2985 + \definedummyword{option}%
4.2986 + \definedummyword{samp}%
4.2987 + \definedummyword{strong}%
4.2988 + \definedummyword{uref}%
4.2989 + \definedummyword{url}%
4.2990 + \definedummyword{var}%
4.2991 + \definedummyword{w}%
4.2992 + %
4.2993 + % Assorted special characters.
4.2994 + \definedummyword{bullet}%
4.2995 + \definedummyword{copyright}%
4.2996 + \definedummyword{dots}%
4.2997 + \definedummyword{enddots}%
4.2998 + \definedummyword{equiv}%
4.2999 + \definedummyword{error}%
4.3000 + \definedummyword{expansion}%
4.3001 + \definedummyword{minus}%
4.3002 + \definedummyword{pounds}%
4.3003 + \definedummyword{point}%
4.3004 + \definedummyword{print}%
4.3005 + \definedummyword{result}%
4.3006 + %
4.3007 + % Handle some cases of @value -- where the variable name does not
4.3008 + % contain - or _, and the value does not contain any
4.3009 + % (non-fully-expandable) commands.
4.3010 + \let\value = \expandablevalue
4.3011 + %
4.3012 + % Normal spaces, not active ones.
4.3013 + \unsepspaces
4.3014 + %
4.3015 + % No macro expansion.
4.3016 + \turnoffmacros
4.3017 +}
4.3018 +
4.3019 +% If an index command is used in an @example environment, any spaces
4.3020 +% therein should become regular spaces in the raw index file, not the
4.3021 +% expansion of \tie (\leavevmode \penalty \@M \ ).
4.3022 +{\obeyspaces
4.3023 + \gdef\unsepspaces{\obeyspaces\let =\space}}
4.3024 +
4.3025 +
4.3026 +% \indexnofonts is used when outputting the strings to sort the index
4.3027 +% by, and when constructing control sequence names. It eliminates all
4.3028 +% control sequences and just writes whatever the best ASCII sort string
4.3029 +% would be for a given command (usually its argument).
4.3030 +%
4.3031 +\def\indexdummytex{TeX}
4.3032 +\def\indexdummydots{...}
4.3033 +%
4.3034 +\def\indexnofonts{%
4.3035 + \def\ { }%
4.3036 + \def\@{@}%
4.3037 + % how to handle braces?
4.3038 + \def\_{\normalunderscore}%
4.3039 + %
4.3040 + \let\,=\asis
4.3041 + \let\"=\asis
4.3042 + \let\`=\asis
4.3043 + \let\'=\asis
4.3044 + \let\^=\asis
4.3045 + \let\~=\asis
4.3046 + \let\==\asis
4.3047 + \let\u=\asis
4.3048 + \let\v=\asis
4.3049 + \let\H=\asis
4.3050 + \let\dotaccent=\asis
4.3051 + \let\ringaccent=\asis
4.3052 + \let\tieaccent=\asis
4.3053 + \let\ubaraccent=\asis
4.3054 + \let\udotaccent=\asis
4.3055 + \let\dotless=\asis
4.3056 + %
4.3057 + % Other non-English letters.
4.3058 + \def\AA{AA}%
4.3059 + \def\AE{AE}%
4.3060 + \def\L{L}%
4.3061 + \def\OE{OE}%
4.3062 + \def\O{O}%
4.3063 + \def\aa{aa}%
4.3064 + \def\ae{ae}%
4.3065 + \def\l{l}%
4.3066 + \def\oe{oe}%
4.3067 + \def\o{o}%
4.3068 + \def\ss{ss}%
4.3069 + \def\exclamdown{!}%
4.3070 + \def\questiondown{?}%
4.3071 + %
4.3072 + % Don't no-op \tt, since it isn't a user-level command
4.3073 + % and is used in the definitions of the active chars like <, >, |, etc.
4.3074 + % Likewise with the other plain tex font commands.
4.3075 + %\let\tt=\asis
4.3076 + %
4.3077 + % Texinfo font commands.
4.3078 + \let\b=\asis
4.3079 + \let\i=\asis
4.3080 + \let\r=\asis
4.3081 + \let\sc=\asis
4.3082 + \let\t=\asis
4.3083 + %
4.3084 + \let\TeX=\indexdummytex
4.3085 + \let\acronym=\asis
4.3086 + \let\cite=\asis
4.3087 + \let\code=\asis
4.3088 + \let\command=\asis
4.3089 + \let\dfn=\asis
4.3090 + \let\dots=\indexdummydots
4.3091 + \let\emph=\asis
4.3092 + \let\env=\asis
4.3093 + \let\file=\asis
4.3094 + \let\kbd=\asis
4.3095 + \let\key=\asis
4.3096 + \let\math=\asis
4.3097 + \let\option=\asis
4.3098 + \let\samp=\asis
4.3099 + \let\strong=\asis
4.3100 + \let\uref=\asis
4.3101 + \let\url=\asis
4.3102 + \let\var=\asis
4.3103 + \let\w=\asis
4.3104 +}
4.3105 +
4.3106 +\let\indexbackslash=0 %overridden during \printindex.
4.3107 +\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4.3108 +
4.3109 +% For \ifx comparisons.
4.3110 +\def\emptymacro{\empty}
4.3111 +
4.3112 +% Most index entries go through here, but \dosubind is the general case.
4.3113 +%
4.3114 +\def\doind#1#2{\dosubind{#1}{#2}\empty}
4.3115 +
4.3116 +% Workhorse for all \fooindexes.
4.3117 +% #1 is name of index, #2 is stuff to put there, #3 is subentry --
4.3118 +% \empty if called from \doind, as we usually are. The main exception
4.3119 +% is with defuns, which call us directly.
4.3120 +%
4.3121 +\def\dosubind#1#2#3{%
4.3122 + % Put the index entry in the margin if desired.
4.3123 + \ifx\SETmarginindex\relax\else
4.3124 + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
4.3125 + \fi
4.3126 + {%
4.3127 + \count255=\lastpenalty
4.3128 + {%
4.3129 + \indexdummies % Must do this here, since \bf, etc expand at this stage
4.3130 + \escapechar=`\\
4.3131 + {%
4.3132 + \let\folio = 0% We will expand all macros now EXCEPT \folio.
4.3133 + \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
4.3134 + % so it will be output as is; and it will print as backslash.
4.3135 + %
4.3136 + % The main index entry text.
4.3137 + \toks0 = {#2}%
4.3138 + %
4.3139 + % If third arg is present, precede it with space in sort key.
4.3140 + \def\thirdarg{#3}%
4.3141 + \ifx\thirdarg\emptymacro \else
4.3142 + % If the third (subentry) arg is present, add it to the index
4.3143 + % line to write.
4.3144 + \toks0 = \expandafter{\the\toks0 \space #3}%
4.3145 + \fi
4.3146 + %
4.3147 + % Process the index entry with all font commands turned off, to
4.3148 + % get the string to sort by.
4.3149 + {\indexnofonts
4.3150 + \edef\temp{\the\toks0}% need full expansion
4.3151 + \xdef\indexsorttmp{\temp}%
4.3152 + }%
4.3153 + %
4.3154 + % Set up the complete index entry, with both the sort key and
4.3155 + % the original text, including any font commands. We write
4.3156 + % three arguments to \entry to the .?? file (four in the
4.3157 + % subentry case), texindex reduces to two when writing the .??s
4.3158 + % sorted result.
4.3159 + \edef\temp{%
4.3160 + \write\csname#1indfile\endcsname{%
4.3161 + \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
4.3162 + }%
4.3163 + %
4.3164 + % If a skip is the last thing on the list now, preserve it
4.3165 + % by backing up by \lastskip, doing the \write, then inserting
4.3166 + % the skip again. Otherwise, the whatsit generated by the
4.3167 + % \write will make \lastskip zero. The result is that sequences
4.3168 + % like this:
4.3169 + % @end defun
4.3170 + % @tindex whatever
4.3171 + % @defun ...
4.3172 + % will have extra space inserted, because the \medbreak in the
4.3173 + % start of the @defun won't see the skip inserted by the @end of
4.3174 + % the previous defun.
4.3175 + %
4.3176 + % But don't do any of this if we're not in vertical mode. We
4.3177 + % don't want to do a \vskip and prematurely end a paragraph.
4.3178 + %
4.3179 + % Avoid page breaks due to these extra skips, too.
4.3180 + %
4.3181 + \iflinks
4.3182 + \ifvmode
4.3183 + \skip0 = \lastskip
4.3184 + \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
4.3185 + \fi
4.3186 + %
4.3187 + \temp % do the write
4.3188 + %
4.3189 + \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
4.3190 + \fi
4.3191 + }%
4.3192 + }%
4.3193 + \penalty\count255
4.3194 + }%
4.3195 +}
4.3196 +
4.3197 +% The index entry written in the file actually looks like
4.3198 +% \entry {sortstring}{page}{topic}
4.3199 +% or
4.3200 +% \entry {sortstring}{page}{topic}{subtopic}
4.3201 +% The texindex program reads in these files and writes files
4.3202 +% containing these kinds of lines:
4.3203 +% \initial {c}
4.3204 +% before the first topic whose initial is c
4.3205 +% \entry {topic}{pagelist}
4.3206 +% for a topic that is used without subtopics
4.3207 +% \primary {topic}
4.3208 +% for the beginning of a topic that is used with subtopics
4.3209 +% \secondary {subtopic}{pagelist}
4.3210 +% for each subtopic.
4.3211 +
4.3212 +% Define the user-accessible indexing commands
4.3213 +% @findex, @vindex, @kindex, @cindex.
4.3214 +
4.3215 +\def\findex {\fnindex}
4.3216 +\def\kindex {\kyindex}
4.3217 +\def\cindex {\cpindex}
4.3218 +\def\vindex {\vrindex}
4.3219 +\def\tindex {\tpindex}
4.3220 +\def\pindex {\pgindex}
4.3221 +
4.3222 +\def\cindexsub {\begingroup\obeylines\cindexsub}
4.3223 +{\obeylines %
4.3224 +\gdef\cindexsub "#1" #2^^M{\endgroup %
4.3225 +\dosubind{cp}{#2}{#1}}}
4.3226 +
4.3227 +% Define the macros used in formatting output of the sorted index material.
4.3228 +
4.3229 +% @printindex causes a particular index (the ??s file) to get printed.
4.3230 +% It does not print any chapter heading (usually an @unnumbered).
4.3231 +%
4.3232 +\def\printindex{\parsearg\doprintindex}
4.3233 +\def\doprintindex#1{\begingroup
4.3234 + \dobreak \chapheadingskip{10000}%
4.3235 + %
4.3236 + \smallfonts \rm
4.3237 + \tolerance = 9500
4.3238 + \everypar = {}% don't want the \kern\-parindent from indentation suppression.
4.3239 + \indexbreaks
4.3240 + %
4.3241 + % See if the index file exists and is nonempty.
4.3242 + % Change catcode of @ here so that if the index file contains
4.3243 + % \initial {@}
4.3244 + % as its first line, TeX doesn't complain about mismatched braces
4.3245 + % (because it thinks @} is a control sequence).
4.3246 + \catcode`\@ = 11
4.3247 + \openin 1 \jobname.#1s
4.3248 + \ifeof 1
4.3249 + % \enddoublecolumns gets confused if there is no text in the index,
4.3250 + % and it loses the chapter title and the aux file entries for the
4.3251 + % index. The easiest way to prevent this problem is to make sure
4.3252 + % there is some text.
4.3253 + \putwordIndexNonexistent
4.3254 + \else
4.3255 + %
4.3256 + % If the index file exists but is empty, then \openin leaves \ifeof
4.3257 + % false. We have to make TeX try to read something from the file, so
4.3258 + % it can discover if there is anything in it.
4.3259 + \read 1 to \temp
4.3260 + \ifeof 1
4.3261 + \putwordIndexIsEmpty
4.3262 + \else
4.3263 + % Index files are almost Texinfo source, but we use \ as the escape
4.3264 + % character. It would be better to use @, but that's too big a change
4.3265 + % to make right now.
4.3266 + \def\indexbackslash{\rawbackslashxx}%
4.3267 + \catcode`\\ = 0
4.3268 + \escapechar = `\\
4.3269 + \begindoublecolumns
4.3270 + \input \jobname.#1s
4.3271 + \enddoublecolumns
4.3272 + \fi
4.3273 + \fi
4.3274 + \closein 1
4.3275 +\endgroup}
4.3276 +
4.3277 +% These macros are used by the sorted index file itself.
4.3278 +% Change them to control the appearance of the index.
4.3279 +
4.3280 +\def\initial#1{{%
4.3281 + % Some minor font changes for the special characters.
4.3282 + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
4.3283 + %
4.3284 + % Remove any glue we may have, we'll be inserting our own.
4.3285 + \removelastskip
4.3286 + %
4.3287 + % We like breaks before the index initials, so insert a bonus.
4.3288 + \penalty -300
4.3289 + %
4.3290 + % Typeset the initial. Making this add up to a whole number of
4.3291 + % baselineskips increases the chance of the dots lining up from column
4.3292 + % to column. It still won't often be perfect, because of the stretch
4.3293 + % we need before each entry, but it's better.
4.3294 + %
4.3295 + % No shrink because it confuses \balancecolumns.
4.3296 + \vskip 1.67\baselineskip plus .5\baselineskip
4.3297 + \leftline{\secbf #1}%
4.3298 + \vskip .33\baselineskip plus .1\baselineskip
4.3299 + %
4.3300 + % Do our best not to break after the initial.
4.3301 + \nobreak
4.3302 +}}
4.3303 +
4.3304 +% This typesets a paragraph consisting of #1, dot leaders, and then #2
4.3305 +% flush to the right margin. It is used for index and table of contents
4.3306 +% entries. The paragraph is indented by \leftskip.
4.3307 +%
4.3308 +\def\entry#1#2{\begingroup
4.3309 + %
4.3310 + % Start a new paragraph if necessary, so our assignments below can't
4.3311 + % affect previous text.
4.3312 + \par
4.3313 + %
4.3314 + % Do not fill out the last line with white space.
4.3315 + \parfillskip = 0in
4.3316 + %
4.3317 + % No extra space above this paragraph.
4.3318 + \parskip = 0in
4.3319 + %
4.3320 + % Do not prefer a separate line ending with a hyphen to fewer lines.
4.3321 + \finalhyphendemerits = 0
4.3322 + %
4.3323 + % \hangindent is only relevant when the entry text and page number
4.3324 + % don't both fit on one line. In that case, bob suggests starting the
4.3325 + % dots pretty far over on the line. Unfortunately, a large
4.3326 + % indentation looks wrong when the entry text itself is broken across
4.3327 + % lines. So we use a small indentation and put up with long leaders.
4.3328 + %
4.3329 + % \hangafter is reset to 1 (which is the value we want) at the start
4.3330 + % of each paragraph, so we need not do anything with that.
4.3331 + \hangindent = 2em
4.3332 + %
4.3333 + % When the entry text needs to be broken, just fill out the first line
4.3334 + % with blank space.
4.3335 + \rightskip = 0pt plus1fil
4.3336 + %
4.3337 + % A bit of stretch before each entry for the benefit of balancing columns.
4.3338 + \vskip 0pt plus1pt
4.3339 + %
4.3340 + % Start a ``paragraph'' for the index entry so the line breaking
4.3341 + % parameters we've set above will have an effect.
4.3342 + \noindent
4.3343 + %
4.3344 + % Insert the text of the index entry. TeX will do line-breaking on it.
4.3345 + #1%
4.3346 + % The following is kludged to not output a line of dots in the index if
4.3347 + % there are no page numbers. The next person who breaks this will be
4.3348 + % cursed by a Unix daemon.
4.3349 + \def\tempa{{\rm }}%
4.3350 + \def\tempb{#2}%
4.3351 + \edef\tempc{\tempa}%
4.3352 + \edef\tempd{\tempb}%
4.3353 + \ifx\tempc\tempd\ \else%
4.3354 + %
4.3355 + % If we must, put the page number on a line of its own, and fill out
4.3356 + % this line with blank space. (The \hfil is overwhelmed with the
4.3357 + % fill leaders glue in \indexdotfill if the page number does fit.)
4.3358 + \hfil\penalty50
4.3359 + \null\nobreak\indexdotfill % Have leaders before the page number.
4.3360 + %
4.3361 + % The `\ ' here is removed by the implicit \unskip that TeX does as
4.3362 + % part of (the primitive) \par. Without it, a spurious underfull
4.3363 + % \hbox ensues.
4.3364 + \ifpdf
4.3365 + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
4.3366 + \else
4.3367 + \ #2% The page number ends the paragraph.
4.3368 + \fi
4.3369 + \fi%
4.3370 + \par
4.3371 +\endgroup}
4.3372 +
4.3373 +% Like \dotfill except takes at least 1 em.
4.3374 +\def\indexdotfill{\cleaders
4.3375 + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
4.3376 +
4.3377 +\def\primary #1{\line{#1\hfil}}
4.3378 +
4.3379 +\newskip\secondaryindent \secondaryindent=0.5cm
4.3380 +\def\secondary#1#2{{%
4.3381 + \parfillskip=0in
4.3382 + \parskip=0in
4.3383 + \hangindent=1in
4.3384 + \hangafter=1
4.3385 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
4.3386 + \ifpdf
4.3387 + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
4.3388 + \else
4.3389 + #2
4.3390 + \fi
4.3391 + \par
4.3392 +}}
4.3393 +
4.3394 +% Define two-column mode, which we use to typeset indexes.
4.3395 +% Adapted from the TeXbook, page 416, which is to say,
4.3396 +% the manmac.tex format used to print the TeXbook itself.
4.3397 +\catcode`\@=11
4.3398 +
4.3399 +\newbox\partialpage
4.3400 +\newdimen\doublecolumnhsize
4.3401 +
4.3402 +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
4.3403 + % Grab any single-column material above us.
4.3404 + \output = {%
4.3405 + %
4.3406 + % Here is a possibility not foreseen in manmac: if we accumulate a
4.3407 + % whole lot of material, we might end up calling this \output
4.3408 + % routine twice in a row (see the doublecol-lose test, which is
4.3409 + % essentially a couple of indexes with @setchapternewpage off). In
4.3410 + % that case we just ship out what is in \partialpage with the normal
4.3411 + % output routine. Generally, \partialpage will be empty when this
4.3412 + % runs and this will be a no-op. See the indexspread.tex test case.
4.3413 + \ifvoid\partialpage \else
4.3414 + \onepageout{\pagecontents\partialpage}%
4.3415 + \fi
4.3416 + %
4.3417 + \global\setbox\partialpage = \vbox{%
4.3418 + % Unvbox the main output page.
4.3419 + \unvbox\PAGE
4.3420 + \kern-\topskip \kern\baselineskip
4.3421 + }%
4.3422 + }%
4.3423 + \eject % run that output routine to set \partialpage
4.3424 + %
4.3425 + % Use the double-column output routine for subsequent pages.
4.3426 + \output = {\doublecolumnout}%
4.3427 + %
4.3428 + % Change the page size parameters. We could do this once outside this
4.3429 + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
4.3430 + % format, but then we repeat the same computation. Repeating a couple
4.3431 + % of assignments once per index is clearly meaningless for the
4.3432 + % execution time, so we may as well do it in one place.
4.3433 + %
4.3434 + % First we halve the line length, less a little for the gutter between
4.3435 + % the columns. We compute the gutter based on the line length, so it
4.3436 + % changes automatically with the paper format. The magic constant
4.3437 + % below is chosen so that the gutter has the same value (well, +-<1pt)
4.3438 + % as it did when we hard-coded it.
4.3439 + %
4.3440 + % We put the result in a separate register, \doublecolumhsize, so we
4.3441 + % can restore it in \pagesofar, after \hsize itself has (potentially)
4.3442 + % been clobbered.
4.3443 + %
4.3444 + \doublecolumnhsize = \hsize
4.3445 + \advance\doublecolumnhsize by -.04154\hsize
4.3446 + \divide\doublecolumnhsize by 2
4.3447 + \hsize = \doublecolumnhsize
4.3448 + %
4.3449 + % Double the \vsize as well. (We don't need a separate register here,
4.3450 + % since nobody clobbers \vsize.)
4.3451 + \vsize = 2\vsize
4.3452 +}
4.3453 +
4.3454 +% The double-column output routine for all double-column pages except
4.3455 +% the last.
4.3456 +%
4.3457 +\def\doublecolumnout{%
4.3458 + \splittopskip=\topskip \splitmaxdepth=\maxdepth
4.3459 + % Get the available space for the double columns -- the normal
4.3460 + % (undoubled) page height minus any material left over from the
4.3461 + % previous page.
4.3462 + \dimen@ = \vsize
4.3463 + \divide\dimen@ by 2
4.3464 + \advance\dimen@ by -\ht\partialpage
4.3465 + %
4.3466 + % box0 will be the left-hand column, box2 the right.
4.3467 + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
4.3468 + \onepageout\pagesofar
4.3469 + \unvbox255
4.3470 + \penalty\outputpenalty
4.3471 +}
4.3472 +%
4.3473 +% Re-output the contents of the output page -- any previous material,
4.3474 +% followed by the two boxes we just split, in box0 and box2.
4.3475 +\def\pagesofar{%
4.3476 + \unvbox\partialpage
4.3477 + %
4.3478 + \hsize = \doublecolumnhsize
4.3479 + \wd0=\hsize \wd2=\hsize
4.3480 + \hbox to\pagewidth{\box0\hfil\box2}%
4.3481 +}
4.3482 +%
4.3483 +% All done with double columns.
4.3484 +\def\enddoublecolumns{%
4.3485 + \output = {%
4.3486 + % Split the last of the double-column material. Leave it on the
4.3487 + % current page, no automatic page break.
4.3488 + \balancecolumns
4.3489 + %
4.3490 + % If we end up splitting too much material for the current page,
4.3491 + % though, there will be another page break right after this \output
4.3492 + % invocation ends. Having called \balancecolumns once, we do not
4.3493 + % want to call it again. Therefore, reset \output to its normal
4.3494 + % definition right away. (We hope \balancecolumns will never be
4.3495 + % called on to balance too much material, but if it is, this makes
4.3496 + % the output somewhat more palatable.)
4.3497 + \global\output = {\onepageout{\pagecontents\PAGE}}%
4.3498 + }%
4.3499 + \eject
4.3500 + \endgroup % started in \begindoublecolumns
4.3501 + %
4.3502 + % \pagegoal was set to the doubled \vsize above, since we restarted
4.3503 + % the current page. We're now back to normal single-column
4.3504 + % typesetting, so reset \pagegoal to the normal \vsize (after the
4.3505 + % \endgroup where \vsize got restored).
4.3506 + \pagegoal = \vsize
4.3507 +}
4.3508 +%
4.3509 +% Called at the end of the double column material.
4.3510 +\def\balancecolumns{%
4.3511 + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
4.3512 + \dimen@ = \ht0
4.3513 + \advance\dimen@ by \topskip
4.3514 + \advance\dimen@ by-\baselineskip
4.3515 + \divide\dimen@ by 2 % target to split to
4.3516 + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
4.3517 + \splittopskip = \topskip
4.3518 + % Loop until we get a decent breakpoint.
4.3519 + {%
4.3520 + \vbadness = 10000
4.3521 + \loop
4.3522 + \global\setbox3 = \copy0
4.3523 + \global\setbox1 = \vsplit3 to \dimen@
4.3524 + \ifdim\ht3>\dimen@
4.3525 + \global\advance\dimen@ by 1pt
4.3526 + \repeat
4.3527 + }%
4.3528 + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
4.3529 + \setbox0=\vbox to\dimen@{\unvbox1}%
4.3530 + \setbox2=\vbox to\dimen@{\unvbox3}%
4.3531 + %
4.3532 + \pagesofar
4.3533 +}
4.3534 +\catcode`\@ = \other
4.3535 +
4.3536 +
4.3537 +\message{sectioning,}
4.3538 +% Chapters, sections, etc.
4.3539 +
4.3540 +\newcount\chapno
4.3541 +\newcount\secno \secno=0
4.3542 +\newcount\subsecno \subsecno=0
4.3543 +\newcount\subsubsecno \subsubsecno=0
4.3544 +
4.3545 +% This counter is funny since it counts through charcodes of letters A, B, ...
4.3546 +\newcount\appendixno \appendixno = `\@
4.3547 +% \def\appendixletter{\char\the\appendixno}
4.3548 +% We do the following for the sake of pdftex, which needs the actual
4.3549 +% letter in the expansion, not just typeset.
4.3550 +\def\appendixletter{%
4.3551 + \ifnum\appendixno=`A A%
4.3552 + \else\ifnum\appendixno=`B B%
4.3553 + \else\ifnum\appendixno=`C C%
4.3554 + \else\ifnum\appendixno=`D D%
4.3555 + \else\ifnum\appendixno=`E E%
4.3556 + \else\ifnum\appendixno=`F F%
4.3557 + \else\ifnum\appendixno=`G G%
4.3558 + \else\ifnum\appendixno=`H H%
4.3559 + \else\ifnum\appendixno=`I I%
4.3560 + \else\ifnum\appendixno=`J J%
4.3561 + \else\ifnum\appendixno=`K K%
4.3562 + \else\ifnum\appendixno=`L L%
4.3563 + \else\ifnum\appendixno=`M M%
4.3564 + \else\ifnum\appendixno=`N N%
4.3565 + \else\ifnum\appendixno=`O O%
4.3566 + \else\ifnum\appendixno=`P P%
4.3567 + \else\ifnum\appendixno=`Q Q%
4.3568 + \else\ifnum\appendixno=`R R%
4.3569 + \else\ifnum\appendixno=`S S%
4.3570 + \else\ifnum\appendixno=`T T%
4.3571 + \else\ifnum\appendixno=`U U%
4.3572 + \else\ifnum\appendixno=`V V%
4.3573 + \else\ifnum\appendixno=`W W%
4.3574 + \else\ifnum\appendixno=`X X%
4.3575 + \else\ifnum\appendixno=`Y Y%
4.3576 + \else\ifnum\appendixno=`Z Z%
4.3577 + % The \the is necessary, despite appearances, because \appendixletter is
4.3578 + % expanded while writing the .toc file. \char\appendixno is not
4.3579 + % expandable, thus it is written literally, thus all appendixes come out
4.3580 + % with the same letter (or @) in the toc without it.
4.3581 + \else\char\the\appendixno
4.3582 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
4.3583 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
4.3584 +
4.3585 +% Each @chapter defines this as the name of the chapter.
4.3586 +% page headings and footings can use it. @section does likewise.
4.3587 +\def\thischapter{}
4.3588 +\def\thissection{}
4.3589 +
4.3590 +\newcount\absseclevel % used to calculate proper heading level
4.3591 +\newcount\secbase\secbase=0 % @raise/lowersections modify this count
4.3592 +
4.3593 +% @raisesections: treat @section as chapter, @subsection as section, etc.
4.3594 +\def\raisesections{\global\advance\secbase by -1}
4.3595 +\let\up=\raisesections % original BFox name
4.3596 +
4.3597 +% @lowersections: treat @chapter as section, @section as subsection, etc.
4.3598 +\def\lowersections{\global\advance\secbase by 1}
4.3599 +\let\down=\lowersections % original BFox name
4.3600 +
4.3601 +% Choose a numbered-heading macro
4.3602 +% #1 is heading level if unmodified by @raisesections or @lowersections
4.3603 +% #2 is text for heading
4.3604 +\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
4.3605 +\ifcase\absseclevel
4.3606 + \chapterzzz{#2}
4.3607 +\or
4.3608 + \seczzz{#2}
4.3609 +\or
4.3610 + \numberedsubseczzz{#2}
4.3611 +\or
4.3612 + \numberedsubsubseczzz{#2}
4.3613 +\else
4.3614 + \ifnum \absseclevel<0
4.3615 + \chapterzzz{#2}
4.3616 + \else
4.3617 + \numberedsubsubseczzz{#2}
4.3618 + \fi
4.3619 +\fi
4.3620 +\suppressfirstparagraphindent
4.3621 +}
4.3622 +
4.3623 +% like \numhead, but chooses appendix heading levels
4.3624 +\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
4.3625 +\ifcase\absseclevel
4.3626 + \appendixzzz{#2}
4.3627 +\or
4.3628 + \appendixsectionzzz{#2}
4.3629 +\or
4.3630 + \appendixsubseczzz{#2}
4.3631 +\or
4.3632 + \appendixsubsubseczzz{#2}
4.3633 +\else
4.3634 + \ifnum \absseclevel<0
4.3635 + \appendixzzz{#2}
4.3636 + \else
4.3637 + \appendixsubsubseczzz{#2}
4.3638 + \fi
4.3639 +\fi
4.3640 +\suppressfirstparagraphindent
4.3641 +}
4.3642 +
4.3643 +% like \numhead, but chooses numberless heading levels
4.3644 +\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
4.3645 +\ifcase\absseclevel
4.3646 + \unnumberedzzz{#2}
4.3647 +\or
4.3648 + \unnumberedseczzz{#2}
4.3649 +\or
4.3650 + \unnumberedsubseczzz{#2}
4.3651 +\or
4.3652 + \unnumberedsubsubseczzz{#2}
4.3653 +\else
4.3654 + \ifnum \absseclevel<0
4.3655 + \unnumberedzzz{#2}
4.3656 + \else
4.3657 + \unnumberedsubsubseczzz{#2}
4.3658 + \fi
4.3659 +\fi
4.3660 +\suppressfirstparagraphindent
4.3661 +}
4.3662 +
4.3663 +% @chapter, @appendix, @unnumbered.
4.3664 +\def\thischaptername{No Chapter Title}
4.3665 +\outer\def\chapter{\parsearg\chapteryyy}
4.3666 +\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
4.3667 +\def\chapterzzz #1{%
4.3668 + \secno=0 \subsecno=0 \subsubsecno=0
4.3669 + \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
4.3670 + \chapmacro {#1}{\the\chapno}%
4.3671 + \gdef\thissection{#1}%
4.3672 + \gdef\thischaptername{#1}%
4.3673 + % We don't substitute the actual chapter name into \thischapter
4.3674 + % because we don't want its macros evaluated now.
4.3675 + \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
4.3676 + \writetocentry{chap}{#1}{{\the\chapno}}
4.3677 + \donoderef
4.3678 + \global\let\section = \numberedsec
4.3679 + \global\let\subsection = \numberedsubsec
4.3680 + \global\let\subsubsection = \numberedsubsubsec
4.3681 +}
4.3682 +
4.3683 +% we use \chapno to avoid indenting back
4.3684 +\def\appendixbox#1{%
4.3685 + \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
4.3686 + \hbox to \wd0{#1\hss}}
4.3687 +
4.3688 +\outer\def\appendix{\parsearg\appendixyyy}
4.3689 +\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
4.3690 +\def\appendixzzz #1{%
4.3691 + \secno=0 \subsecno=0 \subsubsecno=0
4.3692 + \global\advance \appendixno by 1
4.3693 + \message{\putwordAppendix\space \appendixletter}%
4.3694 + \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
4.3695 + \gdef\thissection{#1}%
4.3696 + \gdef\thischaptername{#1}%
4.3697 + \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
4.3698 + \writetocentry{appendix}{#1}{{\appendixletter}}
4.3699 + \appendixnoderef
4.3700 + \global\let\section = \appendixsec
4.3701 + \global\let\subsection = \appendixsubsec
4.3702 + \global\let\subsubsection = \appendixsubsubsec
4.3703 +}
4.3704 +
4.3705 +% @centerchap is like @unnumbered, but the heading is centered.
4.3706 +\outer\def\centerchap{\parsearg\centerchapyyy}
4.3707 +\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
4.3708 +
4.3709 +% @top is like @unnumbered.
4.3710 +\outer\def\top{\parsearg\unnumberedyyy}
4.3711 +
4.3712 +\outer\def\unnumbered{\parsearg\unnumberedyyy}
4.3713 +\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
4.3714 +\def\unnumberedzzz #1{%
4.3715 + \secno=0 \subsecno=0 \subsubsecno=0
4.3716 + %
4.3717 + % This used to be simply \message{#1}, but TeX fully expands the
4.3718 + % argument to \message. Therefore, if #1 contained @-commands, TeX
4.3719 + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
4.3720 + % expanded @cite (which turns out to cause errors because \cite is meant
4.3721 + % to be executed, not expanded).
4.3722 + %
4.3723 + % Anyway, we don't want the fully-expanded definition of @cite to appear
4.3724 + % as a result of the \message, we just want `@cite' itself. We use
4.3725 + % \the<toks register> to achieve this: TeX expands \the<toks> only once,
4.3726 + % simply yielding the contents of <toks register>. (We also do this for
4.3727 + % the toc entries.)
4.3728 + \toks0 = {#1}\message{(\the\toks0)}%
4.3729 + %
4.3730 + \unnumbchapmacro {#1}%
4.3731 + \gdef\thischapter{#1}\gdef\thissection{#1}%
4.3732 + \writetocentry{unnumbchap}{#1}{{\the\chapno}}
4.3733 + \unnumbnoderef
4.3734 + \global\let\section = \unnumberedsec
4.3735 + \global\let\subsection = \unnumberedsubsec
4.3736 + \global\let\subsubsection = \unnumberedsubsubsec
4.3737 +}
4.3738 +
4.3739 +% Sections.
4.3740 +\outer\def\numberedsec{\parsearg\secyyy}
4.3741 +\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
4.3742 +\def\seczzz #1{%
4.3743 + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
4.3744 + \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
4.3745 + \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
4.3746 + \donoderef
4.3747 + \nobreak
4.3748 +}
4.3749 +
4.3750 +\outer\def\appendixsection{\parsearg\appendixsecyyy}
4.3751 +\outer\def\appendixsec{\parsearg\appendixsecyyy}
4.3752 +\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
4.3753 +\def\appendixsectionzzz #1{%
4.3754 + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
4.3755 + \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
4.3756 + \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
4.3757 + \appendixnoderef
4.3758 + \nobreak
4.3759 +}
4.3760 +
4.3761 +\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
4.3762 +\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
4.3763 +\def\unnumberedseczzz #1{%
4.3764 + \plainsecheading {#1}\gdef\thissection{#1}%
4.3765 + \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
4.3766 + \unnumbnoderef
4.3767 + \nobreak
4.3768 +}
4.3769 +
4.3770 +% Subsections.
4.3771 +\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
4.3772 +\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
4.3773 +\def\numberedsubseczzz #1{%
4.3774 + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
4.3775 + \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
4.3776 + \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
4.3777 + \donoderef
4.3778 + \nobreak
4.3779 +}
4.3780 +
4.3781 +\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
4.3782 +\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
4.3783 +\def\appendixsubseczzz #1{%
4.3784 + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
4.3785 + \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
4.3786 + \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
4.3787 + \appendixnoderef
4.3788 + \nobreak
4.3789 +}
4.3790 +
4.3791 +\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
4.3792 +\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
4.3793 +\def\unnumberedsubseczzz #1{%
4.3794 + \plainsubsecheading {#1}\gdef\thissection{#1}%
4.3795 + \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
4.3796 + \unnumbnoderef
4.3797 + \nobreak
4.3798 +}
4.3799 +
4.3800 +% Subsubsections.
4.3801 +\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
4.3802 +\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
4.3803 +\def\numberedsubsubseczzz #1{%
4.3804 + \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
4.3805 + \subsubsecheading {#1}
4.3806 + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
4.3807 + \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
4.3808 + \donoderef
4.3809 + \nobreak
4.3810 +}
4.3811 +
4.3812 +\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
4.3813 +\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
4.3814 +\def\appendixsubsubseczzz #1{%
4.3815 + \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
4.3816 + \subsubsecheading {#1}
4.3817 + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
4.3818 + \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
4.3819 + \appendixnoderef
4.3820 + \nobreak
4.3821 +}
4.3822 +
4.3823 +\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
4.3824 +\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
4.3825 +\def\unnumberedsubsubseczzz #1{%
4.3826 + \plainsubsubsecheading {#1}\gdef\thissection{#1}%
4.3827 + \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
4.3828 + \unnumbnoderef
4.3829 + \nobreak
4.3830 +}
4.3831 +
4.3832 +% These are variants which are not "outer", so they can appear in @ifinfo.
4.3833 +% Actually, they should now be obsolete; ordinary section commands should work.
4.3834 +\def\infotop{\parsearg\unnumberedzzz}
4.3835 +\def\infounnumbered{\parsearg\unnumberedzzz}
4.3836 +\def\infounnumberedsec{\parsearg\unnumberedseczzz}
4.3837 +\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
4.3838 +\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
4.3839 +
4.3840 +\def\infoappendix{\parsearg\appendixzzz}
4.3841 +\def\infoappendixsec{\parsearg\appendixseczzz}
4.3842 +\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
4.3843 +\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
4.3844 +
4.3845 +\def\infochapter{\parsearg\chapterzzz}
4.3846 +\def\infosection{\parsearg\sectionzzz}
4.3847 +\def\infosubsection{\parsearg\subsectionzzz}
4.3848 +\def\infosubsubsection{\parsearg\subsubsectionzzz}
4.3849 +
4.3850 +% These macros control what the section commands do, according
4.3851 +% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
4.3852 +% Define them by default for a numbered chapter.
4.3853 +\global\let\section = \numberedsec
4.3854 +\global\let\subsection = \numberedsubsec
4.3855 +\global\let\subsubsection = \numberedsubsubsec
4.3856 +
4.3857 +% Define @majorheading, @heading and @subheading
4.3858 +
4.3859 +% NOTE on use of \vbox for chapter headings, section headings, and such:
4.3860 +% 1) We use \vbox rather than the earlier \line to permit
4.3861 +% overlong headings to fold.
4.3862 +% 2) \hyphenpenalty is set to 10000 because hyphenation in a
4.3863 +% heading is obnoxious; this forbids it.
4.3864 +% 3) Likewise, headings look best if no \parindent is used, and
4.3865 +% if justification is not attempted. Hence \raggedright.
4.3866 +
4.3867 +
4.3868 +\def\majorheading{%
4.3869 + {\advance\chapheadingskip by 10pt \chapbreak }%
4.3870 + \parsearg\chapheadingzzz
4.3871 +}
4.3872 +
4.3873 +\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
4.3874 +\def\chapheadingzzz #1{%
4.3875 + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4.3876 + \parindent=0pt\raggedright
4.3877 + \rm #1\hfill}}%
4.3878 + \bigskip \par\penalty 200\relax
4.3879 + \suppressfirstparagraphindent
4.3880 +}
4.3881 +
4.3882 +% @heading, @subheading, @subsubheading.
4.3883 +\def\heading{\parsearg\doheading}
4.3884 +\def\subheading{\parsearg\dosubheading}
4.3885 +\def\subsubheading{\parsearg\dosubsubheading}
4.3886 +\def\doheading#1{\plainsecheading{#1}\suppressfirstparagraphindent}
4.3887 +\def\dosubheading#1{\plainsubsecheading{#1}\suppressfirstparagraphindent}
4.3888 +\def\dosubsubheading#1{\plainsubsubsecheading{#1}\suppressfirstparagraphindent}
4.3889 +
4.3890 +% These macros generate a chapter, section, etc. heading only
4.3891 +% (including whitespace, linebreaking, etc. around it),
4.3892 +% given all the information in convenient, parsed form.
4.3893 +
4.3894 +%%% Args are the skip and penalty (usually negative)
4.3895 +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
4.3896 +
4.3897 +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
4.3898 +
4.3899 +%%% Define plain chapter starts, and page on/off switching for it
4.3900 +% Parameter controlling skip before chapter headings (if needed)
4.3901 +
4.3902 +\newskip\chapheadingskip
4.3903 +
4.3904 +\def\chapbreak{\dobreak \chapheadingskip {-4000}}
4.3905 +\def\chappager{\par\vfill\supereject}
4.3906 +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
4.3907 +
4.3908 +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
4.3909 +
4.3910 +\def\CHAPPAGoff{%
4.3911 +\global\let\contentsalignmacro = \chappager
4.3912 +\global\let\pchapsepmacro=\chapbreak
4.3913 +\global\let\pagealignmacro=\chappager}
4.3914 +
4.3915 +\def\CHAPPAGon{%
4.3916 +\global\let\contentsalignmacro = \chappager
4.3917 +\global\let\pchapsepmacro=\chappager
4.3918 +\global\let\pagealignmacro=\chappager
4.3919 +\global\def\HEADINGSon{\HEADINGSsingle}}
4.3920 +
4.3921 +\def\CHAPPAGodd{
4.3922 +\global\let\contentsalignmacro = \chapoddpage
4.3923 +\global\let\pchapsepmacro=\chapoddpage
4.3924 +\global\let\pagealignmacro=\chapoddpage
4.3925 +\global\def\HEADINGSon{\HEADINGSdouble}}
4.3926 +
4.3927 +\CHAPPAGon
4.3928 +
4.3929 +\def\CHAPFplain{
4.3930 +\global\let\chapmacro=\chfplain
4.3931 +\global\let\unnumbchapmacro=\unnchfplain
4.3932 +\global\let\centerchapmacro=\centerchfplain}
4.3933 +
4.3934 +% Plain chapter opening.
4.3935 +% #1 is the text, #2 the chapter number or empty if unnumbered.
4.3936 +\def\chfplain#1#2{%
4.3937 + \pchapsepmacro
4.3938 + {%
4.3939 + \chapfonts \rm
4.3940 + \def\chapnum{#2}%
4.3941 + \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
4.3942 + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4.3943 + \hangindent = \wd0 \centerparametersmaybe
4.3944 + \unhbox0 #1\par}%
4.3945 + }%
4.3946 + \nobreak\bigskip % no page break after a chapter title
4.3947 + \nobreak
4.3948 +}
4.3949 +
4.3950 +% Plain opening for unnumbered.
4.3951 +\def\unnchfplain#1{\chfplain{#1}{}}
4.3952 +
4.3953 +% @centerchap -- centered and unnumbered.
4.3954 +\let\centerparametersmaybe = \relax
4.3955 +\def\centerchfplain#1{{%
4.3956 + \def\centerparametersmaybe{%
4.3957 + \advance\rightskip by 3\rightskip
4.3958 + \leftskip = \rightskip
4.3959 + \parfillskip = 0pt
4.3960 + }%
4.3961 + \chfplain{#1}{}%
4.3962 +}}
4.3963 +
4.3964 +\CHAPFplain % The default
4.3965 +
4.3966 +\def\unnchfopen #1{%
4.3967 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4.3968 + \parindent=0pt\raggedright
4.3969 + \rm #1\hfill}}\bigskip \par\nobreak
4.3970 +}
4.3971 +
4.3972 +\def\chfopen #1#2{\chapoddpage {\chapfonts
4.3973 +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
4.3974 +\par\penalty 5000 %
4.3975 +}
4.3976 +
4.3977 +\def\centerchfopen #1{%
4.3978 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4.3979 + \parindent=0pt
4.3980 + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
4.3981 +}
4.3982 +
4.3983 +\def\CHAPFopen{
4.3984 +\global\let\chapmacro=\chfopen
4.3985 +\global\let\unnumbchapmacro=\unnchfopen
4.3986 +\global\let\centerchapmacro=\centerchfopen}
4.3987 +
4.3988 +
4.3989 +% Section titles.
4.3990 +\newskip\secheadingskip
4.3991 +\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
4.3992 +\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
4.3993 +\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
4.3994 +
4.3995 +% Subsection titles.
4.3996 +\newskip \subsecheadingskip
4.3997 +\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
4.3998 +\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
4.3999 +\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
4.4000 +
4.4001 +% Subsubsection titles.
4.4002 +\let\subsubsecheadingskip = \subsecheadingskip
4.4003 +\let\subsubsecheadingbreak = \subsecheadingbreak
4.4004 +\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
4.4005 +\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
4.4006 +
4.4007 +
4.4008 +% Print any size section title.
4.4009 +%
4.4010 +% #1 is the section type (sec/subsec/subsubsec), #2 is the section
4.4011 +% number (maybe empty), #3 the text.
4.4012 +\def\sectionheading#1#2#3{%
4.4013 + {%
4.4014 + \expandafter\advance\csname #1headingskip\endcsname by \parskip
4.4015 + \csname #1headingbreak\endcsname
4.4016 + }%
4.4017 + {%
4.4018 + % Switch to the right set of fonts.
4.4019 + \csname #1fonts\endcsname \rm
4.4020 + %
4.4021 + % Only insert the separating space if we have a section number.
4.4022 + \def\secnum{#2}%
4.4023 + \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
4.4024 + %
4.4025 + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4.4026 + \hangindent = \wd0 % zero if no section number
4.4027 + \unhbox0 #3}%
4.4028 + }%
4.4029 + % Add extra space after the heading -- either a line space or a
4.4030 + % paragraph space, whichever is more. (Some people like to set
4.4031 + % \parskip to large values for some reason.) Don't allow stretch, though.
4.4032 + \nobreak
4.4033 + \ifdim\parskip>\normalbaselineskip
4.4034 + \kern\parskip
4.4035 + \else
4.4036 + \kern\normalbaselineskip
4.4037 + \fi
4.4038 + \nobreak
4.4039 +}
4.4040 +
4.4041 +
4.4042 +\message{toc,}
4.4043 +% Table of contents.
4.4044 +\newwrite\tocfile
4.4045 +
4.4046 +% Write an entry to the toc file, opening it if necessary.
4.4047 +% Called from @chapter, etc. We supply {\folio} at the end of the
4.4048 +% argument, which will end up as the last argument to the \...entry macro.
4.4049 +%
4.4050 +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
4.4051 +% We open the .toc file for writing here instead of at @setfilename (or
4.4052 +% any other fixed time) so that @contents can be anywhere in the document.
4.4053 +%
4.4054 +\newif\iftocfileopened
4.4055 +\def\writetocentry#1#2#3{%
4.4056 + \iftocfileopened\else
4.4057 + \immediate\openout\tocfile = \jobname.toc
4.4058 + \global\tocfileopenedtrue
4.4059 + \fi
4.4060 + %
4.4061 + \iflinks
4.4062 + \toks0 = {#2}%
4.4063 + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
4.4064 + \temp
4.4065 + \fi
4.4066 + %
4.4067 + % Tell \shipout to create a page destination if we're doing pdf, which
4.4068 + % will be the target of the links in the table of contents. We can't
4.4069 + % just do it on every page because the title pages are numbered 1 and
4.4070 + % 2 (the page numbers aren't printed), and so are the first two pages
4.4071 + % of the document. Thus, we'd have two destinations named `1', and
4.4072 + % two named `2'.
4.4073 + \ifpdf \pdfmakepagedesttrue \fi
4.4074 +}
4.4075 +
4.4076 +\newskip\contentsrightmargin \contentsrightmargin=1in
4.4077 +\newcount\savepageno
4.4078 +\newcount\lastnegativepageno \lastnegativepageno = -1
4.4079 +
4.4080 +% Finish up the main text and prepare to read what we've written
4.4081 +% to \tocfile.
4.4082 +%
4.4083 +\def\startcontents#1{%
4.4084 + % If @setchapternewpage on, and @headings double, the contents should
4.4085 + % start on an odd page, unlike chapters. Thus, we maintain
4.4086 + % \contentsalignmacro in parallel with \pagealignmacro.
4.4087 + % From: Torbjorn Granlund <tege@matematik.su.se>
4.4088 + \contentsalignmacro
4.4089 + \immediate\closeout\tocfile
4.4090 + %
4.4091 + % Don't need to put `Contents' or `Short Contents' in the headline.
4.4092 + % It is abundantly clear what they are.
4.4093 + \unnumbchapmacro{#1}\def\thischapter{}%
4.4094 + \savepageno = \pageno
4.4095 + \begingroup % Set up to handle contents files properly.
4.4096 + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
4.4097 + % We can't do this, because then an actual ^ in a section
4.4098 + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
4.4099 + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
4.4100 + \raggedbottom % Worry more about breakpoints than the bottom.
4.4101 + \advance\hsize by -\contentsrightmargin % Don't use the full line length.
4.4102 + %
4.4103 + % Roman numerals for page numbers.
4.4104 + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
4.4105 +}
4.4106 +
4.4107 +
4.4108 +% Normal (long) toc.
4.4109 +\def\contents{%
4.4110 + \startcontents{\putwordTOC}%
4.4111 + \openin 1 \jobname.toc
4.4112 + \ifeof 1 \else
4.4113 + \closein 1
4.4114 + \input \jobname.toc
4.4115 + \fi
4.4116 + \vfill \eject
4.4117 + \contentsalignmacro % in case @setchapternewpage odd is in effect
4.4118 + \pdfmakeoutlines
4.4119 + \endgroup
4.4120 + \lastnegativepageno = \pageno
4.4121 + \global\pageno = \savepageno
4.4122 +}
4.4123 +
4.4124 +% And just the chapters.
4.4125 +\def\summarycontents{%
4.4126 + \startcontents{\putwordShortTOC}%
4.4127 + %
4.4128 + \let\chapentry = \shortchapentry
4.4129 + \let\appendixentry = \shortappendixentry
4.4130 + \let\unnumbchapentry = \shortunnumberedentry
4.4131 + % We want a true roman here for the page numbers.
4.4132 + \secfonts
4.4133 + \let\rm=\shortcontrm \let\bf=\shortcontbf
4.4134 + \let\sl=\shortcontsl \let\tt=\shortconttt
4.4135 + \rm
4.4136 + \hyphenpenalty = 10000
4.4137 + \advance\baselineskip by 1pt % Open it up a little.
4.4138 + \def\secentry ##1##2##3##4{}
4.4139 + \def\subsecentry ##1##2##3##4##5{}
4.4140 + \def\subsubsecentry ##1##2##3##4##5##6{}
4.4141 + \let\unnumbsecentry = \secentry
4.4142 + \let\unnumbsubsecentry = \subsecentry
4.4143 + \let\unnumbsubsubsecentry = \subsubsecentry
4.4144 + \openin 1 \jobname.toc
4.4145 + \ifeof 1 \else
4.4146 + \closein 1
4.4147 + \input \jobname.toc
4.4148 + \fi
4.4149 + \vfill \eject
4.4150 + \contentsalignmacro % in case @setchapternewpage odd is in effect
4.4151 + \endgroup
4.4152 + \lastnegativepageno = \pageno
4.4153 + \global\pageno = \savepageno
4.4154 +}
4.4155 +\let\shortcontents = \summarycontents
4.4156 +
4.4157 +\ifpdf
4.4158 + \pdfcatalog{/PageMode /UseOutlines}%
4.4159 +\fi
4.4160 +
4.4161 +% These macros generate individual entries in the table of contents.
4.4162 +% The first argument is the chapter or section name.
4.4163 +% The last argument is the page number.
4.4164 +% The arguments in between are the chapter number, section number, ...
4.4165 +
4.4166 +% Chapters, in the main contents.
4.4167 +\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
4.4168 +%
4.4169 +% Chapters, in the short toc.
4.4170 +% See comments in \dochapentry re vbox and related settings.
4.4171 +\def\shortchapentry#1#2#3{%
4.4172 + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
4.4173 +}
4.4174 +
4.4175 +% Appendices, in the main contents.
4.4176 +\def\appendixentry#1#2#3{%
4.4177 + \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
4.4178 +%
4.4179 +% Appendices, in the short toc.
4.4180 +\let\shortappendixentry = \shortchapentry
4.4181 +
4.4182 +% Typeset the label for a chapter or appendix for the short contents.
4.4183 +% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
4.4184 +% We could simplify the code here by writing out an \appendixentry
4.4185 +% command in the toc file for appendices, instead of using \chapentry
4.4186 +% for both, but it doesn't seem worth it.
4.4187 +%
4.4188 +\newdimen\shortappendixwidth
4.4189 +%
4.4190 +\def\shortchaplabel#1{%
4.4191 + % This space should be enough, since a single number is .5em, and the
4.4192 + % widest letter (M) is 1em, at least in the Computer Modern fonts.
4.4193 + % But use \hss just in case.
4.4194 + % (This space doesn't include the extra space that gets added after
4.4195 + % the label; that gets put in by \shortchapentry above.)
4.4196 + \dimen0 = 1em
4.4197 + \hbox to \dimen0{#1\hss}%
4.4198 +}
4.4199 +
4.4200 +% Unnumbered chapters.
4.4201 +\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
4.4202 +\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
4.4203 +
4.4204 +% Sections.
4.4205 +\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
4.4206 +\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
4.4207 +
4.4208 +% Subsections.
4.4209 +\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
4.4210 +\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
4.4211 +
4.4212 +% And subsubsections.
4.4213 +\def\subsubsecentry#1#2#3#4#5#6{%
4.4214 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
4.4215 +\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
4.4216 +
4.4217 +% This parameter controls the indentation of the various levels.
4.4218 +\newdimen\tocindent \tocindent = 3pc
4.4219 +
4.4220 +% Now for the actual typesetting. In all these, #1 is the text and #2 is the
4.4221 +% page number.
4.4222 +%
4.4223 +% If the toc has to be broken over pages, we want it to be at chapters
4.4224 +% if at all possible; hence the \penalty.
4.4225 +\def\dochapentry#1#2{%
4.4226 + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
4.4227 + \begingroup
4.4228 + \chapentryfonts
4.4229 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4.4230 + \endgroup
4.4231 + \nobreak\vskip .25\baselineskip plus.1\baselineskip
4.4232 +}
4.4233 +
4.4234 +\def\dosecentry#1#2{\begingroup
4.4235 + \secentryfonts \leftskip=\tocindent
4.4236 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4.4237 +\endgroup}
4.4238 +
4.4239 +\def\dosubsecentry#1#2{\begingroup
4.4240 + \subsecentryfonts \leftskip=2\tocindent
4.4241 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4.4242 +\endgroup}
4.4243 +
4.4244 +\def\dosubsubsecentry#1#2{\begingroup
4.4245 + \subsubsecentryfonts \leftskip=3\tocindent
4.4246 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4.4247 +\endgroup}
4.4248 +
4.4249 +% Final typesetting of a toc entry; we use the same \entry macro as for
4.4250 +% the index entries, but we want to suppress hyphenation here. (We
4.4251 +% can't do that in the \entry macro, since index entries might consist
4.4252 +% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
4.4253 +\def\tocentry#1#2{\begingroup
4.4254 + \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
4.4255 + % Do not use \turnoffactive in these arguments. Since the toc is
4.4256 + % typeset in cmr, characters such as _ would come out wrong; we
4.4257 + % have to do the usual translation tricks.
4.4258 + \entry{#1}{#2}%
4.4259 +\endgroup}
4.4260 +
4.4261 +% Space between chapter (or whatever) number and the title.
4.4262 +\def\labelspace{\hskip1em \relax}
4.4263 +
4.4264 +\def\dopageno#1{{\rm #1}}
4.4265 +\def\doshortpageno#1{{\rm #1}}
4.4266 +
4.4267 +\def\chapentryfonts{\secfonts \rm}
4.4268 +\def\secentryfonts{\textfonts}
4.4269 +\let\subsecentryfonts = \textfonts
4.4270 +\let\subsubsecentryfonts = \textfonts
4.4271 +
4.4272 +
4.4273 +\message{environments,}
4.4274 +% @foo ... @end foo.
4.4275 +
4.4276 +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
4.4277 +%
4.4278 +% Since these characters are used in examples, it should be an even number of
4.4279 +% \tt widths. Each \tt character is 1en, so two makes it 1em.
4.4280 +%
4.4281 +\def\point{$\star$}
4.4282 +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
4.4283 +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
4.4284 +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
4.4285 +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
4.4286 +
4.4287 +% The @error{} command.
4.4288 +% Adapted from the TeXbook's \boxit.
4.4289 +%
4.4290 +\newbox\errorbox
4.4291 +%
4.4292 +{\tentt \global\dimen0 = 3em}% Width of the box.
4.4293 +\dimen2 = .55pt % Thickness of rules
4.4294 +% The text. (`r' is open on the right, `e' somewhat less so on the left.)
4.4295 +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
4.4296 +%
4.4297 +\global\setbox\errorbox=\hbox to \dimen0{\hfil
4.4298 + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
4.4299 + \advance\hsize by -2\dimen2 % Rules.
4.4300 + \vbox{
4.4301 + \hrule height\dimen2
4.4302 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
4.4303 + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
4.4304 + \kern3pt\vrule width\dimen2}% Space to right.
4.4305 + \hrule height\dimen2}
4.4306 + \hfil}
4.4307 +%
4.4308 +\def\error{\leavevmode\lower.7ex\copy\errorbox}
4.4309 +
4.4310 +% @tex ... @end tex escapes into raw Tex temporarily.
4.4311 +% One exception: @ is still an escape character, so that @end tex works.
4.4312 +% But \@ or @@ will get a plain tex @ character.
4.4313 +
4.4314 +\def\tex{\begingroup
4.4315 + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
4.4316 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
4.4317 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
4.4318 + \catcode `\%=14
4.4319 + \catcode `\+=\other
4.4320 + \catcode `\"=\other
4.4321 + \catcode `\==\other
4.4322 + \catcode `\|=\other
4.4323 + \catcode `\<=\other
4.4324 + \catcode `\>=\other
4.4325 + \escapechar=`\\
4.4326 + %
4.4327 + \let\b=\ptexb
4.4328 + \let\bullet=\ptexbullet
4.4329 + \let\c=\ptexc
4.4330 + \let\,=\ptexcomma
4.4331 + \let\.=\ptexdot
4.4332 + \let\dots=\ptexdots
4.4333 + \let\equiv=\ptexequiv
4.4334 + \let\!=\ptexexclam
4.4335 + \let\i=\ptexi
4.4336 + \let\indent=\ptexindent
4.4337 + \let\{=\ptexlbrace
4.4338 + \let\+=\tabalign
4.4339 + \let\}=\ptexrbrace
4.4340 + \let\/=\ptexslash
4.4341 + \let\*=\ptexstar
4.4342 + \let\t=\ptext
4.4343 + %
4.4344 + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
4.4345 + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
4.4346 + \def\@{@}%
4.4347 +\let\Etex=\endgroup}
4.4348 +
4.4349 +% Define @lisp ... @end lisp.
4.4350 +% @lisp does a \begingroup so it can rebind things,
4.4351 +% including the definition of @end lisp (which normally is erroneous).
4.4352 +
4.4353 +% Amount to narrow the margins by for @lisp.
4.4354 +\newskip\lispnarrowing \lispnarrowing=0.4in
4.4355 +
4.4356 +% This is the definition that ^^M gets inside @lisp, @example, and other
4.4357 +% such environments. \null is better than a space, since it doesn't
4.4358 +% have any width.
4.4359 +\def\lisppar{\null\endgraf}
4.4360 +
4.4361 +% Make each space character in the input produce a normal interword
4.4362 +% space in the output. Don't allow a line break at this space, as this
4.4363 +% is used only in environments like @example, where each line of input
4.4364 +% should produce a line of output anyway.
4.4365 +%
4.4366 +{\obeyspaces %
4.4367 +\gdef\sepspaces{\obeyspaces\let =\tie}}
4.4368 +
4.4369 +% Define \obeyedspace to be our active space, whatever it is. This is
4.4370 +% for use in \parsearg.
4.4371 +{\sepspaces%
4.4372 +\global\let\obeyedspace= }
4.4373 +
4.4374 +% This space is always present above and below environments.
4.4375 +\newskip\envskipamount \envskipamount = 0pt
4.4376 +
4.4377 +% Make spacing and below environment symmetrical. We use \parskip here
4.4378 +% to help in doing that, since in @example-like environments \parskip
4.4379 +% is reset to zero; thus the \afterenvbreak inserts no space -- but the
4.4380 +% start of the next paragraph will insert \parskip.
4.4381 +%
4.4382 +\def\aboveenvbreak{{%
4.4383 + % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
4.4384 + \ifnum \lastpenalty=10000 \else
4.4385 + \advance\envskipamount by \parskip
4.4386 + \endgraf
4.4387 + \ifdim\lastskip<\envskipamount
4.4388 + \removelastskip
4.4389 + % it's not a good place to break if the last penalty was \nobreak
4.4390 + % or better ...
4.4391 + \ifnum\lastpenalty>10000 \else \penalty-50 \fi
4.4392 + \vskip\envskipamount
4.4393 + \fi
4.4394 + \fi
4.4395 +}}
4.4396 +
4.4397 +\let\afterenvbreak = \aboveenvbreak
4.4398 +
4.4399 +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
4.4400 +\let\nonarrowing=\relax
4.4401 +
4.4402 +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
4.4403 +% environment contents.
4.4404 +\font\circle=lcircle10
4.4405 +\newdimen\circthick
4.4406 +\newdimen\cartouter\newdimen\cartinner
4.4407 +\newskip\normbskip\newskip\normpskip\newskip\normlskip
4.4408 +\circthick=\fontdimen8\circle
4.4409 +%
4.4410 +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4.4411 +\def\ctr{{\hskip 6pt\circle\char'010}}
4.4412 +\def\cbl{{\circle\char'012\hskip -6pt}}
4.4413 +\def\cbr{{\hskip 6pt\circle\char'011}}
4.4414 +\def\carttop{\hbox to \cartouter{\hskip\lskip
4.4415 + \ctl\leaders\hrule height\circthick\hfil\ctr
4.4416 + \hskip\rskip}}
4.4417 +\def\cartbot{\hbox to \cartouter{\hskip\lskip
4.4418 + \cbl\leaders\hrule height\circthick\hfil\cbr
4.4419 + \hskip\rskip}}
4.4420 +%
4.4421 +\newskip\lskip\newskip\rskip
4.4422 +
4.4423 +\def\cartouche{%
4.4424 +\par % can't be in the midst of a paragraph.
4.4425 +\begingroup
4.4426 + \lskip=\leftskip \rskip=\rightskip
4.4427 + \leftskip=0pt\rightskip=0pt %we want these *outside*.
4.4428 + \cartinner=\hsize \advance\cartinner by-\lskip
4.4429 + \advance\cartinner by-\rskip
4.4430 + \cartouter=\hsize
4.4431 + \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4.4432 +% side, and for 6pt waste from
4.4433 +% each corner char, and rule thickness
4.4434 + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4.4435 + % Flag to tell @lisp, etc., not to narrow margin.
4.4436 + \let\nonarrowing=\comment
4.4437 + \vbox\bgroup
4.4438 + \baselineskip=0pt\parskip=0pt\lineskip=0pt
4.4439 + \carttop
4.4440 + \hbox\bgroup
4.4441 + \hskip\lskip
4.4442 + \vrule\kern3pt
4.4443 + \vbox\bgroup
4.4444 + \hsize=\cartinner
4.4445 + \kern3pt
4.4446 + \begingroup
4.4447 + \baselineskip=\normbskip
4.4448 + \lineskip=\normlskip
4.4449 + \parskip=\normpskip
4.4450 + \vskip -\parskip
4.4451 +\def\Ecartouche{%
4.4452 + \endgroup
4.4453 + \kern3pt
4.4454 + \egroup
4.4455 + \kern3pt\vrule
4.4456 + \hskip\rskip
4.4457 + \egroup
4.4458 + \cartbot
4.4459 + \egroup
4.4460 +\endgroup
4.4461 +}}
4.4462 +
4.4463 +
4.4464 +% This macro is called at the beginning of all the @example variants,
4.4465 +% inside a group.
4.4466 +\def\nonfillstart{%
4.4467 + \aboveenvbreak
4.4468 + \inENV % This group ends at the end of the body
4.4469 + \hfuzz = 12pt % Don't be fussy
4.4470 + \sepspaces % Make spaces be word-separators rather than space tokens.
4.4471 + \let\par = \lisppar % don't ignore blank lines
4.4472 + \obeylines % each line of input is a line of output
4.4473 + \parskip = 0pt
4.4474 + \parindent = 0pt
4.4475 + \emergencystretch = 0pt % don't try to avoid overfull boxes
4.4476 + % @cartouche defines \nonarrowing to inhibit narrowing
4.4477 + % at next level down.
4.4478 + \ifx\nonarrowing\relax
4.4479 + \advance \leftskip by \lispnarrowing
4.4480 + \exdentamount=\lispnarrowing
4.4481 + \let\exdent=\nofillexdent
4.4482 + \let\nonarrowing=\relax
4.4483 + \fi
4.4484 +}
4.4485 +
4.4486 +% Define the \E... control sequence only if we are inside the particular
4.4487 +% environment, so the error checking in \end will work.
4.4488 +%
4.4489 +% To end an @example-like environment, we first end the paragraph (via
4.4490 +% \afterenvbreak's vertical glue), and then the group. That way we keep
4.4491 +% the zero \parskip that the environments set -- \parskip glue will be
4.4492 +% inserted at the beginning of the next paragraph in the document, after
4.4493 +% the environment.
4.4494 +%
4.4495 +\def\nonfillfinish{\afterenvbreak\endgroup}
4.4496 +
4.4497 +% @lisp: indented, narrowed, typewriter font.
4.4498 +\def\lisp{\begingroup
4.4499 + \nonfillstart
4.4500 + \let\Elisp = \nonfillfinish
4.4501 + \tt
4.4502 + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4.4503 + \gobble % eat return
4.4504 +}
4.4505 +
4.4506 +% @example: Same as @lisp.
4.4507 +\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4.4508 +
4.4509 +% @smallexample and @smalllisp: use smaller fonts.
4.4510 +% Originally contributed by Pavel@xerox.
4.4511 +\def\smalllisp{\begingroup
4.4512 + \def\Esmalllisp{\nonfillfinish\endgroup}%
4.4513 + \def\Esmallexample{\nonfillfinish\endgroup}%
4.4514 + \smallexamplefonts
4.4515 + \lisp
4.4516 +}
4.4517 +\let\smallexample = \smalllisp
4.4518 +
4.4519 +
4.4520 +% @display: same as @lisp except keep current font.
4.4521 +%
4.4522 +\def\display{\begingroup
4.4523 + \nonfillstart
4.4524 + \let\Edisplay = \nonfillfinish
4.4525 + \gobble
4.4526 +}
4.4527 +%
4.4528 +% @smalldisplay: @display plus smaller fonts.
4.4529 +%
4.4530 +\def\smalldisplay{\begingroup
4.4531 + \def\Esmalldisplay{\nonfillfinish\endgroup}%
4.4532 + \smallexamplefonts \rm
4.4533 + \display
4.4534 +}
4.4535 +
4.4536 +% @format: same as @display except don't narrow margins.
4.4537 +%
4.4538 +\def\format{\begingroup
4.4539 + \let\nonarrowing = t
4.4540 + \nonfillstart
4.4541 + \let\Eformat = \nonfillfinish
4.4542 + \gobble
4.4543 +}
4.4544 +%
4.4545 +% @smallformat: @format plus smaller fonts.
4.4546 +%
4.4547 +\def\smallformat{\begingroup
4.4548 + \def\Esmallformat{\nonfillfinish\endgroup}%
4.4549 + \smallexamplefonts \rm
4.4550 + \format
4.4551 +}
4.4552 +
4.4553 +% @flushleft (same as @format).
4.4554 +%
4.4555 +\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4.4556 +
4.4557 +% @flushright.
4.4558 +%
4.4559 +\def\flushright{\begingroup
4.4560 + \let\nonarrowing = t
4.4561 + \nonfillstart
4.4562 + \let\Eflushright = \nonfillfinish
4.4563 + \advance\leftskip by 0pt plus 1fill
4.4564 + \gobble
4.4565 +}
4.4566 +
4.4567 +
4.4568 +% @quotation does normal linebreaking (hence we can't use \nonfillstart)
4.4569 +% and narrows the margins.
4.4570 +%
4.4571 +\def\quotation{%
4.4572 + \begingroup\inENV %This group ends at the end of the @quotation body
4.4573 + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4.4574 + \parindent=0pt
4.4575 + % We have retained a nonzero parskip for the environment, since we're
4.4576 + % doing normal filling. So to avoid extra space below the environment...
4.4577 + \def\Equotation{\parskip = 0pt \nonfillfinish}%
4.4578 + %
4.4579 + % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4.4580 + \ifx\nonarrowing\relax
4.4581 + \advance\leftskip by \lispnarrowing
4.4582 + \advance\rightskip by \lispnarrowing
4.4583 + \exdentamount = \lispnarrowing
4.4584 + \let\nonarrowing = \relax
4.4585 + \fi
4.4586 +}
4.4587 +
4.4588 +
4.4589 +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
4.4590 +% If we want to allow any <char> as delimiter,
4.4591 +% we need the curly braces so that makeinfo sees the @verb command, eg:
4.4592 +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
4.4593 +%
4.4594 +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
4.4595 +%
4.4596 +% [Knuth] p.344; only we need to do the other characters Texinfo sets
4.4597 +% active too. Otherwise, they get lost as the first character on a
4.4598 +% verbatim line.
4.4599 +\def\dospecials{%
4.4600 + \do\ \do\\\do\{\do\}\do\$\do\&%
4.4601 + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
4.4602 + \do\<\do\>\do\|\do\@\do+\do\"%
4.4603 +}
4.4604 +%
4.4605 +% [Knuth] p. 380
4.4606 +\def\uncatcodespecials{%
4.4607 + \def\do##1{\catcode`##1=12}\dospecials}
4.4608 +%
4.4609 +% [Knuth] pp. 380,381,391
4.4610 +% Disable Spanish ligatures ?` and !` of \tt font
4.4611 +\begingroup
4.4612 + \catcode`\`=\active\gdef`{\relax\lq}
4.4613 +\endgroup
4.4614 +%
4.4615 +% Setup for the @verb command.
4.4616 +%
4.4617 +% Eight spaces for a tab
4.4618 +\begingroup
4.4619 + \catcode`\^^I=\active
4.4620 + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
4.4621 +\endgroup
4.4622 +%
4.4623 +\def\setupverb{%
4.4624 + \tt % easiest (and conventionally used) font for verbatim
4.4625 + \def\par{\leavevmode\endgraf}%
4.4626 + \catcode`\`=\active
4.4627 + \tabeightspaces
4.4628 + % Respect line breaks,
4.4629 + % print special symbols as themselves, and
4.4630 + % make each space count
4.4631 + % must do in this order:
4.4632 + \obeylines \uncatcodespecials \sepspaces
4.4633 +}
4.4634 +
4.4635 +% Setup for the @verbatim environment
4.4636 +%
4.4637 +% Real tab expansion
4.4638 +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
4.4639 +%
4.4640 +\def\starttabbox{\setbox0=\hbox\bgroup}
4.4641 +\begingroup
4.4642 + \catcode`\^^I=\active
4.4643 + \gdef\tabexpand{%
4.4644 + \catcode`\^^I=\active
4.4645 + \def^^I{\leavevmode\egroup
4.4646 + \dimen0=\wd0 % the width so far, or since the previous tab
4.4647 + \divide\dimen0 by\tabw
4.4648 + \multiply\dimen0 by\tabw % compute previous multiple of \tabw
4.4649 + \advance\dimen0 by\tabw % advance to next multiple of \tabw
4.4650 + \wd0=\dimen0 \box0 \starttabbox
4.4651 + }%
4.4652 + }
4.4653 +\endgroup
4.4654 +\def\setupverbatim{%
4.4655 + % Easiest (and conventionally used) font for verbatim
4.4656 + \tt
4.4657 + \def\par{\leavevmode\egroup\box0\endgraf}%
4.4658 + \catcode`\`=\active
4.4659 + \tabexpand
4.4660 + % Respect line breaks,
4.4661 + % print special symbols as themselves, and
4.4662 + % make each space count
4.4663 + % must do in this order:
4.4664 + \obeylines \uncatcodespecials \sepspaces
4.4665 + \everypar{\starttabbox}%
4.4666 +}
4.4667 +
4.4668 +% Do the @verb magic: verbatim text is quoted by unique
4.4669 +% delimiter characters. Before first delimiter expect a
4.4670 +% right brace, after last delimiter expect closing brace:
4.4671 +%
4.4672 +% \def\doverb'{'<char>#1<char>'}'{#1}
4.4673 +%
4.4674 +% [Knuth] p. 382; only eat outer {}
4.4675 +\begingroup
4.4676 + \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
4.4677 + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
4.4678 +\endgroup
4.4679 +%
4.4680 +\def\verb{\begingroup\setupverb\doverb}
4.4681 +%
4.4682 +%
4.4683 +% Do the @verbatim magic: define the macro \doverbatim so that
4.4684 +% the (first) argument ends when '@end verbatim' is reached, ie:
4.4685 +%
4.4686 +% \def\doverbatim#1@end verbatim{#1}
4.4687 +%
4.4688 +% For Texinfo it's a lot easier than for LaTeX,
4.4689 +% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
4.4690 +% we need not redefine '\', '{' and '}'.
4.4691 +%
4.4692 +% Inspired by LaTeX's verbatim command set [latex.ltx]
4.4693 +%% Include LaTeX hack for completeness -- never know
4.4694 +%% \begingroup
4.4695 +%% \catcode`|=0 \catcode`[=1
4.4696 +%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
4.4697 +%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
4.4698 +%% #1|endgroup|def|Everbatim[]|end[verbatim]]
4.4699 +%% |endgroup
4.4700 +%
4.4701 +\begingroup
4.4702 + \catcode`\ =\active
4.4703 + \obeylines %
4.4704 + % ignore everything up to the first ^^M, that's the newline at the end
4.4705 + % of the @verbatim input line itself. Otherwise we get an extra blank
4.4706 + % line in the output.
4.4707 + \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
4.4708 +\endgroup
4.4709 +%
4.4710 +\def\verbatim{%
4.4711 + \def\Everbatim{\nonfillfinish\endgroup}%
4.4712 + \begingroup
4.4713 + \nonfillstart
4.4714 + \advance\leftskip by -\defbodyindent
4.4715 + \begingroup\setupverbatim\doverbatim
4.4716 +}
4.4717 +
4.4718 +% @verbatiminclude FILE - insert text of file in verbatim environment.
4.4719 +%
4.4720 +% Allow normal characters that we make active in the argument (a file name).
4.4721 +\def\verbatiminclude{%
4.4722 + \begingroup
4.4723 + \catcode`\\=\other
4.4724 + \catcode`~=\other
4.4725 + \catcode`^=\other
4.4726 + \catcode`_=\other
4.4727 + \catcode`|=\other
4.4728 + \catcode`<=\other
4.4729 + \catcode`>=\other
4.4730 + \catcode`+=\other
4.4731 + \parsearg\doverbatiminclude
4.4732 +}
4.4733 +\def\setupverbatiminclude{%
4.4734 + \begingroup
4.4735 + \nonfillstart
4.4736 + \advance\leftskip by -\defbodyindent
4.4737 + \begingroup\setupverbatim
4.4738 +}
4.4739 +%
4.4740 +\def\doverbatiminclude#1{%
4.4741 + % Restore active chars for included file.
4.4742 + \endgroup
4.4743 + \begingroup
4.4744 + \let\value=\expandablevalue
4.4745 + \def\thisfile{#1}%
4.4746 + \expandafter\expandafter\setupverbatiminclude\input\thisfile
4.4747 + \endgroup
4.4748 + \nonfillfinish
4.4749 + \endgroup
4.4750 +}
4.4751 +
4.4752 +% @copying ... @end copying.
4.4753 +% Save the text away for @insertcopying later. Many commands won't be
4.4754 +% allowed in this context, but that's ok.
4.4755 +%
4.4756 +% We save the uninterpreted tokens, rather than creating a box.
4.4757 +% Saving the text in a box would be much easier, but then all the
4.4758 +% typesetting commands (@smallbook, font changes, etc.) have to be done
4.4759 +% beforehand -- and a) we want @copying to be done first in the source
4.4760 +% file; b) letting users define the frontmatter in as flexible order as
4.4761 +% possible is very desirable.
4.4762 +%
4.4763 +\def\copying{\begingroup
4.4764 + % Define a command to swallow text until we reach `@end copying'.
4.4765 + % \ is the escape char in this texinfo.tex file, so it is the
4.4766 + % delimiter for the command; @ will be the escape char when we read
4.4767 + % it, but that doesn't matter.
4.4768 + \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
4.4769 + %
4.4770 + % We must preserve ^^M's in the input file; see \insertcopying below.
4.4771 + \catcode`\^^M = \active
4.4772 + \docopying
4.4773 +}
4.4774 +
4.4775 +% What we do to finish off the copying text.
4.4776 +%
4.4777 +\def\enddocopying{\endgroup\ignorespaces}
4.4778 +
4.4779 +% @insertcopying. Here we must play games with ^^M's. On the one hand,
4.4780 +% we need them to delimit commands such as `@end quotation', so they
4.4781 +% must be active. On the other hand, we certainly don't want every
4.4782 +% end-of-line to be a \par, as would happen with the normal active
4.4783 +% definition of ^^M. On the third hand, two ^^M's in a row should still
4.4784 +% generate a \par.
4.4785 +%
4.4786 +% Our approach is to make ^^M insert a space and a penalty1 normally;
4.4787 +% then it can also check if \lastpenalty=1. If it does, then manually
4.4788 +% do \par.
4.4789 +%
4.4790 +% This messes up the normal definitions of @c[omment], so we redefine
4.4791 +% it. Similarly for @ignore. (These commands are used in the gcc
4.4792 +% manual for man page generation.)
4.4793 +%
4.4794 +% Seems pretty fragile, most line-oriented commands will presumably
4.4795 +% fail, but for the limited use of getting the copying text (which
4.4796 +% should be quite simple) inserted, we can hope it's ok.
4.4797 +%
4.4798 +{\catcode`\^^M=\active %
4.4799 +\gdef\insertcopying{\begingroup %
4.4800 + \parindent = 0pt % looks wrong on title page
4.4801 + \def^^M{%
4.4802 + \ifnum \lastpenalty=1 %
4.4803 + \par %
4.4804 + \else %
4.4805 + \space \penalty 1 %
4.4806 + \fi %
4.4807 + }%
4.4808 + %
4.4809 + % Fix @c[omment] for catcode 13 ^^M's.
4.4810 + \def\c##1^^M{\ignorespaces}%
4.4811 + \let\comment = \c %
4.4812 + %
4.4813 + % Don't bother jumping through all the hoops that \doignore does, it
4.4814 + % would be very hard since the catcodes are already set.
4.4815 + \long\def\ignore##1\end ignore{\ignorespaces}%
4.4816 + %
4.4817 + \copyingtext %
4.4818 +\endgroup}%
4.4819 +}
4.4820 +
4.4821 +\message{defuns,}
4.4822 +% @defun etc.
4.4823 +
4.4824 +% Allow user to change definition object font (\df) internally
4.4825 +\def\setdeffont#1 {\csname DEF#1\endcsname}
4.4826 +
4.4827 +\newskip\defbodyindent \defbodyindent=.4in
4.4828 +\newskip\defargsindent \defargsindent=50pt
4.4829 +\newskip\deflastargmargin \deflastargmargin=18pt
4.4830 +
4.4831 +\newcount\parencount
4.4832 +
4.4833 +% We want ()&[] to print specially on the defun line.
4.4834 +%
4.4835 +\def\activeparens{%
4.4836 + \catcode`\(=\active \catcode`\)=\active
4.4837 + \catcode`\&=\active
4.4838 + \catcode`\[=\active \catcode`\]=\active
4.4839 +}
4.4840 +
4.4841 +% Make control sequences which act like normal parenthesis chars.
4.4842 +\let\lparen = ( \let\rparen = )
4.4843 +
4.4844 +{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4.4845 +
4.4846 +% Be sure that we always have a definition for `(', etc. For example,
4.4847 +% if the fn name has parens in it, \boldbrax will not be in effect yet,
4.4848 +% so TeX would otherwise complain about undefined control sequence.
4.4849 +\global\let(=\lparen \global\let)=\rparen
4.4850 +\global\let[=\lbrack \global\let]=\rbrack
4.4851 +
4.4852 +\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4.4853 +\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4.4854 +% This is used to turn on special parens
4.4855 +% but make & act ordinary (given that it's active).
4.4856 +\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4.4857 +
4.4858 +% Definitions of (, ) and & used in args for functions.
4.4859 +% This is the definition of ( outside of all parentheses.
4.4860 +\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4.4861 + \global\advance\parencount by 1
4.4862 +}
4.4863 +%
4.4864 +% This is the definition of ( when already inside a level of parens.
4.4865 +\gdef\opnested{\char`\(\global\advance\parencount by 1 }
4.4866 +%
4.4867 +\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4.4868 + % also in that case restore the outer-level definition of (.
4.4869 + \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4.4870 + \global\advance \parencount by -1 }
4.4871 +% If we encounter &foo, then turn on ()-hacking afterwards
4.4872 +\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
4.4873 +%
4.4874 +\gdef\normalparens{\boldbrax\let&=\ampnr}
4.4875 +} % End of definition inside \activeparens
4.4876 +%% These parens (in \boldbrax) actually are a little bolder than the
4.4877 +%% contained text. This is especially needed for [ and ]
4.4878 +\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4.4879 +\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4.4880 +\let\ampnr = \&
4.4881 +\def\lbrb{{\bf\char`\[}}
4.4882 +\def\rbrb{{\bf\char`\]}}
4.4883 +
4.4884 +% Active &'s sneak into the index arguments, so make sure it's defined.
4.4885 +{
4.4886 + \catcode`& = \active
4.4887 + \global\let& = \ampnr
4.4888 +}
4.4889 +
4.4890 +% \defname, which formats the name of the @def (not the args).
4.4891 +% #1 is the function name.
4.4892 +% #2 is the type of definition, such as "Function".
4.4893 +%
4.4894 +\def\defname#1#2{%
4.4895 + % How we'll output the type name. Putting it in brackets helps
4.4896 + % distinguish it from the body text that may end up on the next line
4.4897 + % just below it.
4.4898 + \ifempty{#2}%
4.4899 + \def\defnametype{}%
4.4900 + \else
4.4901 + \def\defnametype{[\rm #2]}%
4.4902 + \fi
4.4903 + %
4.4904 + % Get the values of \leftskip and \rightskip as they were outside the @def...
4.4905 + \dimen2=\leftskip
4.4906 + \advance\dimen2 by -\defbodyindent
4.4907 + %
4.4908 + % Figure out values for the paragraph shape.
4.4909 + \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
4.4910 + \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4.4911 + \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations
4.4912 + \parshape 2 0in \dimen0 \defargsindent \dimen1
4.4913 + %
4.4914 + % Output arg 2 ("Function" or some such) but stuck inside a box of
4.4915 + % width 0 so it does not interfere with linebreaking.
4.4916 + \noindent
4.4917 + %
4.4918 + {% Adjust \hsize to exclude the ambient margins,
4.4919 + % so that \rightline will obey them.
4.4920 + \advance \hsize by -\dimen2
4.4921 + \dimen3 = 0pt % was -1.25pc
4.4922 + \rlap{\rightline{\defnametype\kern\dimen3}}%
4.4923 + }%
4.4924 + %
4.4925 + % Allow all lines to be underfull without complaint:
4.4926 + \tolerance=10000 \hbadness=10000
4.4927 + \advance\leftskip by -\defbodyindent
4.4928 + \exdentamount=\defbodyindent
4.4929 + {\df #1}\enskip % output function name
4.4930 + % \defunargs will be called next to output the arguments, if any.
4.4931 +}
4.4932 +
4.4933 +% Common pieces to start any @def...
4.4934 +% #1 is the \E... control sequence to end the definition (which we define).
4.4935 +% #2 is the \...x control sequence (which our caller defines).
4.4936 +% #3 is the control sequence to process the header, such as \defunheader.
4.4937 +%
4.4938 +\def\parsebodycommon#1#2#3{%
4.4939 + \begingroup\inENV
4.4940 + % If there are two @def commands in a row, we'll have a \nobreak,
4.4941 + % which is there to keep the function description together with its
4.4942 + % header. But if there's nothing but headers, we want to allow a
4.4943 + % break after all. Check for penalty 10002 (inserted by
4.4944 + % \defargscommonending) instead of 10000, since the sectioning
4.4945 + % commands insert a \penalty10000, and we don't want to allow a break
4.4946 + % between a section heading and a defun.
4.4947 + \ifnum\lastpenalty=10002 \penalty0 \fi
4.4948 + \medbreak
4.4949 + %
4.4950 + % Define the \E... end token that this defining construct specifies
4.4951 + % so that it will exit this group.
4.4952 + \def#1{\endgraf\endgroup\medbreak}%
4.4953 + %
4.4954 + \parindent=0in
4.4955 + \advance\leftskip by \defbodyindent
4.4956 + \exdentamount=\defbodyindent
4.4957 +}
4.4958 +
4.4959 +% Common part of the \...x definitions.
4.4960 +%
4.4961 +\def\defxbodycommon{%
4.4962 + % As with \parsebodycommon above, allow line break if we have multiple
4.4963 + % x headers in a row. It's not a great place, though.
4.4964 + \ifnum\lastpenalty=10000 \penalty1000 \fi
4.4965 + %
4.4966 + \begingroup\obeylines
4.4967 +}
4.4968 +
4.4969 +% Process body of @defun, @deffn, @defmac, etc.
4.4970 +%
4.4971 +\def\defparsebody#1#2#3{%
4.4972 + \parsebodycommon{#1}{#2}{#3}%
4.4973 + \def#2{\defxbodycommon \activeparens \spacesplit#3}%
4.4974 + \catcode\equalChar=\active
4.4975 + \begingroup\obeylines\activeparens
4.4976 + \spacesplit#3%
4.4977 +}
4.4978 +
4.4979 +% #1, #2, #3 are the common arguments (see \parsebodycommon above).
4.4980 +% #4, delimited by the space, is the class name.
4.4981 +%
4.4982 +\def\defmethparsebody#1#2#3#4 {%
4.4983 + \parsebodycommon{#1}{#2}{#3}%
4.4984 + \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
4.4985 + \begingroup\obeylines\activeparens
4.4986 + % The \empty here prevents misinterpretation of a construct such as
4.4987 + % @deffn {whatever} {Enharmonic comma}
4.4988 + % See comments at \deftpparsebody, although in our case we don't have
4.4989 + % to remove the \empty afterwards, since it is empty.
4.4990 + \spacesplit{#3{#4}}\empty
4.4991 +}
4.4992 +
4.4993 +% Used for @deftypemethod and @deftypeivar.
4.4994 +% #1, #2, #3 are the common arguments (see \defparsebody).
4.4995 +% #4, delimited by a space, is the class name.
4.4996 +% #5 is the method's return type.
4.4997 +%
4.4998 +\def\deftypemethparsebody#1#2#3#4 #5 {%
4.4999 + \parsebodycommon{#1}{#2}{#3}%
4.5000 + \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
4.5001 + \begingroup\obeylines\activeparens
4.5002 + \spacesplit{#3{#4}{#5}}%
4.5003 +}
4.5004 +
4.5005 +% Used for @deftypeop. The change from \deftypemethparsebody is an
4.5006 +% extra argument at the beginning which is the `category', instead of it
4.5007 +% being the hardwired string `Method' or `Instance Variable'. We have
4.5008 +% to account for this both in the \...x definition and in parsing the
4.5009 +% input at hand. Thus also need a control sequence (passed as #5) for
4.5010 +% the \E... definition to assign the category name to.
4.5011 +%
4.5012 +\def\deftypeopparsebody#1#2#3#4#5 #6 {%
4.5013 + \parsebodycommon{#1}{#2}{#3}%
4.5014 + \def#2##1 ##2 ##3 {\def#4{##1}%
4.5015 + \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
4.5016 + \begingroup\obeylines\activeparens
4.5017 + \spacesplit{#3{#5}{#6}}%
4.5018 +}
4.5019 +
4.5020 +% For @defop.
4.5021 +\def\defopparsebody #1#2#3#4#5 {%
4.5022 + \parsebodycommon{#1}{#2}{#3}%
4.5023 + \def#2##1 ##2 {\def#4{##1}%
4.5024 + \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
4.5025 + \begingroup\obeylines\activeparens
4.5026 + \spacesplit{#3{#5}}%
4.5027 +}
4.5028 +
4.5029 +% These parsing functions are similar to the preceding ones
4.5030 +% except that they do not make parens into active characters.
4.5031 +% These are used for "variables" since they have no arguments.
4.5032 +%
4.5033 +\def\defvarparsebody #1#2#3{%
4.5034 + \parsebodycommon{#1}{#2}{#3}%
4.5035 + \def#2{\defxbodycommon \spacesplit#3}%
4.5036 + \catcode\equalChar=\active
4.5037 + \begingroup\obeylines
4.5038 + \spacesplit#3%
4.5039 +}
4.5040 +
4.5041 +% @defopvar.
4.5042 +\def\defopvarparsebody #1#2#3#4#5 {%
4.5043 + \parsebodycommon{#1}{#2}{#3}%
4.5044 + \def#2##1 ##2 {\def#4{##1}%
4.5045 + \defxbodycommon \spacesplit{#3{##2}}}%
4.5046 + \begingroup\obeylines
4.5047 + \spacesplit{#3{#5}}%
4.5048 +}
4.5049 +
4.5050 +\def\defvrparsebody#1#2#3#4 {%
4.5051 + \parsebodycommon{#1}{#2}{#3}%
4.5052 + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
4.5053 + \begingroup\obeylines
4.5054 + \spacesplit{#3{#4}}%
4.5055 +}
4.5056 +
4.5057 +% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4.5058 +% type is just `struct', because we lose the braces in `{struct
4.5059 +% termios}' when \spacesplit reads its undelimited argument. Sigh.
4.5060 +% \let\deftpparsebody=\defvrparsebody
4.5061 +%
4.5062 +% So, to get around this, we put \empty in with the type name. That
4.5063 +% way, TeX won't find exactly `{...}' as an undelimited argument, and
4.5064 +% won't strip off the braces.
4.5065 +%
4.5066 +\def\deftpparsebody #1#2#3#4 {%
4.5067 + \parsebodycommon{#1}{#2}{#3}%
4.5068 + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
4.5069 + \begingroup\obeylines
4.5070 + \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4.5071 +}
4.5072 +
4.5073 +% Fine, but then we have to eventually remove the \empty *and* the
4.5074 +% braces (if any). That's what this does.
4.5075 +%
4.5076 +\def\removeemptybraces\empty#1\relax{#1}
4.5077 +
4.5078 +% After \spacesplit has done its work, this is called -- #1 is the final
4.5079 +% thing to call, #2 the type name (which starts with \empty), and #3
4.5080 +% (which might be empty) the arguments.
4.5081 +%
4.5082 +\def\parsetpheaderline#1#2#3{%
4.5083 + #1{\removeemptybraces#2\relax}{#3}%
4.5084 +}%
4.5085 +
4.5086 +% Split up #2 (the rest of the input line) at the first space token.
4.5087 +% call #1 with two arguments:
4.5088 +% the first is all of #2 before the space token,
4.5089 +% the second is all of #2 after that space token.
4.5090 +% If #2 contains no space token, all of it is passed as the first arg
4.5091 +% and the second is passed as empty.
4.5092 +%
4.5093 +{\obeylines %
4.5094 + \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
4.5095 + \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
4.5096 + \ifx\relax #3%
4.5097 + #1{#2}{}%
4.5098 + \else %
4.5099 + #1{#2}{#3#4}%
4.5100 + \fi}%
4.5101 +}
4.5102 +
4.5103 +% Define @defun.
4.5104 +
4.5105 +% This is called to end the arguments processing for all the @def... commands.
4.5106 +%
4.5107 +\def\defargscommonending{%
4.5108 + \interlinepenalty = 10000
4.5109 + \advance\rightskip by 0pt plus 1fil
4.5110 + \endgraf
4.5111 + \nobreak\vskip -\parskip
4.5112 + \penalty 10002 % signal to \parsebodycommon.
4.5113 +}
4.5114 +
4.5115 +% This expands the args and terminates the paragraph they comprise.
4.5116 +%
4.5117 +\def\defunargs#1{\functionparens \sl
4.5118 +% Expand, preventing hyphenation at `-' chars.
4.5119 +% Note that groups don't affect changes in \hyphenchar.
4.5120 +% Set the font temporarily and use \font in case \setfont made \tensl a macro.
4.5121 +{\tensl\hyphenchar\font=0}%
4.5122 +#1%
4.5123 +{\tensl\hyphenchar\font=45}%
4.5124 +\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4.5125 + \defargscommonending
4.5126 +}
4.5127 +
4.5128 +\def\deftypefunargs #1{%
4.5129 +% Expand, preventing hyphenation at `-' chars.
4.5130 +% Note that groups don't affect changes in \hyphenchar.
4.5131 +% Use \boldbraxnoamp, not \functionparens, so that & is not special.
4.5132 +\boldbraxnoamp
4.5133 +\tclose{#1}% avoid \code because of side effects on active chars
4.5134 + \defargscommonending
4.5135 +}
4.5136 +
4.5137 +% Do complete processing of one @defun or @defunx line already parsed.
4.5138 +
4.5139 +% @deffn Command forward-char nchars
4.5140 +
4.5141 +\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4.5142 +
4.5143 +\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4.5144 +\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4.5145 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5146 +}
4.5147 +
4.5148 +% @defun == @deffn Function
4.5149 +
4.5150 +\def\defun{\defparsebody\Edefun\defunx\defunheader}
4.5151 +
4.5152 +\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4.5153 +\begingroup\defname {#1}{\putwordDeffunc}%
4.5154 +\defunargs {#2}\endgroup %
4.5155 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5156 +}
4.5157 +
4.5158 +% @deftypefun int foobar (int @var{foo}, float @var{bar})
4.5159 +
4.5160 +\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4.5161 +
4.5162 +% #1 is the data type. #2 is the name and args.
4.5163 +\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4.5164 +% #1 is the data type, #2 the name, #3 the args.
4.5165 +\def\deftypefunheaderx #1#2 #3\relax{%
4.5166 +\doind {fn}{\code{#2}}% Make entry in function index
4.5167 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
4.5168 +\deftypefunargs {#3}\endgroup %
4.5169 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5170 +}
4.5171 +
4.5172 +% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4.5173 +
4.5174 +\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4.5175 +
4.5176 +% \defheaderxcond#1\relax$.$
4.5177 +% puts #1 in @code, followed by a space, but does nothing if #1 is null.
4.5178 +\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
4.5179 +
4.5180 +% #1 is the classification. #2 is the data type. #3 is the name and args.
4.5181 +\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4.5182 +% #1 is the classification, #2 the data type, #3 the name, #4 the args.
4.5183 +\def\deftypefnheaderx #1#2#3 #4\relax{%
4.5184 +\doind {fn}{\code{#3}}% Make entry in function index
4.5185 +\begingroup
4.5186 +\normalparens % notably, turn off `&' magic, which prevents
4.5187 +% at least some C++ text from working
4.5188 +\defname {\defheaderxcond#2\relax$.$#3}{#1}%
4.5189 +\deftypefunargs {#4}\endgroup %
4.5190 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5191 +}
4.5192 +
4.5193 +% @defmac == @deffn Macro
4.5194 +
4.5195 +\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4.5196 +
4.5197 +\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4.5198 +\begingroup\defname {#1}{\putwordDefmac}%
4.5199 +\defunargs {#2}\endgroup %
4.5200 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5201 +}
4.5202 +
4.5203 +% @defspec == @deffn Special Form
4.5204 +
4.5205 +\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4.5206 +
4.5207 +\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4.5208 +\begingroup\defname {#1}{\putwordDefspec}%
4.5209 +\defunargs {#2}\endgroup %
4.5210 +\catcode\equalChar=\other % Turn off change made in \defparsebody
4.5211 +}
4.5212 +
4.5213 +% @defop CATEGORY CLASS OPERATION ARG...
4.5214 +%
4.5215 +\def\defop #1 {\def\defoptype{#1}%
4.5216 +\defopparsebody\Edefop\defopx\defopheader\defoptype}
4.5217 +%
4.5218 +\def\defopheader#1#2#3{%
4.5219 + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
4.5220 + \begingroup
4.5221 + \defname{#2}{\defoptype\ \putwordon\ #1}%
4.5222 + \defunargs{#3}%
4.5223 + \endgroup
4.5224 +}
4.5225 +
4.5226 +% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
4.5227 +%
4.5228 +\def\deftypeop #1 {\def\deftypeopcategory{#1}%
4.5229 + \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
4.5230 + \deftypeopcategory}
4.5231 +%
4.5232 +% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
4.5233 +\def\deftypeopheader#1#2#3#4{%
4.5234 + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4.5235 + \begingroup
4.5236 + \defname{\defheaderxcond#2\relax$.$#3}
4.5237 + {\deftypeopcategory\ \putwordon\ \code{#1}}%
4.5238 + \deftypefunargs{#4}%
4.5239 + \endgroup
4.5240 +}
4.5241 +
4.5242 +% @deftypemethod CLASS TYPE METHOD ARG...
4.5243 +%
4.5244 +\def\deftypemethod{%
4.5245 + \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4.5246 +%
4.5247 +% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4.5248 +\def\deftypemethodheader#1#2#3#4{%
4.5249 + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4.5250 + \begingroup
4.5251 + \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
4.5252 + \deftypefunargs{#4}%
4.5253 + \endgroup
4.5254 +}
4.5255 +
4.5256 +% @deftypeivar CLASS TYPE VARNAME
4.5257 +%
4.5258 +\def\deftypeivar{%
4.5259 + \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
4.5260 +%
4.5261 +% #1 is the class name, #2 the data type, #3 the variable name.
4.5262 +\def\deftypeivarheader#1#2#3{%
4.5263 + \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
4.5264 + \begingroup
4.5265 + \defname{\defheaderxcond#2\relax$.$#3}
4.5266 + {\putwordInstanceVariableof\ \code{#1}}%
4.5267 + \defvarargs{#3}%
4.5268 + \endgroup
4.5269 +}
4.5270 +
4.5271 +% @defmethod == @defop Method
4.5272 +%
4.5273 +\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4.5274 +%
4.5275 +% #1 is the class name, #2 the method name, #3 the args.
4.5276 +\def\defmethodheader#1#2#3{%
4.5277 + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4.5278 + \begingroup
4.5279 + \defname{#2}{\putwordMethodon\ \code{#1}}%
4.5280 + \defunargs{#3}%
4.5281 + \endgroup
4.5282 +}
4.5283 +
4.5284 +% @defcv {Class Option} foo-class foo-flag
4.5285 +
4.5286 +\def\defcv #1 {\def\defcvtype{#1}%
4.5287 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4.5288 +
4.5289 +\def\defcvarheader #1#2#3{%
4.5290 + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
4.5291 + \begingroup
4.5292 + \defname{#2}{\defcvtype\ \putwordof\ #1}%
4.5293 + \defvarargs{#3}%
4.5294 + \endgroup
4.5295 +}
4.5296 +
4.5297 +% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
4.5298 +%
4.5299 +\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4.5300 +%
4.5301 +\def\defivarheader#1#2#3{%
4.5302 + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
4.5303 + \begingroup
4.5304 + \defname{#2}{\putwordInstanceVariableof\ #1}%
4.5305 + \defvarargs{#3}%
4.5306 + \endgroup
4.5307 +}
4.5308 +
4.5309 +% @defvar
4.5310 +% First, define the processing that is wanted for arguments of @defvar.
4.5311 +% This is actually simple: just print them in roman.
4.5312 +% This must expand the args and terminate the paragraph they make up
4.5313 +\def\defvarargs #1{\normalparens #1%
4.5314 + \defargscommonending
4.5315 +}
4.5316 +
4.5317 +% @defvr Counter foo-count
4.5318 +
4.5319 +\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4.5320 +
4.5321 +\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4.5322 +\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4.5323 +
4.5324 +% @defvar == @defvr Variable
4.5325 +
4.5326 +\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4.5327 +
4.5328 +\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4.5329 +\begingroup\defname {#1}{\putwordDefvar}%
4.5330 +\defvarargs {#2}\endgroup %
4.5331 +}
4.5332 +
4.5333 +% @defopt == @defvr {User Option}
4.5334 +
4.5335 +\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4.5336 +
4.5337 +\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4.5338 +\begingroup\defname {#1}{\putwordDefopt}%
4.5339 +\defvarargs {#2}\endgroup %
4.5340 +}
4.5341 +
4.5342 +% @deftypevar int foobar
4.5343 +
4.5344 +\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4.5345 +
4.5346 +% #1 is the data type. #2 is the name, perhaps followed by text that
4.5347 +% is actually part of the data type, which should not be put into the index.
4.5348 +\def\deftypevarheader #1#2{%
4.5349 +\dovarind#2 \relax% Make entry in variables index
4.5350 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
4.5351 + \defargscommonending
4.5352 +\endgroup}
4.5353 +\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4.5354 +
4.5355 +% @deftypevr {Global Flag} int enable
4.5356 +
4.5357 +\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4.5358 +
4.5359 +\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4.5360 +\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
4.5361 + \defargscommonending
4.5362 +\endgroup}
4.5363 +
4.5364 +% Now define @deftp
4.5365 +% Args are printed in bold, a slight difference from @defvar.
4.5366 +
4.5367 +\def\deftpargs #1{\bf \defvarargs{#1}}
4.5368 +
4.5369 +% @deftp Class window height width ...
4.5370 +
4.5371 +\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4.5372 +
4.5373 +\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4.5374 +\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4.5375 +
4.5376 +% These definitions are used if you use @defunx (etc.)
4.5377 +% anywhere other than immediately after a @defun or @defunx.
4.5378 +%
4.5379 +\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
4.5380 +\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
4.5381 +\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
4.5382 +\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
4.5383 +\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
4.5384 +\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4.5385 +\def\defopx#1 {\errmessage{@defopx in invalid context}}
4.5386 +\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
4.5387 +\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
4.5388 +\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
4.5389 +\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
4.5390 +\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
4.5391 +\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
4.5392 +\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
4.5393 +\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
4.5394 +\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
4.5395 +\def\defunx#1 {\errmessage{@defunx in invalid context}}
4.5396 +\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
4.5397 +\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4.5398 +
4.5399 +
4.5400 +\message{macros,}
4.5401 +% @macro.
4.5402 +
4.5403 +% To do this right we need a feature of e-TeX, \scantokens,
4.5404 +% which we arrange to emulate with a temporary file in ordinary TeX.
4.5405 +\ifx\eTeXversion\undefined
4.5406 + \newwrite\macscribble
4.5407 + \def\scanmacro#1{%
4.5408 + \begingroup \newlinechar`\^^M
4.5409 + % Undo catcode changes of \startcontents and \doprintindex
4.5410 + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
4.5411 + % Append \endinput to make sure that TeX does not see the ending newline.
4.5412 + \toks0={#1\endinput}%
4.5413 + \immediate\openout\macscribble=\jobname.tmp
4.5414 + \immediate\write\macscribble{\the\toks0}%
4.5415 + \immediate\closeout\macscribble
4.5416 + \let\xeatspaces\eatspaces
4.5417 + \input \jobname.tmp
4.5418 + \endgroup
4.5419 +}
4.5420 +\else
4.5421 +\def\scanmacro#1{%
4.5422 +\begingroup \newlinechar`\^^M
4.5423 +% Undo catcode changes of \startcontents and \doprintindex
4.5424 +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@
4.5425 +\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
4.5426 +\fi
4.5427 +
4.5428 +\newcount\paramno % Count of parameters
4.5429 +\newtoks\macname % Macro name
4.5430 +\newif\ifrecursive % Is it recursive?
4.5431 +\def\macrolist{} % List of all defined macros in the form
4.5432 + % \do\macro1\do\macro2...
4.5433 +
4.5434 +% Utility routines.
4.5435 +% Thisdoes \let #1 = #2, except with \csnames.
4.5436 +\def\cslet#1#2{%
4.5437 +\expandafter\expandafter
4.5438 +\expandafter\let
4.5439 +\expandafter\expandafter
4.5440 +\csname#1\endcsname
4.5441 +\csname#2\endcsname}
4.5442 +
4.5443 +% Trim leading and trailing spaces off a string.
4.5444 +% Concepts from aro-bend problem 15 (see CTAN).
4.5445 +{\catcode`\@=11
4.5446 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4.5447 +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4.5448 +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4.5449 +\def\unbrace#1{#1}
4.5450 +\unbrace{\gdef\trim@@@ #1 } #2@{#1}
4.5451 +}
4.5452 +
4.5453 +% Trim a single trailing ^^M off a string.
4.5454 +{\catcode`\^^M=\other \catcode`\Q=3%
4.5455 +\gdef\eatcr #1{\eatcra #1Q^^MQ}%
4.5456 +\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4.5457 +\gdef\eatcrb#1Q#2Q{#1}%
4.5458 +}
4.5459 +
4.5460 +% Macro bodies are absorbed as an argument in a context where
4.5461 +% all characters are catcode 10, 11 or 12, except \ which is active
4.5462 +% (as in normal texinfo). It is necessary to change the definition of \.
4.5463 +
4.5464 +% It's necessary to have hard CRs when the macro is executed. This is
4.5465 +% done by making ^^M (\endlinechar) catcode 12 when reading the macro
4.5466 +% body, and then making it the \newlinechar in \scanmacro.
4.5467 +
4.5468 +\def\macrobodyctxt{%
4.5469 + \catcode`\~=\other
4.5470 + \catcode`\^=\other
4.5471 + \catcode`\_=\other
4.5472 + \catcode`\|=\other
4.5473 + \catcode`\<=\other
4.5474 + \catcode`\>=\other
4.5475 + \catcode`\+=\other
4.5476 + \catcode`\{=\other
4.5477 + \catcode`\}=\other
4.5478 + \catcode`\@=\other
4.5479 + \catcode`\^^M=\other
4.5480 + \usembodybackslash}
4.5481 +
4.5482 +\def\macroargctxt{%
4.5483 + \catcode`\~=\other
4.5484 + \catcode`\^=\other
4.5485 + \catcode`\_=\other
4.5486 + \catcode`\|=\other
4.5487 + \catcode`\<=\other
4.5488 + \catcode`\>=\other
4.5489 + \catcode`\+=\other
4.5490 + \catcode`\@=\other
4.5491 + \catcode`\\=\other}
4.5492 +
4.5493 +% \mbodybackslash is the definition of \ in @macro bodies.
4.5494 +% It maps \foo\ => \csname macarg.foo\endcsname => #N
4.5495 +% where N is the macro parameter number.
4.5496 +% We define \csname macarg.\endcsname to be \realbackslash, so
4.5497 +% \\ in macro replacement text gets you a backslash.
4.5498 +
4.5499 +{\catcode`@=0 @catcode`@\=@active
4.5500 + @gdef@usembodybackslash{@let\=@mbodybackslash}
4.5501 + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4.5502 +}
4.5503 +\expandafter\def\csname macarg.\endcsname{\realbackslash}
4.5504 +
4.5505 +\def\macro{\recursivefalse\parsearg\macroxxx}
4.5506 +\def\rmacro{\recursivetrue\parsearg\macroxxx}
4.5507 +
4.5508 +\def\macroxxx#1{%
4.5509 + \getargs{#1}% now \macname is the macname and \argl the arglist
4.5510 + \ifx\argl\empty % no arguments
4.5511 + \paramno=0%
4.5512 + \else
4.5513 + \expandafter\parsemargdef \argl;%
4.5514 + \fi
4.5515 + \if1\csname ismacro.\the\macname\endcsname
4.5516 + \message{Warning: redefining \the\macname}%
4.5517 + \else
4.5518 + \expandafter\ifx\csname \the\macname\endcsname \relax
4.5519 + \else \errmessage{Macro name \the\macname\space already defined}\fi
4.5520 + \global\cslet{macsave.\the\macname}{\the\macname}%
4.5521 + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
4.5522 + % Add the macroname to \macrolist
4.5523 + \toks0 = \expandafter{\macrolist\do}%
4.5524 + \xdef\macrolist{\the\toks0
4.5525 + \expandafter\noexpand\csname\the\macname\endcsname}%
4.5526 + \fi
4.5527 + \begingroup \macrobodyctxt
4.5528 + \ifrecursive \expandafter\parsermacbody
4.5529 + \else \expandafter\parsemacbody
4.5530 + \fi}
4.5531 +
4.5532 +\def\unmacro{\parsearg\dounmacro}
4.5533 +\def\dounmacro#1{%
4.5534 + \if1\csname ismacro.#1\endcsname
4.5535 + \global\cslet{#1}{macsave.#1}%
4.5536 + \global\expandafter\let \csname ismacro.#1\endcsname=0%
4.5537 + % Remove the macro name from \macrolist:
4.5538 + \begingroup
4.5539 + \expandafter\let\csname#1\endcsname \relax
4.5540 + \let\do\unmacrodo
4.5541 + \xdef\macrolist{\macrolist}%
4.5542 + \endgroup
4.5543 + \else
4.5544 + \errmessage{Macro #1 not defined}%
4.5545 + \fi
4.5546 +}
4.5547 +
4.5548 +% Called by \do from \dounmacro on each macro. The idea is to omit any
4.5549 +% macro definitions that have been changed to \relax.
4.5550 +%
4.5551 +\def\unmacrodo#1{%
4.5552 + \ifx#1\relax
4.5553 + % remove this
4.5554 + \else
4.5555 + \noexpand\do \noexpand #1%
4.5556 + \fi
4.5557 +}
4.5558 +
4.5559 +% This makes use of the obscure feature that if the last token of a
4.5560 +% <parameter list> is #, then the preceding argument is delimited by
4.5561 +% an opening brace, and that opening brace is not consumed.
4.5562 +\def\getargs#1{\getargsxxx#1{}}
4.5563 +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4.5564 +\def\getmacname #1 #2\relax{\macname={#1}}
4.5565 +\def\getmacargs#1{\def\argl{#1}}
4.5566 +
4.5567 +% Parse the optional {params} list. Set up \paramno and \paramlist
4.5568 +% so \defmacro knows what to do. Define \macarg.blah for each blah
4.5569 +% in the params list, to be ##N where N is the position in that list.
4.5570 +% That gets used by \mbodybackslash (above).
4.5571 +
4.5572 +% We need to get `macro parameter char #' into several definitions.
4.5573 +% The technique used is stolen from LaTeX: let \hash be something
4.5574 +% unexpandable, insert that wherever you need a #, and then redefine
4.5575 +% it to # just before using the token list produced.
4.5576 +%
4.5577 +% The same technique is used to protect \eatspaces till just before
4.5578 +% the macro is used.
4.5579 +
4.5580 +\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4.5581 + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
4.5582 +\def\parsemargdefxxx#1,{%
4.5583 + \if#1;\let\next=\relax
4.5584 + \else \let\next=\parsemargdefxxx
4.5585 + \advance\paramno by 1%
4.5586 + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
4.5587 + {\xeatspaces{\hash\the\paramno}}%
4.5588 + \edef\paramlist{\paramlist\hash\the\paramno,}%
4.5589 + \fi\next}
4.5590 +
4.5591 +% These two commands read recursive and nonrecursive macro bodies.
4.5592 +% (They're different since rec and nonrec macros end differently.)
4.5593 +
4.5594 +\long\def\parsemacbody#1@end macro%
4.5595 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4.5596 +\long\def\parsermacbody#1@end rmacro%
4.5597 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4.5598 +
4.5599 +% This defines the macro itself. There are six cases: recursive and
4.5600 +% nonrecursive macros of zero, one, and many arguments.
4.5601 +% Much magic with \expandafter here.
4.5602 +% \xdef is used so that macro definitions will survive the file
4.5603 +% they're defined in; @include reads the file inside a group.
4.5604 +\def\defmacro{%
4.5605 + \let\hash=##% convert placeholders to macro parameter chars
4.5606 + \ifrecursive
4.5607 + \ifcase\paramno
4.5608 + % 0
4.5609 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5610 + \noexpand\scanmacro{\temp}}%
4.5611 + \or % 1
4.5612 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5613 + \bgroup\noexpand\macroargctxt
4.5614 + \noexpand\braceorline
4.5615 + \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4.5616 + \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4.5617 + \egroup\noexpand\scanmacro{\temp}}%
4.5618 + \else % many
4.5619 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5620 + \bgroup\noexpand\macroargctxt
4.5621 + \noexpand\csname\the\macname xx\endcsname}%
4.5622 + \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4.5623 + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
4.5624 + \expandafter\expandafter
4.5625 + \expandafter\xdef
4.5626 + \expandafter\expandafter
4.5627 + \csname\the\macname xxx\endcsname
4.5628 + \paramlist{\egroup\noexpand\scanmacro{\temp}}%
4.5629 + \fi
4.5630 + \else
4.5631 + \ifcase\paramno
4.5632 + % 0
4.5633 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5634 + \noexpand\norecurse{\the\macname}%
4.5635 + \noexpand\scanmacro{\temp}\egroup}%
4.5636 + \or % 1
4.5637 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5638 + \bgroup\noexpand\macroargctxt
4.5639 + \noexpand\braceorline
4.5640 + \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4.5641 + \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4.5642 + \egroup
4.5643 + \noexpand\norecurse{\the\macname}%
4.5644 + \noexpand\scanmacro{\temp}\egroup}%
4.5645 + \else % many
4.5646 + \expandafter\xdef\csname\the\macname\endcsname{%
4.5647 + \bgroup\noexpand\macroargctxt
4.5648 + \expandafter\noexpand\csname\the\macname xx\endcsname}%
4.5649 + \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4.5650 + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
4.5651 + \expandafter\expandafter
4.5652 + \expandafter\xdef
4.5653 + \expandafter\expandafter
4.5654 + \csname\the\macname xxx\endcsname
4.5655 + \paramlist{%
4.5656 + \egroup
4.5657 + \noexpand\norecurse{\the\macname}%
4.5658 + \noexpand\scanmacro{\temp}\egroup}%
4.5659 + \fi
4.5660 + \fi}
4.5661 +
4.5662 +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
4.5663 +
4.5664 +% \braceorline decides whether the next nonwhitespace character is a
4.5665 +% {. If so it reads up to the closing }, if not, it reads the whole
4.5666 +% line. Whatever was read is then fed to the next control sequence
4.5667 +% as an argument (by \parsebrace or \parsearg)
4.5668 +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
4.5669 +\def\braceorlinexxx{%
4.5670 + \ifx\nchar\bgroup\else
4.5671 + \expandafter\parsearg
4.5672 + \fi \next}
4.5673 +
4.5674 +% We mant to disable all macros during \shipout so that they are not
4.5675 +% expanded by \write.
4.5676 +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
4.5677 + \edef\next{\macrolist}\expandafter\endgroup\next}
4.5678 +
4.5679 +
4.5680 +% @alias.
4.5681 +% We need some trickery to remove the optional spaces around the equal
4.5682 +% sign. Just make them active and then expand them all to nothing.
4.5683 +\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
4.5684 +\def\aliasxxx #1{\aliasyyy#1\relax}
4.5685 +\def\aliasyyy #1=#2\relax{\ignoreactivespaces
4.5686 +\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
4.5687 + \expandafter\noexpand\csname#2\endcsname}%
4.5688 +\expandafter\endgroup\next}
4.5689 +
4.5690 +
4.5691 +\message{cross references,}
4.5692 +% @xref etc.
4.5693 +
4.5694 +\newwrite\auxfile
4.5695 +
4.5696 +\newif\ifhavexrefs % True if xref values are known.
4.5697 +\newif\ifwarnedxrefs % True if we warned once that they aren't known.
4.5698 +
4.5699 +% @inforef is relatively simple.
4.5700 +\def\inforef #1{\inforefzzz #1,,,,**}
4.5701 +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4.5702 + node \samp{\ignorespaces#1{}}}
4.5703 +
4.5704 +% @node's job is to define \lastnode.
4.5705 +\def\node{\ENVcheck\parsearg\nodezzz}
4.5706 +\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
4.5707 +\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
4.5708 +\let\nwnode=\node
4.5709 +\let\lastnode=\relax
4.5710 +
4.5711 +% The sectioning commands (@chapter, etc.) call these.
4.5712 +\def\donoderef{%
4.5713 + \ifx\lastnode\relax\else
4.5714 + \expandafter\expandafter\expandafter\setref{\lastnode}%
4.5715 + {Ysectionnumberandtype}%
4.5716 + \global\let\lastnode=\relax
4.5717 + \fi
4.5718 +}
4.5719 +\def\unnumbnoderef{%
4.5720 + \ifx\lastnode\relax\else
4.5721 + \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
4.5722 + \global\let\lastnode=\relax
4.5723 + \fi
4.5724 +}
4.5725 +\def\appendixnoderef{%
4.5726 + \ifx\lastnode\relax\else
4.5727 + \expandafter\expandafter\expandafter\setref{\lastnode}%
4.5728 + {Yappendixletterandtype}%
4.5729 + \global\let\lastnode=\relax
4.5730 + \fi
4.5731 +}
4.5732 +
4.5733 +
4.5734 +% @anchor{NAME} -- define xref target at arbitrary point.
4.5735 +%
4.5736 +\newcount\savesfregister
4.5737 +\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
4.5738 +\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
4.5739 +\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
4.5740 +
4.5741 +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
4.5742 +% anchor), namely NAME-title (the corresponding @chapter/etc. name),
4.5743 +% NAME-pg (the page number), and NAME-snt (section number and type).
4.5744 +% Called from \foonoderef.
4.5745 +%
4.5746 +% We have to set \indexdummies so commands such as @code in a section
4.5747 +% title aren't expanded. It would be nicer not to expand the titles in
4.5748 +% the first place, but there's so many layers that that is hard to do.
4.5749 +%
4.5750 +% Likewise, use \turnoffactive so that punctuation chars such as underscore
4.5751 +% and backslash work in node names.
4.5752 +%
4.5753 +\def\setref#1#2{{%
4.5754 + \atdummies
4.5755 + \pdfmkdest{#1}%
4.5756 + %
4.5757 + \turnoffactive
4.5758 + \dosetq{#1-title}{Ytitle}%
4.5759 + \dosetq{#1-pg}{Ypagenumber}%
4.5760 + \dosetq{#1-snt}{#2}%
4.5761 +}}
4.5762 +
4.5763 +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
4.5764 +% the node name, #2 the name of the Info cross-reference, #3 the printed
4.5765 +% node name, #4 the name of the Info file, #5 the name of the printed
4.5766 +% manual. All but the node name can be omitted.
4.5767 +%
4.5768 +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4.5769 +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4.5770 +\def\ref#1{\xrefX[#1,,,,,,,]}
4.5771 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4.5772 + \unsepspaces
4.5773 + \def\printedmanual{\ignorespaces #5}%
4.5774 + \def\printednodename{\ignorespaces #3}%
4.5775 + \setbox1=\hbox{\printedmanual}%
4.5776 + \setbox0=\hbox{\printednodename}%
4.5777 + \ifdim \wd0 = 0pt
4.5778 + % No printed node name was explicitly given.
4.5779 + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4.5780 + % Use the node name inside the square brackets.
4.5781 + \def\printednodename{\ignorespaces #1}%
4.5782 + \else
4.5783 + % Use the actual chapter/section title appear inside
4.5784 + % the square brackets. Use the real section title if we have it.
4.5785 + \ifdim \wd1 > 0pt
4.5786 + % It is in another manual, so we don't have it.
4.5787 + \def\printednodename{\ignorespaces #1}%
4.5788 + \else
4.5789 + \ifhavexrefs
4.5790 + % We know the real title if we have the xref values.
4.5791 + \def\printednodename{\refx{#1-title}{}}%
4.5792 + \else
4.5793 + % Otherwise just copy the Info node name.
4.5794 + \def\printednodename{\ignorespaces #1}%
4.5795 + \fi%
4.5796 + \fi
4.5797 + \fi
4.5798 + \fi
4.5799 + %
4.5800 + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4.5801 + % insert empty discretionaries after hyphens, which means that it will
4.5802 + % not find a line break at a hyphen in a node names. Since some manuals
4.5803 + % are best written with fairly long node names, containing hyphens, this
4.5804 + % is a loss. Therefore, we give the text of the node name again, so it
4.5805 + % is as if TeX is seeing it for the first time.
4.5806 + \ifpdf
4.5807 + \leavevmode
4.5808 + \getfilename{#4}%
4.5809 + {\turnoffactive \otherbackslash
4.5810 + \ifnum\filenamelength>0
4.5811 + \startlink attr{/Border [0 0 0]}%
4.5812 + goto file{\the\filename.pdf} name{#1}%
4.5813 + \else
4.5814 + \startlink attr{/Border [0 0 0]}%
4.5815 + goto name{#1}%
4.5816 + \fi
4.5817 + }%
4.5818 + \linkcolor
4.5819 + \fi
4.5820 + %
4.5821 + \ifdim \wd1 > 0pt
4.5822 + \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
4.5823 + \else
4.5824 + % _ (for example) has to be the character _ for the purposes of the
4.5825 + % control sequence corresponding to the node, but it has to expand
4.5826 + % into the usual \leavevmode...\vrule stuff for purposes of
4.5827 + % printing. So we \turnoffactive for the \refx-snt, back on for the
4.5828 + % printing, back off for the \refx-pg.
4.5829 + {\turnoffactive \otherbackslash
4.5830 + % Only output a following space if the -snt ref is nonempty; for
4.5831 + % @unnumbered and @anchor, it won't be.
4.5832 + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
4.5833 + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
4.5834 + }%
4.5835 + % output the `[mynode]' via a macro.
4.5836 + \xrefprintnodename\printednodename
4.5837 + %
4.5838 + % But we always want a comma and a space:
4.5839 + ,\space
4.5840 + %
4.5841 + % output the `page 3'.
4.5842 + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
4.5843 + \fi
4.5844 + \endlink
4.5845 +\endgroup}
4.5846 +
4.5847 +% This macro is called from \xrefX for the `[nodename]' part of xref
4.5848 +% output. It's a separate macro only so it can be changed more easily,
4.5849 +% since not square brackets don't work in some documents. Particularly
4.5850 +% one that Bob is working on :).
4.5851 +%
4.5852 +\def\xrefprintnodename#1{[#1]}
4.5853 +
4.5854 +% \dosetq is called from \setref to do the actual \write (\iflinks).
4.5855 +%
4.5856 +\def\dosetq#1#2{%
4.5857 + {\let\folio=0%
4.5858 + \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
4.5859 + \iflinks \next \fi
4.5860 + }%
4.5861 +}
4.5862 +
4.5863 +% \internalsetq{foo}{page} expands into
4.5864 +% CHARACTERS @xrdef{foo}{...expansion of \page...}
4.5865 +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
4.5866 +
4.5867 +% Things to be expanded by \internalsetq.
4.5868 +%
4.5869 +\def\Ypagenumber{\folio}
4.5870 +\def\Ytitle{\thissection}
4.5871 +\def\Ynothing{}
4.5872 +\def\Ysectionnumberandtype{%
4.5873 + \ifnum\secno=0
4.5874 + \putwordChapter@tie \the\chapno
4.5875 + \else \ifnum\subsecno=0
4.5876 + \putwordSection@tie \the\chapno.\the\secno
4.5877 + \else \ifnum\subsubsecno=0
4.5878 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
4.5879 + \else
4.5880 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
4.5881 + \fi\fi\fi
4.5882 +}
4.5883 +
4.5884 +\def\Yappendixletterandtype{%
4.5885 + \ifnum\secno=0
4.5886 + \putwordAppendix@tie @char\the\appendixno{}%
4.5887 + \else \ifnum\subsecno=0
4.5888 + \putwordSection@tie @char\the\appendixno.\the\secno
4.5889 + \else \ifnum\subsubsecno=0
4.5890 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
4.5891 + \else
4.5892 + \putwordSection@tie
4.5893 + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
4.5894 + \fi\fi\fi
4.5895 +}
4.5896 +
4.5897 +% Use TeX 3.0's \inputlineno to get the line number, for better error
4.5898 +% messages, but if we're using an old version of TeX, don't do anything.
4.5899 +%
4.5900 +\ifx\inputlineno\thisisundefined
4.5901 + \let\linenumber = \empty % Pre-3.0.
4.5902 +\else
4.5903 + \def\linenumber{\the\inputlineno:\space}
4.5904 +\fi
4.5905 +
4.5906 +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4.5907 +% If its value is nonempty, SUFFIX is output afterward.
4.5908 +%
4.5909 +\def\refx#1#2{%
4.5910 + {%
4.5911 + \indexnofonts
4.5912 + \otherbackslash
4.5913 + \expandafter\global\expandafter\let\expandafter\thisrefX
4.5914 + \csname X#1\endcsname
4.5915 + }%
4.5916 + \ifx\thisrefX\relax
4.5917 + % If not defined, say something at least.
4.5918 + \angleleft un\-de\-fined\angleright
4.5919 + \iflinks
4.5920 + \ifhavexrefs
4.5921 + \message{\linenumber Undefined cross reference `#1'.}%
4.5922 + \else
4.5923 + \ifwarnedxrefs\else
4.5924 + \global\warnedxrefstrue
4.5925 + \message{Cross reference values unknown; you must run TeX again.}%
4.5926 + \fi
4.5927 + \fi
4.5928 + \fi
4.5929 + \else
4.5930 + % It's defined, so just use it.
4.5931 + \thisrefX
4.5932 + \fi
4.5933 + #2% Output the suffix in any case.
4.5934 +}
4.5935 +
4.5936 +% This is the macro invoked by entries in the aux file.
4.5937 +%
4.5938 +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
4.5939 +
4.5940 +% Read the last existing aux file, if any. No error if none exists.
4.5941 +\def\readauxfile{\begingroup
4.5942 + \catcode`\^^@=\other
4.5943 + \catcode`\^^A=\other
4.5944 + \catcode`\^^B=\other
4.5945 + \catcode`\^^C=\other
4.5946 + \catcode`\^^D=\other
4.5947 + \catcode`\^^E=\other
4.5948 + \catcode`\^^F=\other
4.5949 + \catcode`\^^G=\other
4.5950 + \catcode`\^^H=\other
4.5951 + \catcode`\^^K=\other
4.5952 + \catcode`\^^L=\other
4.5953 + \catcode`\^^N=\other
4.5954 + \catcode`\^^P=\other
4.5955 + \catcode`\^^Q=\other
4.5956 + \catcode`\^^R=\other
4.5957 + \catcode`\^^S=\other
4.5958 + \catcode`\^^T=\other
4.5959 + \catcode`\^^U=\other
4.5960 + \catcode`\^^V=\other
4.5961 + \catcode`\^^W=\other
4.5962 + \catcode`\^^X=\other
4.5963 + \catcode`\^^Z=\other
4.5964 + \catcode`\^^[=\other
4.5965 + \catcode`\^^\=\other
4.5966 + \catcode`\^^]=\other
4.5967 + \catcode`\^^^=\other
4.5968 + \catcode`\^^_=\other
4.5969 + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
4.5970 + % in xref tags, i.e., node names. But since ^^e4 notation isn't
4.5971 + % supported in the main text, it doesn't seem desirable. Furthermore,
4.5972 + % that is not enough: for node names that actually contain a ^
4.5973 + % character, we would end up writing a line like this: 'xrdef {'hat
4.5974 + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4.5975 + % argument, and \hat is not an expandable control sequence. It could
4.5976 + % all be worked out, but why? Either we support ^^ or we don't.
4.5977 + %
4.5978 + % The other change necessary for this was to define \auxhat:
4.5979 + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4.5980 + % and then to call \auxhat in \setq.
4.5981 + %
4.5982 + \catcode`\^=\other
4.5983 + %
4.5984 + % Special characters. Should be turned off anyway, but...
4.5985 + \catcode`\~=\other
4.5986 + \catcode`\[=\other
4.5987 + \catcode`\]=\other
4.5988 + \catcode`\"=\other
4.5989 + \catcode`\_=\other
4.5990 + \catcode`\|=\other
4.5991 + \catcode`\<=\other
4.5992 + \catcode`\>=\other
4.5993 + \catcode`\$=\other
4.5994 + \catcode`\#=\other
4.5995 + \catcode`\&=\other
4.5996 + \catcode`\%=\other
4.5997 + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
4.5998 + %
4.5999 + % Make the characters 128-255 be printing characters
4.6000 + {%
4.6001 + \count 1=128
4.6002 + \def\loop{%
4.6003 + \catcode\count 1=\other
4.6004 + \advance\count 1 by 1
4.6005 + \ifnum \count 1<256 \loop \fi
4.6006 + }%
4.6007 + }%
4.6008 + %
4.6009 + % Turn off \ as an escape so we do not lose on
4.6010 + % entries which were dumped with control sequences in their names.
4.6011 + % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
4.6012 + % Reference to such entries still does not work the way one would wish,
4.6013 + % but at least they do not bomb out when the aux file is read in.
4.6014 + \catcode`\\=\other
4.6015 + %
4.6016 + % @ is our escape character in .aux files.
4.6017 + \catcode`\{=1
4.6018 + \catcode`\}=2
4.6019 + \catcode`\@=0
4.6020 + %
4.6021 + \openin 1 \jobname.aux
4.6022 + \ifeof 1 \else
4.6023 + \closein 1
4.6024 + \input \jobname.aux
4.6025 + \global\havexrefstrue
4.6026 + \fi
4.6027 + % Open the new aux file. TeX will close it automatically at exit.
4.6028 + \openout\auxfile=\jobname.aux
4.6029 +\endgroup}
4.6030 +
4.6031 +
4.6032 +% Footnotes.
4.6033 +
4.6034 +\newcount \footnoteno
4.6035 +
4.6036 +% The trailing space in the following definition for supereject is
4.6037 +% vital for proper filling; pages come out unaligned when you do a
4.6038 +% pagealignmacro call if that space before the closing brace is
4.6039 +% removed. (Generally, numeric constants should always be followed by a
4.6040 +% space to prevent strange expansion errors.)
4.6041 +\def\supereject{\par\penalty -20000\footnoteno =0 }
4.6042 +
4.6043 +% @footnotestyle is meaningful for info output only.
4.6044 +\let\footnotestyle=\comment
4.6045 +
4.6046 +\let\ptexfootnote=\footnote
4.6047 +
4.6048 +{\catcode `\@=11
4.6049 +%
4.6050 +% Auto-number footnotes. Otherwise like plain.
4.6051 +\gdef\footnote{%
4.6052 + \let\indent=\ptexindent
4.6053 + \global\advance\footnoteno by \@ne
4.6054 + \edef\thisfootno{$^{\the\footnoteno}$}%
4.6055 + %
4.6056 + % In case the footnote comes at the end of a sentence, preserve the
4.6057 + % extra spacing after we do the footnote number.
4.6058 + \let\@sf\empty
4.6059 + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
4.6060 + %
4.6061 + % Remove inadvertent blank space before typesetting the footnote number.
4.6062 + \unskip
4.6063 + \thisfootno\@sf
4.6064 + \dofootnote
4.6065 +}%
4.6066 +
4.6067 +% Don't bother with the trickery in plain.tex to not require the
4.6068 +% footnote text as a parameter. Our footnotes don't need to be so general.
4.6069 +%
4.6070 +% Oh yes, they do; otherwise, @ifset and anything else that uses
4.6071 +% \parseargline fail inside footnotes because the tokens are fixed when
4.6072 +% the footnote is read. --karl, 16nov96.
4.6073 +%
4.6074 +% The start of the footnote looks usually like this:
4.6075 +\gdef\startfootins{\insert\footins\bgroup}
4.6076 +%
4.6077 +% ... but this macro is redefined inside @multitable.
4.6078 +%
4.6079 +\gdef\dofootnote{%
4.6080 + \startfootins
4.6081 + % We want to typeset this text as a normal paragraph, even if the
4.6082 + % footnote reference occurs in (for example) a display environment.
4.6083 + % So reset some parameters.
4.6084 + \hsize=\pagewidth
4.6085 + \interlinepenalty\interfootnotelinepenalty
4.6086 + \splittopskip\ht\strutbox % top baseline for broken footnotes
4.6087 + \splitmaxdepth\dp\strutbox
4.6088 + \floatingpenalty\@MM
4.6089 + \leftskip\z@skip
4.6090 + \rightskip\z@skip
4.6091 + \spaceskip\z@skip
4.6092 + \xspaceskip\z@skip
4.6093 + \parindent\defaultparindent
4.6094 + %
4.6095 + \smallfonts \rm
4.6096 + %
4.6097 + % Because we use hanging indentation in footnotes, a @noindent appears
4.6098 + % to exdent this text, so make it be a no-op. makeinfo does not use
4.6099 + % hanging indentation so @noindent can still be needed within footnote
4.6100 + % text after an @example or the like (not that this is good style).
4.6101 + \let\noindent = \relax
4.6102 + %
4.6103 + % Hang the footnote text off the number. Use \everypar in case the
4.6104 + % footnote extends for more than one paragraph.
4.6105 + \everypar = {\hang}%
4.6106 + \textindent{\thisfootno}%
4.6107 + %
4.6108 + % Don't crash into the line above the footnote text. Since this
4.6109 + % expands into a box, it must come within the paragraph, lest it
4.6110 + % provide a place where TeX can split the footnote.
4.6111 + \footstrut
4.6112 + \futurelet\next\fo@t
4.6113 +}
4.6114 +}%end \catcode `\@=11
4.6115 +
4.6116 +% @| inserts a changebar to the left of the current line. It should
4.6117 +% surround any changed text. This approach does *not* work if the
4.6118 +% change spans more than two lines of output. To handle that, we would
4.6119 +% have adopt a much more difficult approach (putting marks into the main
4.6120 +% vertical list for the beginning and end of each change).
4.6121 +%
4.6122 +\def\|{%
4.6123 + % \vadjust can only be used in horizontal mode.
4.6124 + \leavevmode
4.6125 + %
4.6126 + % Append this vertical mode material after the current line in the output.
4.6127 + \vadjust{%
4.6128 + % We want to insert a rule with the height and depth of the current
4.6129 + % leading; that is exactly what \strutbox is supposed to record.
4.6130 + \vskip-\baselineskip
4.6131 + %
4.6132 + % \vadjust-items are inserted at the left edge of the type. So
4.6133 + % the \llap here moves out into the left-hand margin.
4.6134 + \llap{%
4.6135 + %
4.6136 + % For a thicker or thinner bar, change the `1pt'.
4.6137 + \vrule height\baselineskip width1pt
4.6138 + %
4.6139 + % This is the space between the bar and the text.
4.6140 + \hskip 12pt
4.6141 + }%
4.6142 + }%
4.6143 +}
4.6144 +
4.6145 +% For a final copy, take out the rectangles
4.6146 +% that mark overfull boxes (in case you have decided
4.6147 +% that the text looks ok even though it passes the margin).
4.6148 +%
4.6149 +\def\finalout{\overfullrule=0pt}
4.6150 +
4.6151 +% @image. We use the macros from epsf.tex to support this.
4.6152 +% If epsf.tex is not installed and @image is used, we complain.
4.6153 +%
4.6154 +% Check for and read epsf.tex up front. If we read it only at @image
4.6155 +% time, we might be inside a group, and then its definitions would get
4.6156 +% undone and the next image would fail.
4.6157 +\openin 1 = epsf.tex
4.6158 +\ifeof 1 \else
4.6159 + \closein 1
4.6160 + % Do not bother showing banner with epsf.tex v2.7k (available in
4.6161 + % doc/epsf.tex and on ctan).
4.6162 + \def\epsfannounce{\toks0 = }%
4.6163 + \input epsf.tex
4.6164 +\fi
4.6165 +%
4.6166 +% We will only complain once about lack of epsf.tex.
4.6167 +\newif\ifwarnednoepsf
4.6168 +\newhelp\noepsfhelp{epsf.tex must be installed for images to
4.6169 + work. It is also included in the Texinfo distribution, or you can get
4.6170 + it from ftp://tug.org/tex/epsf.tex.}
4.6171 +%
4.6172 +\def\image#1{%
4.6173 + \ifx\epsfbox\undefined
4.6174 + \ifwarnednoepsf \else
4.6175 + \errhelp = \noepsfhelp
4.6176 + \errmessage{epsf.tex not found, images will be ignored}%
4.6177 + \global\warnednoepsftrue
4.6178 + \fi
4.6179 + \else
4.6180 + \imagexxx #1,,,,,\finish
4.6181 + \fi
4.6182 +}
4.6183 +%
4.6184 +% Arguments to @image:
4.6185 +% #1 is (mandatory) image filename; we tack on .eps extension.
4.6186 +% #2 is (optional) width, #3 is (optional) height.
4.6187 +% #4 is (ignored optional) html alt text.
4.6188 +% #5 is (ignored optional) extension.
4.6189 +% #6 is just the usual extra ignored arg for parsing this stuff.
4.6190 +\newif\ifimagevmode
4.6191 +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
4.6192 + \catcode`\^^M = 5 % in case we're inside an example
4.6193 + \normalturnoffactive % allow _ et al. in names
4.6194 + % If the image is by itself, center it.
4.6195 + \ifvmode
4.6196 + \imagevmodetrue
4.6197 + \nobreak\bigskip
4.6198 + % Usually we'll have text after the image which will insert
4.6199 + % \parskip glue, so insert it here too to equalize the space
4.6200 + % above and below.
4.6201 + \nobreak\vskip\parskip
4.6202 + \nobreak
4.6203 + \line\bgroup\hss
4.6204 + \fi
4.6205 + %
4.6206 + % Output the image.
4.6207 + \ifpdf
4.6208 + \dopdfimage{#1}{#2}{#3}%
4.6209 + \else
4.6210 + % \epsfbox itself resets \epsf?size at each figure.
4.6211 + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
4.6212 + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
4.6213 + \epsfbox{#1.eps}%
4.6214 + \fi
4.6215 + %
4.6216 + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
4.6217 +\endgroup}
4.6218 +
4.6219 +
4.6220 +\message{localization,}
4.6221 +% and i18n.
4.6222 +
4.6223 +% @documentlanguage is usually given very early, just after
4.6224 +% @setfilename. If done too late, it may not override everything
4.6225 +% properly. Single argument is the language abbreviation.
4.6226 +% It would be nice if we could set up a hyphenation file here.
4.6227 +%
4.6228 +\def\documentlanguage{\parsearg\dodocumentlanguage}
4.6229 +\def\dodocumentlanguage#1{%
4.6230 + \tex % read txi-??.tex file in plain TeX.
4.6231 + % Read the file if it exists.
4.6232 + \openin 1 txi-#1.tex
4.6233 + \ifeof1
4.6234 + \errhelp = \nolanghelp
4.6235 + \errmessage{Cannot read language file txi-#1.tex}%
4.6236 + \let\temp = \relax
4.6237 + \else
4.6238 + \def\temp{\input txi-#1.tex }%
4.6239 + \fi
4.6240 + \temp
4.6241 + \endgroup
4.6242 +}
4.6243 +\newhelp\nolanghelp{The given language definition file cannot be found or
4.6244 +is empty. Maybe you need to install it? In the current directory
4.6245 +should work if nowhere else does.}
4.6246 +
4.6247 +
4.6248 +% @documentencoding should change something in TeX eventually, most
4.6249 +% likely, but for now just recognize it.
4.6250 +\let\documentencoding = \comment
4.6251 +
4.6252 +
4.6253 +% Page size parameters.
4.6254 +%
4.6255 +\newdimen\defaultparindent \defaultparindent = 15pt
4.6256 +
4.6257 +\chapheadingskip = 15pt plus 4pt minus 2pt
4.6258 +\secheadingskip = 12pt plus 3pt minus 2pt
4.6259 +\subsecheadingskip = 9pt plus 2pt minus 2pt
4.6260 +
4.6261 +% Prevent underfull vbox error messages.
4.6262 +\vbadness = 10000
4.6263 +
4.6264 +% Don't be so finicky about underfull hboxes, either.
4.6265 +\hbadness = 2000
4.6266 +
4.6267 +% Following George Bush, just get rid of widows and orphans.
4.6268 +\widowpenalty=10000
4.6269 +\clubpenalty=10000
4.6270 +
4.6271 +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4.6272 +% using an old version of TeX, don't do anything. We want the amount of
4.6273 +% stretch added to depend on the line length, hence the dependence on
4.6274 +% \hsize. We call this whenever the paper size is set.
4.6275 +%
4.6276 +\def\setemergencystretch{%
4.6277 + \ifx\emergencystretch\thisisundefined
4.6278 + % Allow us to assign to \emergencystretch anyway.
4.6279 + \def\emergencystretch{\dimen0}%
4.6280 + \else
4.6281 + \emergencystretch = .15\hsize
4.6282 + \fi
4.6283 +}
4.6284 +
4.6285 +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
4.6286 +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
4.6287 +% physical page width.
4.6288 +%
4.6289 +% We also call \setleading{\textleading}, so the caller should define
4.6290 +% \textleading. The caller should also set \parskip.
4.6291 +%
4.6292 +\def\internalpagesizes#1#2#3#4#5#6#7#8{%
4.6293 + \voffset = #3\relax
4.6294 + \topskip = #6\relax
4.6295 + \splittopskip = \topskip
4.6296 + %
4.6297 + \vsize = #1\relax
4.6298 + \advance\vsize by \topskip
4.6299 + \outervsize = \vsize
4.6300 + \advance\outervsize by 2\topandbottommargin
4.6301 + \pageheight = \vsize
4.6302 + %
4.6303 + \hsize = #2\relax
4.6304 + \outerhsize = \hsize
4.6305 + \advance\outerhsize by 0.5in
4.6306 + \pagewidth = \hsize
4.6307 + %
4.6308 + \normaloffset = #4\relax
4.6309 + \bindingoffset = #5\relax
4.6310 + %
4.6311 + \ifpdf
4.6312 + \pdfpageheight #7\relax
4.6313 + \pdfpagewidth #8\relax
4.6314 + \fi
4.6315 + %
4.6316 + \setleading{\textleading}
4.6317 + %
4.6318 + \parindent = \defaultparindent
4.6319 + \setemergencystretch
4.6320 +}
4.6321 +
4.6322 +% @letterpaper (the default).
4.6323 +\def\letterpaper{{\globaldefs = 1
4.6324 + \parskip = 3pt plus 2pt minus 1pt
4.6325 + \textleading = 13.2pt
4.6326 + %
4.6327 + % If page is nothing but text, make it come out even.
4.6328 + \internalpagesizes{46\baselineskip}{6in}%
4.6329 + {\voffset}{.25in}%
4.6330 + {\bindingoffset}{36pt}%
4.6331 + {11in}{8.5in}%
4.6332 +}}
4.6333 +
4.6334 +% Use @smallbook to reset parameters for 7x9.5 (or so) format.
4.6335 +\def\smallbook{{\globaldefs = 1
4.6336 + \parskip = 2pt plus 1pt
4.6337 + \textleading = 12pt
4.6338 + %
4.6339 + \internalpagesizes{7.5in}{5in}%
4.6340 + {\voffset}{.25in}%
4.6341 + {\bindingoffset}{16pt}%
4.6342 + {9.25in}{7in}%
4.6343 + %
4.6344 + \lispnarrowing = 0.3in
4.6345 + \tolerance = 700
4.6346 + \hfuzz = 1pt
4.6347 + \contentsrightmargin = 0pt
4.6348 + \defbodyindent = .5cm
4.6349 +}}
4.6350 +
4.6351 +% Use @afourpaper to print on European A4 paper.
4.6352 +\def\afourpaper{{\globaldefs = 1
4.6353 + \parskip = 3pt plus 2pt minus 1pt
4.6354 + \textleading = 13.2pt
4.6355 + %
4.6356 + % Double-side printing via postscript on Laserjet 4050
4.6357 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
4.6358 + % To change the settings for a different printer or situation, adjust
4.6359 + % \normaloffset until the front-side and back-side texts align. Then
4.6360 + % do the same for \bindingoffset. You can set these for testing in
4.6361 + % your texinfo source file like this:
4.6362 + % @tex
4.6363 + % \global\normaloffset = -6mm
4.6364 + % \global\bindingoffset = 10mm
4.6365 + % @end tex
4.6366 + \internalpagesizes{51\baselineskip}{160mm}
4.6367 + {\voffset}{\hoffset}%
4.6368 + {\bindingoffset}{44pt}%
4.6369 + {297mm}{210mm}%
4.6370 + %
4.6371 + \tolerance = 700
4.6372 + \hfuzz = 1pt
4.6373 + \contentsrightmargin = 0pt
4.6374 + \defbodyindent = 5mm
4.6375 +}}
4.6376 +
4.6377 +% Use @afivepaper to print on European A5 paper.
4.6378 +% From romildo@urano.iceb.ufop.br, 2 July 2000.
4.6379 +% He also recommends making @example and @lisp be small.
4.6380 +\def\afivepaper{{\globaldefs = 1
4.6381 + \parskip = 2pt plus 1pt minus 0.1pt
4.6382 + \textleading = 12.5pt
4.6383 + %
4.6384 + \internalpagesizes{160mm}{120mm}%
4.6385 + {\voffset}{\hoffset}%
4.6386 + {\bindingoffset}{8pt}%
4.6387 + {210mm}{148mm}%
4.6388 + %
4.6389 + \lispnarrowing = 0.2in
4.6390 + \tolerance = 800
4.6391 + \hfuzz = 1.2pt
4.6392 + \contentsrightmargin = 0pt
4.6393 + \defbodyindent = 2mm
4.6394 + \tableindent = 12mm
4.6395 +}}
4.6396 +
4.6397 +% A specific text layout, 24x15cm overall, intended for A4 paper.
4.6398 +\def\afourlatex{{\globaldefs = 1
4.6399 + \afourpaper
4.6400 + \internalpagesizes{237mm}{150mm}%
4.6401 + {\voffset}{4.6mm}%
4.6402 + {\bindingoffset}{7mm}%
4.6403 + {297mm}{210mm}%
4.6404 + %
4.6405 + % Must explicitly reset to 0 because we call \afourpaper.
4.6406 + \globaldefs = 0
4.6407 +}}
4.6408 +
4.6409 +% Use @afourwide to print on A4 paper in landscape format.
4.6410 +\def\afourwide{{\globaldefs = 1
4.6411 + \afourpaper
4.6412 + \internalpagesizes{241mm}{165mm}%
4.6413 + {\voffset}{-2.95mm}%
4.6414 + {\bindingoffset}{7mm}%
4.6415 + {297mm}{210mm}%
4.6416 + \globaldefs = 0
4.6417 +}}
4.6418 +
4.6419 +% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
4.6420 +% Perhaps we should allow setting the margins, \topskip, \parskip,
4.6421 +% and/or leading, also. Or perhaps we should compute them somehow.
4.6422 +%
4.6423 +\def\pagesizes{\parsearg\pagesizesxxx}
4.6424 +\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
4.6425 +\def\pagesizesyyy#1,#2,#3\finish{{%
4.6426 + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
4.6427 + \globaldefs = 1
4.6428 + %
4.6429 + \parskip = 3pt plus 2pt minus 1pt
4.6430 + \setleading{\textleading}%
4.6431 + %
4.6432 + \dimen0 = #1
4.6433 + \advance\dimen0 by \voffset
4.6434 + %
4.6435 + \dimen2 = \hsize
4.6436 + \advance\dimen2 by \normaloffset
4.6437 + %
4.6438 + \internalpagesizes{#1}{\hsize}%
4.6439 + {\voffset}{\normaloffset}%
4.6440 + {\bindingoffset}{44pt}%
4.6441 + {\dimen0}{\dimen2}%
4.6442 +}}
4.6443 +
4.6444 +% Set default to letter.
4.6445 +%
4.6446 +\letterpaper
4.6447 +
4.6448 +
4.6449 +\message{and turning on texinfo input format.}
4.6450 +
4.6451 +% Define macros to output various characters with catcode for normal text.
4.6452 +\catcode`\"=\other
4.6453 +\catcode`\~=\other
4.6454 +\catcode`\^=\other
4.6455 +\catcode`\_=\other
4.6456 +\catcode`\|=\other
4.6457 +\catcode`\<=\other
4.6458 +\catcode`\>=\other
4.6459 +\catcode`\+=\other
4.6460 +\catcode`\$=\other
4.6461 +\def\normaldoublequote{"}
4.6462 +\def\normaltilde{~}
4.6463 +\def\normalcaret{^}
4.6464 +\def\normalunderscore{_}
4.6465 +\def\normalverticalbar{|}
4.6466 +\def\normalless{<}
4.6467 +\def\normalgreater{>}
4.6468 +\def\normalplus{+}
4.6469 +\def\normaldollar{$}%$ font-lock fix
4.6470 +
4.6471 +% This macro is used to make a character print one way in ttfont
4.6472 +% where it can probably just be output, and another way in other fonts,
4.6473 +% where something hairier probably needs to be done.
4.6474 +%
4.6475 +% #1 is what to print if we are indeed using \tt; #2 is what to print
4.6476 +% otherwise. Since all the Computer Modern typewriter fonts have zero
4.6477 +% interword stretch (and shrink), and it is reasonable to expect all
4.6478 +% typewriter fonts to have this, we can check that font parameter.
4.6479 +%
4.6480 +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
4.6481 +
4.6482 +% Same as above, but check for italic font. Actually this also catches
4.6483 +% non-italic slanted fonts since it is impossible to distinguish them from
4.6484 +% italic fonts. But since this is only used by $ and it uses \sl anyway
4.6485 +% this is not a problem.
4.6486 +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
4.6487 +
4.6488 +% Turn off all special characters except @
4.6489 +% (and those which the user can use as if they were ordinary).
4.6490 +% Most of these we simply print from the \tt font, but for some, we can
4.6491 +% use math or other variants that look better in normal text.
4.6492 +
4.6493 +\catcode`\"=\active
4.6494 +\def\activedoublequote{{\tt\char34}}
4.6495 +\let"=\activedoublequote
4.6496 +\catcode`\~=\active
4.6497 +\def~{{\tt\char126}}
4.6498 +\chardef\hat=`\^
4.6499 +\catcode`\^=\active
4.6500 +\def^{{\tt \hat}}
4.6501 +
4.6502 +\catcode`\_=\active
4.6503 +\def_{\ifusingtt\normalunderscore\_}
4.6504 +% Subroutine for the previous macro.
4.6505 +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
4.6506 +
4.6507 +\catcode`\|=\active
4.6508 +\def|{{\tt\char124}}
4.6509 +\chardef \less=`\<
4.6510 +\catcode`\<=\active
4.6511 +\def<{{\tt \less}}
4.6512 +\chardef \gtr=`\>
4.6513 +\catcode`\>=\active
4.6514 +\def>{{\tt \gtr}}
4.6515 +\catcode`\+=\active
4.6516 +\def+{{\tt \char 43}}
4.6517 +\catcode`\$=\active
4.6518 +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
4.6519 +
4.6520 +% Set up an active definition for =, but don't enable it most of the time.
4.6521 +{\catcode`\==\active
4.6522 +\global\def={{\tt \char 61}}}
4.6523 +
4.6524 +\catcode`+=\active
4.6525 +\catcode`\_=\active
4.6526 +
4.6527 +% If a .fmt file is being used, characters that might appear in a file
4.6528 +% name cannot be active until we have parsed the command line.
4.6529 +% So turn them off again, and have \everyjob (or @setfilename) turn them on.
4.6530 +% \otherifyactive is called near the end of this file.
4.6531 +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4.6532 +
4.6533 +\catcode`\@=0
4.6534 +
4.6535 +% \rawbackslashxx outputs one backslash character in current font,
4.6536 +% as in \char`\\.
4.6537 +\global\chardef\rawbackslashxx=`\\
4.6538 +
4.6539 +% \rawbackslash defines an active \ to do \rawbackslashxx.
4.6540 +% \otherbackslash defines an active \ to be a literal `\' character with
4.6541 +% catcode other.
4.6542 +{\catcode`\\=\active
4.6543 + @gdef@rawbackslash{@let\=@rawbackslashxx}
4.6544 + @gdef@otherbackslash{@let\=@realbackslash}
4.6545 +}
4.6546 +
4.6547 +% \realbackslash is an actual character `\' with catcode other.
4.6548 +{\catcode`\\=\other @gdef@realbackslash{\}}
4.6549 +
4.6550 +% \normalbackslash outputs one backslash in fixed width font.
4.6551 +\def\normalbackslash{{\tt\rawbackslashxx}}
4.6552 +
4.6553 +\catcode`\\=\active
4.6554 +
4.6555 +% Used sometimes to turn off (effectively) the active characters
4.6556 +% even after parsing them.
4.6557 +@def@turnoffactive{%
4.6558 + @let"=@normaldoublequote
4.6559 + @let\=@realbackslash
4.6560 + @let~=@normaltilde
4.6561 + @let^=@normalcaret
4.6562 + @let_=@normalunderscore
4.6563 + @let|=@normalverticalbar
4.6564 + @let<=@normalless
4.6565 + @let>=@normalgreater
4.6566 + @let+=@normalplus
4.6567 + @let$=@normaldollar %$ font-lock fix
4.6568 +}
4.6569 +
4.6570 +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
4.6571 +% the literal character `\'. (Thus, \ is not expandable when this is in
4.6572 +% effect.)
4.6573 +%
4.6574 +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
4.6575 +
4.6576 +% Make _ and + \other characters, temporarily.
4.6577 +% This is canceled by @fixbackslash.
4.6578 +@otherifyactive
4.6579 +
4.6580 +% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4.6581 +% That is what \eatinput is for; after that, the `\' should revert to printing
4.6582 +% a backslash.
4.6583 +%
4.6584 +@gdef@eatinput input texinfo{@fixbackslash}
4.6585 +@global@let\ = @eatinput
4.6586 +
4.6587 +% On the other hand, perhaps the file did not have a `\input texinfo'. Then
4.6588 +% the first `\{ in the file would cause an error. This macro tries to fix
4.6589 +% that, assuming it is called before the first `\' could plausibly occur.
4.6590 +% Also back turn on active characters that might appear in the input
4.6591 +% file name, in case not using a pre-dumped format.
4.6592 +%
4.6593 +@gdef@fixbackslash{%
4.6594 + @ifx\@eatinput @let\ = @normalbackslash @fi
4.6595 + @catcode`+=@active
4.6596 + @catcode`@_=@active
4.6597 +}
4.6598 +
4.6599 +% Say @foo, not \foo, in error messages.
4.6600 +@escapechar = `@@
4.6601 +
4.6602 +% These look ok in all fonts, so just make them not special.
4.6603 +@catcode`@& = @other
4.6604 +@catcode`@# = @other
4.6605 +@catcode`@% = @other
4.6606 +
4.6607 +@c Set initial fonts.
4.6608 +@textfonts
4.6609 +@rm
4.6610 +
4.6611 +
4.6612 +@c Local variables:
4.6613 +@c eval: (add-hook 'write-file-hooks 'time-stamp)
4.6614 +@c page-delimiter: "^\\\\message"
4.6615 +@c time-stamp-start: "def\\\\texinfoversion{"
4.6616 +@c time-stamp-format: "%:y-%02m-%02d.%02H"
4.6617 +@c time-stamp-end: "}"
4.6618 +@c End: