It breaks my heart to say them goodbye...
1.1 --- a/doc/etikol.texi Thu Apr 29 08:33:16 2004 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,189 +0,0 @@
1.4 -\input texinfo @c -*-texinfo-*-
1.5 -@comment $Id: etikol.texi,v 1.5 2004/02/10 13:29:15 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 -
1.41 -@copying
1.42 -This manual is for GNU ETIL-OL Optimization Library
1.43 -(version @value{VERSION}, @value{UPDATED}).
1.44 -
1.45 -Copyright @copyright{} 2003 ETIK.
1.46 -
1.47 -@quotation
1.48 -Permission is granted to copy, distribute and/or modify this document
1.49 -under the terms of the GNU Free Documentation License, Version 1.1 or
1.50 -any later version published by the Free Software Foundation; with no
1.51 -Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
1.52 -and with the Back-Cover Texts as in (a) below. A copy of the
1.53 -license is included in the section entitled ``GNU Free Documentation
1.54 -License.''
1.55 -
1.56 -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
1.57 -this GNU Manual, like GNU software. Copies published by the Free
1.58 -Software Foundation raise funds for GNU development.''
1.59 -@end quotation
1.60 -@end copying
1.61 -
1.62 -@dircategory Texinfo documentation system
1.63 -@direntry
1.64 -* ETIK-OL: ETIK-OL Optimization Library.
1.65 -@end direntry
1.66 -
1.67 -@titlepage
1.68 -@title GNU ETIL-OL Optimization Library
1.69 -@subtitle for version @value{VERSION}, @value{UPDATED}
1.70 -@author ETIK Group
1.71 -@page
1.72 -@vskip 0pt plus 1filll
1.73 -@c @insertcopying
1.74 -@end titlepage
1.75 -
1.76 -@contents
1.77 -
1.78 -@ifnottex
1.79 -@node Top
1.80 -@top GNU ETIK-OL Library
1.81 -
1.82 -@c @insertcopying
1.83 -@end ifnottex
1.84 -
1.85 -@menu
1.86 -* Basic Concepts::
1.87 -* Copying This Manual::
1.88 -* Index::
1.89 -@end menu
1.90 -
1.91 -
1.92 -@node Basic Concepts
1.93 -@chapter Basic Concepts
1.94 -
1.95 -@menu
1.96 -* The Full Feature Graph Class::
1.97 -* The BFS algorithm::
1.98 -@end menu
1.99 -
1.100 -@include flf-graph.texi
1.101 -
1.102 -@c @node A Full Feature Graph
1.103 -@c @section A Full Feature Graph
1.104 -@c @cindex Full Feature Graph
1.105 -
1.106 -@node The BFS algorithm
1.107 -@section The BFS algorithm
1.108 -@cindex The BFS algorithm
1.109 -
1.110 -@menu
1.111 -* Iterator style BFS class::
1.112 -* The BFS funcion::
1.113 -@end menu
1.114 -
1.115 -bla2
1.116 -
1.117 -@node Iterator style BFS class
1.118 -@subsection Iterator style BFS class
1.119 -@cindex BFS algorithm
1.120 -@cindex BFS concept
1.121 -
1.122 -Here is a code example.
1.123 -
1.124 -
1.125 -@quotation
1.126 -@verbatim
1.127 -class
1.128 -{
1.129 -public:
1.130 - bfs_node_data<G> NodeType::*d;
1.131 - typedef typename G::EdgeIterator value_type;
1.132 - void Put(typename G::NodeIterator &i,
1.133 - const value_type &t);
1.134 - value_type Get(const typename G::NodeIterator &i) const;
1.135 -} tree;
1.136 -@end verbatim
1.137 -@end quotation
1.138 -
1.139 -
1.140 -The same code with a remark.
1.141 -
1.142 -@comment @quotation
1.143 -@example
1.144 -class
1.145 -@{
1.146 -public:
1.147 - bfs_node_data<G> NodeType::*d;
1.148 - typedef typename G::EdgeIterator value_type;
1.149 - void Put(typename G::NodeIterator &i,
1.150 - const value_type &t); @r{This is a long funcion declaration.}
1.151 - value_type Get(const typename G::NodeIterator &i) const;
1.152 -@} tree;
1.153 -@end example
1.154 -@comment @end quotation
1.155 -
1.156 -@node The BFS funcion
1.157 -@subsection The BFS funcion
1.158 -@cindex BFS algorithm
1.159 -
1.160 -@enumerate
1.161 -@item
1.162 -This is the first item.
1.163 -
1.164 -@item
1.165 -This is the second item.
1.166 -@end enumerate
1.167 -
1.168 -
1.169 -@node Copying This Manual
1.170 -@appendix Copying This Manual
1.171 -
1.172 -@menu
1.173 -* GNU Free Documentation License:: License for copying this manual.
1.174 -@end menu
1.175 -
1.176 -@include fdl.texi
1.177 -
1.178 -
1.179 -@node Index
1.180 -@unnumbered Concept Index
1.181 -@printindex cp
1.182 -
1.183 -@c @node Function Index
1.184 -@unnumbered Function Index
1.185 -@printindex fn
1.186 -
1.187 -@c @node Type Index
1.188 -@unnumbered Type Index
1.189 -@printindex tp
1.190 -
1.191 -@bye
1.192 -
2.1 --- a/doc/fdl.texi Thu Apr 29 08:33:16 2004 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,452 +0,0 @@
2.4 -
2.5 -@node GNU Free Documentation License
2.6 -@appendixsec GNU Free Documentation License
2.7 -
2.8 -@cindex FDL, GNU Free Documentation License
2.9 -@center Version 1.2, November 2002
2.10 -
2.11 -@display
2.12 -Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
2.13 -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
2.14 -
2.15 -Everyone is permitted to copy and distribute verbatim copies
2.16 -of this license document, but changing it is not allowed.
2.17 -@end display
2.18 -
2.19 -@enumerate 0
2.20 -@item
2.21 -PREAMBLE
2.22 -
2.23 -The purpose of this License is to make a manual, textbook, or other
2.24 -functional and useful document @dfn{free} in the sense of freedom: to
2.25 -assure everyone the effective freedom to copy and redistribute it,
2.26 -with or without modifying it, either commercially or noncommercially.
2.27 -Secondarily, this License preserves for the author and publisher a way
2.28 -to get credit for their work, while not being considered responsible
2.29 -for modifications made by others.
2.30 -
2.31 -This License is a kind of ``copyleft'', which means that derivative
2.32 -works of the document must themselves be free in the same sense. It
2.33 -complements the GNU General Public License, which is a copyleft
2.34 -license designed for free software.
2.35 -
2.36 -We have designed this License in order to use it for manuals for free
2.37 -software, because free software needs free documentation: a free
2.38 -program should come with manuals providing the same freedoms that the
2.39 -software does. But this License is not limited to software manuals;
2.40 -it can be used for any textual work, regardless of subject matter or
2.41 -whether it is published as a printed book. We recommend this License
2.42 -principally for works whose purpose is instruction or reference.
2.43 -
2.44 -@item
2.45 -APPLICABILITY AND DEFINITIONS
2.46 -
2.47 -This License applies to any manual or other work, in any medium, that
2.48 -contains a notice placed by the copyright holder saying it can be
2.49 -distributed under the terms of this License. Such a notice grants a
2.50 -world-wide, royalty-free license, unlimited in duration, to use that
2.51 -work under the conditions stated herein. The ``Document'', below,
2.52 -refers to any such manual or work. Any member of the public is a
2.53 -licensee, and is addressed as ``you''. You accept the license if you
2.54 -copy, modify or distribute the work in a way requiring permission
2.55 -under copyright law.
2.56 -
2.57 -A ``Modified Version'' of the Document means any work containing the
2.58 -Document or a portion of it, either copied verbatim, or with
2.59 -modifications and/or translated into another language.
2.60 -
2.61 -A ``Secondary Section'' is a named appendix or a front-matter section
2.62 -of the Document that deals exclusively with the relationship of the
2.63 -publishers or authors of the Document to the Document's overall
2.64 -subject (or to related matters) and contains nothing that could fall
2.65 -directly within that overall subject. (Thus, if the Document is in
2.66 -part a textbook of mathematics, a Secondary Section may not explain
2.67 -any mathematics.) The relationship could be a matter of historical
2.68 -connection with the subject or with related matters, or of legal,
2.69 -commercial, philosophical, ethical or political position regarding
2.70 -them.
2.71 -
2.72 -The ``Invariant Sections'' are certain Secondary Sections whose titles
2.73 -are designated, as being those of Invariant Sections, in the notice
2.74 -that says that the Document is released under this License. If a
2.75 -section does not fit the above definition of Secondary then it is not
2.76 -allowed to be designated as Invariant. The Document may contain zero
2.77 -Invariant Sections. If the Document does not identify any Invariant
2.78 -Sections then there are none.
2.79 -
2.80 -The ``Cover Texts'' are certain short passages of text that are listed,
2.81 -as Front-Cover Texts or Back-Cover Texts, in the notice that says that
2.82 -the Document is released under this License. A Front-Cover Text may
2.83 -be at most 5 words, and a Back-Cover Text may be at most 25 words.
2.84 -
2.85 -A ``Transparent'' copy of the Document means a machine-readable copy,
2.86 -represented in a format whose specification is available to the
2.87 -general public, that is suitable for revising the document
2.88 -straightforwardly with generic text editors or (for images composed of
2.89 -pixels) generic paint programs or (for drawings) some widely available
2.90 -drawing editor, and that is suitable for input to text formatters or
2.91 -for automatic translation to a variety of formats suitable for input
2.92 -to text formatters. A copy made in an otherwise Transparent file
2.93 -format whose markup, or absence of markup, has been arranged to thwart
2.94 -or discourage subsequent modification by readers is not Transparent.
2.95 -An image format is not Transparent if used for any substantial amount
2.96 -of text. A copy that is not ``Transparent'' is called ``Opaque''.
2.97 -
2.98 -Examples of suitable formats for Transparent copies include plain
2.99 -@sc{ascii} without markup, Texinfo input format, La@TeX{} input
2.100 -format, @acronym{SGML} or @acronym{XML} using a publicly available
2.101 -@acronym{DTD}, and standard-conforming simple @acronym{HTML},
2.102 -PostScript or @acronym{PDF} designed for human modification. Examples
2.103 -of transparent image formats include @acronym{PNG}, @acronym{XCF} and
2.104 -@acronym{JPG}. Opaque formats include proprietary formats that can be
2.105 -read and edited only by proprietary word processors, @acronym{SGML} or
2.106 -@acronym{XML} for which the @acronym{DTD} and/or processing tools are
2.107 -not generally available, and the machine-generated @acronym{HTML},
2.108 -PostScript or @acronym{PDF} produced by some word processors for
2.109 -output purposes only.
2.110 -
2.111 -The ``Title Page'' means, for a printed book, the title page itself,
2.112 -plus such following pages as are needed to hold, legibly, the material
2.113 -this License requires to appear in the title page. For works in
2.114 -formats which do not have any title page as such, ``Title Page'' means
2.115 -the text near the most prominent appearance of the work's title,
2.116 -preceding the beginning of the body of the text.
2.117 -
2.118 -A section ``Entitled XYZ'' means a named subunit of the Document whose
2.119 -title either is precisely XYZ or contains XYZ in parentheses following
2.120 -text that translates XYZ in another language. (Here XYZ stands for a
2.121 -specific section name mentioned below, such as ``Acknowledgements'',
2.122 -``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
2.123 -of such a section when you modify the Document means that it remains a
2.124 -section ``Entitled XYZ'' according to this definition.
2.125 -
2.126 -The Document may include Warranty Disclaimers next to the notice which
2.127 -states that this License applies to the Document. These Warranty
2.128 -Disclaimers are considered to be included by reference in this
2.129 -License, but only as regards disclaiming warranties: any other
2.130 -implication that these Warranty Disclaimers may have is void and has
2.131 -no effect on the meaning of this License.
2.132 -
2.133 -@item
2.134 -VERBATIM COPYING
2.135 -
2.136 -You may copy and distribute the Document in any medium, either
2.137 -commercially or noncommercially, provided that this License, the
2.138 -copyright notices, and the license notice saying this License applies
2.139 -to the Document are reproduced in all copies, and that you add no other
2.140 -conditions whatsoever to those of this License. You may not use
2.141 -technical measures to obstruct or control the reading or further
2.142 -copying of the copies you make or distribute. However, you may accept
2.143 -compensation in exchange for copies. If you distribute a large enough
2.144 -number of copies you must also follow the conditions in section 3.
2.145 -
2.146 -You may also lend copies, under the same conditions stated above, and
2.147 -you may publicly display copies.
2.148 -
2.149 -@item
2.150 -COPYING IN QUANTITY
2.151 -
2.152 -If you publish printed copies (or copies in media that commonly have
2.153 -printed covers) of the Document, numbering more than 100, and the
2.154 -Document's license notice requires Cover Texts, you must enclose the
2.155 -copies in covers that carry, clearly and legibly, all these Cover
2.156 -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
2.157 -the back cover. Both covers must also clearly and legibly identify
2.158 -you as the publisher of these copies. The front cover must present
2.159 -the full title with all words of the title equally prominent and
2.160 -visible. You may add other material on the covers in addition.
2.161 -Copying with changes limited to the covers, as long as they preserve
2.162 -the title of the Document and satisfy these conditions, can be treated
2.163 -as verbatim copying in other respects.
2.164 -
2.165 -If the required texts for either cover are too voluminous to fit
2.166 -legibly, you should put the first ones listed (as many as fit
2.167 -reasonably) on the actual cover, and continue the rest onto adjacent
2.168 -pages.
2.169 -
2.170 -If you publish or distribute Opaque copies of the Document numbering
2.171 -more than 100, you must either include a machine-readable Transparent
2.172 -copy along with each Opaque copy, or state in or with each Opaque copy
2.173 -a computer-network location from which the general network-using
2.174 -public has access to download using public-standard network protocols
2.175 -a complete Transparent copy of the Document, free of added material.
2.176 -If you use the latter option, you must take reasonably prudent steps,
2.177 -when you begin distribution of Opaque copies in quantity, to ensure
2.178 -that this Transparent copy will remain thus accessible at the stated
2.179 -location until at least one year after the last time you distribute an
2.180 -Opaque copy (directly or through your agents or retailers) of that
2.181 -edition to the public.
2.182 -
2.183 -It is requested, but not required, that you contact the authors of the
2.184 -Document well before redistributing any large number of copies, to give
2.185 -them a chance to provide you with an updated version of the Document.
2.186 -
2.187 -@item
2.188 -MODIFICATIONS
2.189 -
2.190 -You may copy and distribute a Modified Version of the Document under
2.191 -the conditions of sections 2 and 3 above, provided that you release
2.192 -the Modified Version under precisely this License, with the Modified
2.193 -Version filling the role of the Document, thus licensing distribution
2.194 -and modification of the Modified Version to whoever possesses a copy
2.195 -of it. In addition, you must do these things in the Modified Version:
2.196 -
2.197 -@enumerate A
2.198 -@item
2.199 -Use in the Title Page (and on the covers, if any) a title distinct
2.200 -from that of the Document, and from those of previous versions
2.201 -(which should, if there were any, be listed in the History section
2.202 -of the Document). You may use the same title as a previous version
2.203 -if the original publisher of that version gives permission.
2.204 -
2.205 -@item
2.206 -List on the Title Page, as authors, one or more persons or entities
2.207 -responsible for authorship of the modifications in the Modified
2.208 -Version, together with at least five of the principal authors of the
2.209 -Document (all of its principal authors, if it has fewer than five),
2.210 -unless they release you from this requirement.
2.211 -
2.212 -@item
2.213 -State on the Title page the name of the publisher of the
2.214 -Modified Version, as the publisher.
2.215 -
2.216 -@item
2.217 -Preserve all the copyright notices of the Document.
2.218 -
2.219 -@item
2.220 -Add an appropriate copyright notice for your modifications
2.221 -adjacent to the other copyright notices.
2.222 -
2.223 -@item
2.224 -Include, immediately after the copyright notices, a license notice
2.225 -giving the public permission to use the Modified Version under the
2.226 -terms of this License, in the form shown in the Addendum below.
2.227 -
2.228 -@item
2.229 -Preserve in that license notice the full lists of Invariant Sections
2.230 -and required Cover Texts given in the Document's license notice.
2.231 -
2.232 -@item
2.233 -Include an unaltered copy of this License.
2.234 -
2.235 -@item
2.236 -Preserve the section Entitled ``History'', Preserve its Title, and add
2.237 -to it an item stating at least the title, year, new authors, and
2.238 -publisher of the Modified Version as given on the Title Page. If
2.239 -there is no section Entitled ``History'' in the Document, create one
2.240 -stating the title, year, authors, and publisher of the Document as
2.241 -given on its Title Page, then add an item describing the Modified
2.242 -Version as stated in the previous sentence.
2.243 -
2.244 -@item
2.245 -Preserve the network location, if any, given in the Document for
2.246 -public access to a Transparent copy of the Document, and likewise
2.247 -the network locations given in the Document for previous versions
2.248 -it was based on. These may be placed in the ``History'' section.
2.249 -You may omit a network location for a work that was published at
2.250 -least four years before the Document itself, or if the original
2.251 -publisher of the version it refers to gives permission.
2.252 -
2.253 -@item
2.254 -For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
2.255 -the Title of the section, and preserve in the section all the
2.256 -substance and tone of each of the contributor acknowledgements and/or
2.257 -dedications given therein.
2.258 -
2.259 -@item
2.260 -Preserve all the Invariant Sections of the Document,
2.261 -unaltered in their text and in their titles. Section numbers
2.262 -or the equivalent are not considered part of the section titles.
2.263 -
2.264 -@item
2.265 -Delete any section Entitled ``Endorsements''. Such a section
2.266 -may not be included in the Modified Version.
2.267 -
2.268 -@item
2.269 -Do not retitle any existing section to be Entitled ``Endorsements'' or
2.270 -to conflict in title with any Invariant Section.
2.271 -
2.272 -@item
2.273 -Preserve any Warranty Disclaimers.
2.274 -@end enumerate
2.275 -
2.276 -If the Modified Version includes new front-matter sections or
2.277 -appendices that qualify as Secondary Sections and contain no material
2.278 -copied from the Document, you may at your option designate some or all
2.279 -of these sections as invariant. To do this, add their titles to the
2.280 -list of Invariant Sections in the Modified Version's license notice.
2.281 -These titles must be distinct from any other section titles.
2.282 -
2.283 -You may add a section Entitled ``Endorsements'', provided it contains
2.284 -nothing but endorsements of your Modified Version by various
2.285 -parties---for example, statements of peer review or that the text has
2.286 -been approved by an organization as the authoritative definition of a
2.287 -standard.
2.288 -
2.289 -You may add a passage of up to five words as a Front-Cover Text, and a
2.290 -passage of up to 25 words as a Back-Cover Text, to the end of the list
2.291 -of Cover Texts in the Modified Version. Only one passage of
2.292 -Front-Cover Text and one of Back-Cover Text may be added by (or
2.293 -through arrangements made by) any one entity. If the Document already
2.294 -includes a cover text for the same cover, previously added by you or
2.295 -by arrangement made by the same entity you are acting on behalf of,
2.296 -you may not add another; but you may replace the old one, on explicit
2.297 -permission from the previous publisher that added the old one.
2.298 -
2.299 -The author(s) and publisher(s) of the Document do not by this License
2.300 -give permission to use their names for publicity for or to assert or
2.301 -imply endorsement of any Modified Version.
2.302 -
2.303 -@item
2.304 -COMBINING DOCUMENTS
2.305 -
2.306 -You may combine the Document with other documents released under this
2.307 -License, under the terms defined in section 4 above for modified
2.308 -versions, provided that you include in the combination all of the
2.309 -Invariant Sections of all of the original documents, unmodified, and
2.310 -list them all as Invariant Sections of your combined work in its
2.311 -license notice, and that you preserve all their Warranty Disclaimers.
2.312 -
2.313 -The combined work need only contain one copy of this License, and
2.314 -multiple identical Invariant Sections may be replaced with a single
2.315 -copy. If there are multiple Invariant Sections with the same name but
2.316 -different contents, make the title of each such section unique by
2.317 -adding at the end of it, in parentheses, the name of the original
2.318 -author or publisher of that section if known, or else a unique number.
2.319 -Make the same adjustment to the section titles in the list of
2.320 -Invariant Sections in the license notice of the combined work.
2.321 -
2.322 -In the combination, you must combine any sections Entitled ``History''
2.323 -in the various original documents, forming one section Entitled
2.324 -``History''; likewise combine any sections Entitled ``Acknowledgements'',
2.325 -and any sections Entitled ``Dedications''. You must delete all
2.326 -sections Entitled ``Endorsements.''
2.327 -
2.328 -@item
2.329 -COLLECTIONS OF DOCUMENTS
2.330 -
2.331 -You may make a collection consisting of the Document and other documents
2.332 -released under this License, and replace the individual copies of this
2.333 -License in the various documents with a single copy that is included in
2.334 -the collection, provided that you follow the rules of this License for
2.335 -verbatim copying of each of the documents in all other respects.
2.336 -
2.337 -You may extract a single document from such a collection, and distribute
2.338 -it individually under this License, provided you insert a copy of this
2.339 -License into the extracted document, and follow this License in all
2.340 -other respects regarding verbatim copying of that document.
2.341 -
2.342 -@item
2.343 -AGGREGATION WITH INDEPENDENT WORKS
2.344 -
2.345 -A compilation of the Document or its derivatives with other separate
2.346 -and independent documents or works, in or on a volume of a storage or
2.347 -distribution medium, is called an ``aggregate'' if the copyright
2.348 -resulting from the compilation is not used to limit the legal rights
2.349 -of the compilation's users beyond what the individual works permit.
2.350 -When the Document is included in an aggregate, this License does not
2.351 -apply to the other works in the aggregate which are not themselves
2.352 -derivative works of the Document.
2.353 -
2.354 -If the Cover Text requirement of section 3 is applicable to these
2.355 -copies of the Document, then if the Document is less than one half of
2.356 -the entire aggregate, the Document's Cover Texts may be placed on
2.357 -covers that bracket the Document within the aggregate, or the
2.358 -electronic equivalent of covers if the Document is in electronic form.
2.359 -Otherwise they must appear on printed covers that bracket the whole
2.360 -aggregate.
2.361 -
2.362 -@item
2.363 -TRANSLATION
2.364 -
2.365 -Translation is considered a kind of modification, so you may
2.366 -distribute translations of the Document under the terms of section 4.
2.367 -Replacing Invariant Sections with translations requires special
2.368 -permission from their copyright holders, but you may include
2.369 -translations of some or all Invariant Sections in addition to the
2.370 -original versions of these Invariant Sections. You may include a
2.371 -translation of this License, and all the license notices in the
2.372 -Document, and any Warranty Disclaimers, provided that you also include
2.373 -the original English version of this License and the original versions
2.374 -of those notices and disclaimers. In case of a disagreement between
2.375 -the translation and the original version of this License or a notice
2.376 -or disclaimer, the original version will prevail.
2.377 -
2.378 -If a section in the Document is Entitled ``Acknowledgements'',
2.379 -``Dedications'', or ``History'', the requirement (section 4) to Preserve
2.380 -its Title (section 1) will typically require changing the actual
2.381 -title.
2.382 -
2.383 -@item
2.384 -TERMINATION
2.385 -
2.386 -You may not copy, modify, sublicense, or distribute the Document except
2.387 -as expressly provided for under this License. Any other attempt to
2.388 -copy, modify, sublicense or distribute the Document is void, and will
2.389 -automatically terminate your rights under this License. However,
2.390 -parties who have received copies, or rights, from you under this
2.391 -License will not have their licenses terminated so long as such
2.392 -parties remain in full compliance.
2.393 -
2.394 -@item
2.395 -FUTURE REVISIONS OF THIS LICENSE
2.396 -
2.397 -The Free Software Foundation may publish new, revised versions
2.398 -of the GNU Free Documentation License from time to time. Such new
2.399 -versions will be similar in spirit to the present version, but may
2.400 -differ in detail to address new problems or concerns. See
2.401 -@uref{http://www.gnu.org/copyleft/}.
2.402 -
2.403 -Each version of the License is given a distinguishing version number.
2.404 -If the Document specifies that a particular numbered version of this
2.405 -License ``or any later version'' applies to it, you have the option of
2.406 -following the terms and conditions either of that specified version or
2.407 -of any later version that has been published (not as a draft) by the
2.408 -Free Software Foundation. If the Document does not specify a version
2.409 -number of this License, you may choose any version ever published (not
2.410 -as a draft) by the Free Software Foundation.
2.411 -@end enumerate
2.412 -
2.413 -@page
2.414 -@appendixsubsec ADDENDUM: How to use this License for your documents
2.415 -
2.416 -To use this License in a document you have written, include a copy of
2.417 -the License in the document and put the following copyright and
2.418 -license notices just after the title page:
2.419 -
2.420 -@smallexample
2.421 -@group
2.422 - Copyright (C) @var{year} @var{your name}.
2.423 - Permission is granted to copy, distribute and/or modify this document
2.424 - under the terms of the GNU Free Documentation License, Version 1.2
2.425 - or any later version published by the Free Software Foundation;
2.426 - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2.427 - Texts. A copy of the license is included in the section entitled ``GNU
2.428 - Free Documentation License''.
2.429 -@end group
2.430 -@end smallexample
2.431 -
2.432 -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
2.433 -replace the ``with...Texts.'' line with this:
2.434 -
2.435 -@smallexample
2.436 -@group
2.437 - with the Invariant Sections being @var{list their titles}, with
2.438 - the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
2.439 - being @var{list}.
2.440 -@end group
2.441 -@end smallexample
2.442 -
2.443 -If you have Invariant Sections without Cover Texts, or some other
2.444 -combination of the three, merge those two alternatives to suit the
2.445 -situation.
2.446 -
2.447 -If your document contains nontrivial examples of program code, we
2.448 -recommend releasing these examples in parallel under your choice of
2.449 -free software license, such as the GNU General Public License,
2.450 -to permit their use in free software.
2.451 -
2.452 -@c Local Variables:
2.453 -@c ispell-local-pdict: "ispell-dict"
2.454 -@c End:
2.455 -
3.1 --- a/doc/flf-graph.texi Thu Apr 29 08:33:16 2004 +0000
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,242 +0,0 @@
3.4 -@node The Full Feature Graph Class
3.5 -@section The Full Feature Graph Class
3.6 -@cindex Full Feature Graph Class
3.7 -
3.8 -This section describes what an imaginary full feature graph class knows.
3.9 -The set of features provided by a real graph implementation is typically
3.10 -a subset of the features below.
3.11 -
3.12 -On the other hand, each graph algorithm requires the underlying graph
3.13 -structure to provide a certain (typically small) set of features in order
3.14 -to be able to run.
3.15 -
3.16 -@subsection Declaration
3.17 -
3.18 -@deftp {Class} {class Graph}
3.19 -@code{Graph} is the imaginary @emph{full feature graph class}.
3.20 -@code{G} denotes the instance of this class in the exaples below.
3.21 -@c Each node and edge has a user defined data sturcure
3.22 -@c @var{N} and @var{E} statically attached to it.
3.23 -@end deftp
3.24 -
3.25 -@subsection Types
3.26 -
3.27 -@c @deftp {Type} Graph::NodeType
3.28 -@c @deftpx {Type} Graph::EdgeType
3.29 -@c The type of the data stored statically for each node and edge.
3.30 -@c @end deftp
3.31 -
3.32 -@anchor{Graph-NodeIterator}
3.33 -@deftp {Type} Graph::NodeIt
3.34 -@c @deftpx {Type} Graph::NodeIterator
3.35 -These types points a node uniquely. The difference between the
3.36 -@code{NodeIt} and the @code{NodeIterator} is that @code{NodeIt}
3.37 -requires the graph structure itself for most of the operations.
3.38 -For examples using iterators you can go through all nodes as follows.
3.39 -@quotation
3.40 -@verbatim
3.41 -Graph G;
3.42 -int nodenum=0;
3.43 -for(Graph::NodeIterator n(G);n.valid();++n) ++nodenum;
3.44 -@end verbatim
3.45 -@end quotation
3.46 -Using @code{NodeIt} the last line looks like this.
3.47 -@quotation
3.48 -@verbatim
3.49 -for(Graph::NodeIt n(G);n.valid();n=G.next(n)) ++nodenum;
3.50 -@end verbatim
3.51 -@end quotation
3.52 -or
3.53 -@quotation
3.54 -@verbatim
3.55 -MyGraph::NodeIt n;
3.56 -for(G.getFirst(n);G.valid(n);G.goNext(n)) ++nodenum;
3.57 -@end verbatim
3.58 -@end quotation
3.59 -@end deftp
3.60 -
3.61 -@deftp {Type} Graph::EdgeIt
3.62 -@deftpx {Type} Graph::InEdgeIt
3.63 -@deftpx {Type} Graph::OutEdgeIt
3.64 -@deftpx {Type} Graph::EachEdgeIt
3.65 -@c @deftpx {Type} Graph::BiEdgeIt
3.66 -@c @deftpx {Type} Graph::SymEdgeIt
3.67 -Each of these types points an edge uniquely. The difference between the
3.68 -@code{EdgeIt} and the
3.69 -@c @mref{Graph-NodeIterator,@code{EdgeIterator}}
3.70 -@mref{Graph-NodeIterator , EdgeIterator}
3.71 -series is that
3.72 -@code{EdgeIt} requires the graph structure itself for most of the
3.73 -operations.
3.74 -@end deftp
3.75 -
3.76 -@anchor{Graph-EdgeIterator}
3.77 -@c @deftp {Type} Graph::EdgeIterator
3.78 -@c @deftpx {Type} Graph::InEdgeIterator
3.79 -@c @deftpx {Type} Graph::OutEdgeIterator
3.80 -@c @deftpx {Type} Graph::BiEdgeIterator
3.81 -@c @deftpx {Type} Graph::SymEdgeIterator
3.82 -@c @deftpx {Type} Graph::EachEdgeIterator
3.83 -@c Each of these types points an edge uniquely. The difference between the
3.84 -@c @code{EdgeIt} and the @code{EdgeIterator} series is that
3.85 -@c @code{EdgeIt} requires the graph structure itself for most of the
3.86 -@c operations.
3.87 -
3.88 -@c For the @code{EdgeIterator} types you can use operator @code{++}
3.89 -@c (both the prefix and the posfix one) to obtain the next edge.
3.90 -@c @end deftp
3.91 -
3.92 -@deftp {Type} Graph::NodeMap<typename T>
3.93 -@deftpx {Type} Graph::EdgeMap<typename T>
3.94 -There are the default property maps for the edges and the nodes.
3.95 -@end deftp
3.96 -
3.97 -@deftp {Type} Graph::DynNodeMap<typename T>
3.98 -@deftpx {Type} Graph::DynEdgeMap<typename T>
3.99 -There are the default @emph{dynamic} property maps for the edges and the nodes.
3.100 -@end deftp
3.101 -
3.102 -@subsection Member Functions
3.103 -
3.104 -@subsubsection Constructors
3.105 -
3.106 -@deftypefun { } Graph::Graph ()
3.107 -The default constructor.
3.108 -@end deftypefun
3.109 -
3.110 -@c @deftypefun { } Graph::Graph (Graph@tie{}&)
3.111 -@deftypefun { } Graph::Graph (Graph &)
3.112 -The copy constructor.
3.113 -@end deftypefun
3.114 -
3.115 -@subsubsection Graph Maintenence Operations
3.116 -
3.117 -@deftypefun NodeIt Graph::addNode ()
3.118 -Adds a new node to the graph and returns a @code{NodeIt} pointing to it.
3.119 -@end deftypefun
3.120 -
3.121 -@deftypefun EdgeIt Graph::addEdge (@w{const @mref{Graph-NodeIterator,NodeIt} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIt} @var{to}})
3.122 -Adds a new edge with tail @var{from} and head @var{to} to the graph
3.123 -and returns an @code{EdgeIt} pointing to it.
3.124 -@end deftypefun
3.125 -
3.126 -@deftypefun void Graph::delete (@w{const @mref{Graph-NodeIterator,NodeIt} @var{n}})
3.127 -Deletes the node @var{n}. It also deletes the adjacent edges.
3.128 -@end deftypefun
3.129 -
3.130 -@deftypefun void Graph::delete (@w{const @mref{Graph-EdgeIterator,EdgeIt} @var{e}})
3.131 -Deletes the edge @var{n}.
3.132 -@end deftypefun
3.133 -
3.134 -@deftypefun void Graph::clear ()
3.135 -Deletes all edges and nodes from the graph.
3.136 -@end deftypefun
3.137 -
3.138 -@deftypefun int Graph::nodeNum ()
3.139 -Returns the number of the nodes in the graph.
3.140 -??? Is it necessary???
3.141 -@end deftypefun
3.142 -
3.143 -@subsubsection NodeIt Operations
3.144 -
3.145 -@deftypefun NodeIt Graph::getFirst (NodeIt &@var{n}) const
3.146 -@deftypefunx NodeIt Graph::getNext (NodeIt @var{n}) const
3.147 -@deftypefunx {NodeIt &} Graph::next (NodeIt &@var{n})
3.148 -The nodes in the graph forms a list. @code{getFirst(n)} sets @var{n} to
3.149 -be the first node. @code{getNext(n)} gives back the subsequent
3.150 -node. @code{next(n)} is equivalent to @code{n=getNext(n)}, though it
3.151 -might be faster. ??? What should be the return value ???
3.152 -@end deftypefun
3.153 -
3.154 -@deftypefun bool Graph::valid (NodeIt &@var{e})
3.155 -@c @deftypefunx bool NodeIt::valid ()
3.156 -These functions check if and NodeIt is valid or not.
3.157 -@c ??? Which one should be implemented ???
3.158 -@end deftypefun
3.159 -
3.160 -@subsubsection EdgeIt Operations
3.161 -
3.162 -@deftypefun EachEdgeIt Graph::getFirst (const EachEdgeIt & @var{e}) const
3.163 -@deftypefunx EachEdgeIt Graph::getNext (EachEdgeIt @var{n}) const
3.164 -@deftypefunx {EachEdgeIt &} Graph::next (EachEdgeIt &@var{n})
3.165 -With these functions you can go though all the edges of the graph.
3.166 -@c ??? What should be the return value ???
3.167 -@end deftypefun
3.168 -
3.169 -@deftypefun InEdgeIt &Graph::getFirst (InEdgeIt & @var{e}, const NodeIt @var{n})
3.170 -@deftypefunx OutEdgeIt &Graph::getFirst (OutEdgeIt & @var{e}, const NodeIt @var{n})
3.171 -@c @deftypefunx SymEdgeIt &Graph::getFirst (SymEdgeIt & @var{e}, const NodeIt @var{n})
3.172 -The edges leaving from
3.173 -or
3.174 -arriving at
3.175 -@c or adjacent with
3.176 -a node forms a
3.177 -list. These functions give back the first elements of these
3.178 -lists. The exact behavior depends on the type of @var{e}.
3.179 -
3.180 -If @var{e} is an @code{InEdgeIt} or an @code{OutEdgeIt} then
3.181 -@code{getFirst} sets @var{e} to be the first incoming or outgoing edge
3.182 -of the node @var{n}, respectively.
3.183 -
3.184 -@c If @var{e} is a @code{SymEdgeIt} then
3.185 -@c @code{getFirst} sets @var{e} to be the first incoming if there exists one
3.186 -@c otherwise the first outgoing edge.
3.187 -
3.188 -If there are no such edges, @var{e} will be invalid.
3.189 -
3.190 -@end deftypefun
3.191 -
3.192 -@deftypefun InEdgeIt Graph::next (const InEdgeIt @var{e})
3.193 -@deftypefunx OutEdgeIt Graph::next (const OutEdgeIt @var{e})
3.194 -@deftypefunx SymEdgeIt Graph::next (const SymEdgeIt @var{e})
3.195 -These functions give back the edge that follows @var{e}
3.196 -@end deftypefun
3.197 -
3.198 -@deftypefun {InEdgeIt &} Graph::goNext (InEdgeIt &@var{e})
3.199 -@deftypefunx {OutEdgeIt &} Graph::goNext (OutEdgeIt &@var{e})
3.200 -@deftypefunx {SymEdgeIt &} Graph::goNext (SymEdgeIt &@var{e})
3.201 -@code{G.goNext(e)} is equivalent to @code{e=G.next(e)}, though it
3.202 -might be faster.
3.203 -??? What should be the return value ???
3.204 -@end deftypefun
3.205 -
3.206 -@deftypefun bool Graph::valid (EdgeIt &@var{e})
3.207 -@deftypefunx bool EdgeIt::valid ()
3.208 -These functions check if and EdgeIt is valid or not.
3.209 -??? Which one should be implemented ???
3.210 -@end deftypefun
3.211 -
3.212 -@deftypefun NodeIt Graph::tail (const EdgeIt @var{e})
3.213 -@deftypefunx NodeIt Graph::head (const EdgeIt @var{e})
3.214 -@deftypefunx NodeIt Graph::aNode (const InEdgeIt @var{e})
3.215 -@deftypefunx NodeIt Graph::aNode (const OutEdgeIt @var{e})
3.216 -@deftypefunx NodeIt Graph::aNode (const SymEdgeIt @var{e})
3.217 -@deftypefunx NodeIt Graph::bNode (const InEdgeIt @var{e})
3.218 -@deftypefunx NodeIt Graph::bNode (const OutEdgeIt @var{e})
3.219 -@deftypefunx NodeIt Graph::bNode (const SymEdgeIt @var{e})
3.220 -There queries give back the two endpoints of the edge @var{e}. For a
3.221 -directed edge @var{e}, @code{tail(e)} and @code{head(e)} is its tail and
3.222 -its head, respectively. For an undirected @var{e}, they are two
3.223 -endpoints, but you should not rely on which end is which.
3.224 -
3.225 -@code{aNode(e)} is the node which @var{e} is bounded to, i.e. it is
3.226 -equal to @code{tail(e)} if @var{e} is an @code{OutEdgeIt} and
3.227 -@code{head(e)} if @var{e} is an @code{InEdgeIt}. If @var{e} is a
3.228 -@code{SymEdgeIt} and it or its first preceding edge was created by
3.229 -@code{getFirst(e,n)}, then @code{aNode(e)} is equal to @var{n}.
3.230 -
3.231 -@code{bNode(e)} is the other end of the edge.
3.232 -
3.233 -@deftypefun void Graph::setInvalid (EdgeIt &@var{e})
3.234 -@deftypefunx void Graph::setInvalid (EdgeIt &@var{e})
3.235 -These functions set the corresponding iterator to be invalid.
3.236 -@end deftypefun
3.237 -
3.238 -@c ???It is implemented in an other way now. (Member function <-> Graph global)???
3.239 -@end deftypefun
3.240 -
3.241 -
3.242 -
3.243 -@c @deftypevar int from
3.244 -@c the tail of the created edge.
3.245 -@c @end deftypevar
4.1 --- a/doc/texinfo.tex Thu Apr 29 08:33:16 2004 +0000
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,6615 +0,0 @@
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:
5.1 --- a/doc/version.texi Thu Apr 29 08:33:16 2004 +0000
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,2 +0,0 @@
5.4 -@set VERSION 0.0.2
5.5 -@set UPDATED 2004
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/work/alpar/attic/texi/etikol.texi Thu Apr 29 08:42:05 2004 +0000
6.3 @@ -0,0 +1,189 @@
6.4 +\input texinfo @c -*-texinfo-*-
6.5 +@comment $Id: etikol.texi,v 1.5 2004/02/10 13:29:15 alpar Exp $
6.6 +@comment %**start of header
6.7 +@setfilename etikol.info
6.8 +@include version.texi
6.9 +@settitle GNU ETIK-OL Optimization Library @value{VERSION}
6.10 +@syncodeindex pg cp
6.11 +
6.12 +@c @ifnottex
6.13 +@c @macro mref { nn, txt }
6.14 +@c @ref{\nn\,\txt\}
6.15 +@c @end macro
6.16 +@c @end ifnottex
6.17 +@c @iftex
6.18 +@macro mref { nn, txt }
6.19 +@ifnottex
6.20 +@ref{\nn\,\txt\}
6.21 +@end ifnottex
6.22 +@tex
6.23 +\txt\
6.24 +@end tex
6.25 +@end macro
6.26 +@c @href{\nn\}{\txt\}
6.27 +
6.28 +
6.29 +
6.30 +@c @ifplaintext
6.31 +@c Whereas this text will only appear in plain text.
6.32 +@c @end ifplaintext
6.33 +@c @ifxml
6.34 +@c And this will only appear in XML output.
6.35 +@c @end ifxm
6.36 +@c @ref{\nn\,\txt\}
6.37 +
6.38 +
6.39 +@comment %**end of header
6.40 +
6.41 +@copying
6.42 +This manual is for GNU ETIL-OL Optimization Library
6.43 +(version @value{VERSION}, @value{UPDATED}).
6.44 +
6.45 +Copyright @copyright{} 2003 ETIK.
6.46 +
6.47 +@quotation
6.48 +Permission is granted to copy, distribute and/or modify this document
6.49 +under the terms of the GNU Free Documentation License, Version 1.1 or
6.50 +any later version published by the Free Software Foundation; with no
6.51 +Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
6.52 +and with the Back-Cover Texts as in (a) below. A copy of the
6.53 +license is included in the section entitled ``GNU Free Documentation
6.54 +License.''
6.55 +
6.56 +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
6.57 +this GNU Manual, like GNU software. Copies published by the Free
6.58 +Software Foundation raise funds for GNU development.''
6.59 +@end quotation
6.60 +@end copying
6.61 +
6.62 +@dircategory Texinfo documentation system
6.63 +@direntry
6.64 +* ETIK-OL: ETIK-OL Optimization Library.
6.65 +@end direntry
6.66 +
6.67 +@titlepage
6.68 +@title GNU ETIL-OL Optimization Library
6.69 +@subtitle for version @value{VERSION}, @value{UPDATED}
6.70 +@author ETIK Group
6.71 +@page
6.72 +@vskip 0pt plus 1filll
6.73 +@c @insertcopying
6.74 +@end titlepage
6.75 +
6.76 +@contents
6.77 +
6.78 +@ifnottex
6.79 +@node Top
6.80 +@top GNU ETIK-OL Library
6.81 +
6.82 +@c @insertcopying
6.83 +@end ifnottex
6.84 +
6.85 +@menu
6.86 +* Basic Concepts::
6.87 +* Copying This Manual::
6.88 +* Index::
6.89 +@end menu
6.90 +
6.91 +
6.92 +@node Basic Concepts
6.93 +@chapter Basic Concepts
6.94 +
6.95 +@menu
6.96 +* The Full Feature Graph Class::
6.97 +* The BFS algorithm::
6.98 +@end menu
6.99 +
6.100 +@include flf-graph.texi
6.101 +
6.102 +@c @node A Full Feature Graph
6.103 +@c @section A Full Feature Graph
6.104 +@c @cindex Full Feature Graph
6.105 +
6.106 +@node The BFS algorithm
6.107 +@section The BFS algorithm
6.108 +@cindex The BFS algorithm
6.109 +
6.110 +@menu
6.111 +* Iterator style BFS class::
6.112 +* The BFS funcion::
6.113 +@end menu
6.114 +
6.115 +bla2
6.116 +
6.117 +@node Iterator style BFS class
6.118 +@subsection Iterator style BFS class
6.119 +@cindex BFS algorithm
6.120 +@cindex BFS concept
6.121 +
6.122 +Here is a code example.
6.123 +
6.124 +
6.125 +@quotation
6.126 +@verbatim
6.127 +class
6.128 +{
6.129 +public:
6.130 + bfs_node_data<G> NodeType::*d;
6.131 + typedef typename G::EdgeIterator value_type;
6.132 + void Put(typename G::NodeIterator &i,
6.133 + const value_type &t);
6.134 + value_type Get(const typename G::NodeIterator &i) const;
6.135 +} tree;
6.136 +@end verbatim
6.137 +@end quotation
6.138 +
6.139 +
6.140 +The same code with a remark.
6.141 +
6.142 +@comment @quotation
6.143 +@example
6.144 +class
6.145 +@{
6.146 +public:
6.147 + bfs_node_data<G> NodeType::*d;
6.148 + typedef typename G::EdgeIterator value_type;
6.149 + void Put(typename G::NodeIterator &i,
6.150 + const value_type &t); @r{This is a long funcion declaration.}
6.151 + value_type Get(const typename G::NodeIterator &i) const;
6.152 +@} tree;
6.153 +@end example
6.154 +@comment @end quotation
6.155 +
6.156 +@node The BFS funcion
6.157 +@subsection The BFS funcion
6.158 +@cindex BFS algorithm
6.159 +
6.160 +@enumerate
6.161 +@item
6.162 +This is the first item.
6.163 +
6.164 +@item
6.165 +This is the second item.
6.166 +@end enumerate
6.167 +
6.168 +
6.169 +@node Copying This Manual
6.170 +@appendix Copying This Manual
6.171 +
6.172 +@menu
6.173 +* GNU Free Documentation License:: License for copying this manual.
6.174 +@end menu
6.175 +
6.176 +@include fdl.texi
6.177 +
6.178 +
6.179 +@node Index
6.180 +@unnumbered Concept Index
6.181 +@printindex cp
6.182 +
6.183 +@c @node Function Index
6.184 +@unnumbered Function Index
6.185 +@printindex fn
6.186 +
6.187 +@c @node Type Index
6.188 +@unnumbered Type Index
6.189 +@printindex tp
6.190 +
6.191 +@bye
6.192 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/work/alpar/attic/texi/fdl.texi Thu Apr 29 08:42:05 2004 +0000
7.3 @@ -0,0 +1,452 @@
7.4 +
7.5 +@node GNU Free Documentation License
7.6 +@appendixsec GNU Free Documentation License
7.7 +
7.8 +@cindex FDL, GNU Free Documentation License
7.9 +@center Version 1.2, November 2002
7.10 +
7.11 +@display
7.12 +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
7.13 +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
7.14 +
7.15 +Everyone is permitted to copy and distribute verbatim copies
7.16 +of this license document, but changing it is not allowed.
7.17 +@end display
7.18 +
7.19 +@enumerate 0
7.20 +@item
7.21 +PREAMBLE
7.22 +
7.23 +The purpose of this License is to make a manual, textbook, or other
7.24 +functional and useful document @dfn{free} in the sense of freedom: to
7.25 +assure everyone the effective freedom to copy and redistribute it,
7.26 +with or without modifying it, either commercially or noncommercially.
7.27 +Secondarily, this License preserves for the author and publisher a way
7.28 +to get credit for their work, while not being considered responsible
7.29 +for modifications made by others.
7.30 +
7.31 +This License is a kind of ``copyleft'', which means that derivative
7.32 +works of the document must themselves be free in the same sense. It
7.33 +complements the GNU General Public License, which is a copyleft
7.34 +license designed for free software.
7.35 +
7.36 +We have designed this License in order to use it for manuals for free
7.37 +software, because free software needs free documentation: a free
7.38 +program should come with manuals providing the same freedoms that the
7.39 +software does. But this License is not limited to software manuals;
7.40 +it can be used for any textual work, regardless of subject matter or
7.41 +whether it is published as a printed book. We recommend this License
7.42 +principally for works whose purpose is instruction or reference.
7.43 +
7.44 +@item
7.45 +APPLICABILITY AND DEFINITIONS
7.46 +
7.47 +This License applies to any manual or other work, in any medium, that
7.48 +contains a notice placed by the copyright holder saying it can be
7.49 +distributed under the terms of this License. Such a notice grants a
7.50 +world-wide, royalty-free license, unlimited in duration, to use that
7.51 +work under the conditions stated herein. The ``Document'', below,
7.52 +refers to any such manual or work. Any member of the public is a
7.53 +licensee, and is addressed as ``you''. You accept the license if you
7.54 +copy, modify or distribute the work in a way requiring permission
7.55 +under copyright law.
7.56 +
7.57 +A ``Modified Version'' of the Document means any work containing the
7.58 +Document or a portion of it, either copied verbatim, or with
7.59 +modifications and/or translated into another language.
7.60 +
7.61 +A ``Secondary Section'' is a named appendix or a front-matter section
7.62 +of the Document that deals exclusively with the relationship of the
7.63 +publishers or authors of the Document to the Document's overall
7.64 +subject (or to related matters) and contains nothing that could fall
7.65 +directly within that overall subject. (Thus, if the Document is in
7.66 +part a textbook of mathematics, a Secondary Section may not explain
7.67 +any mathematics.) The relationship could be a matter of historical
7.68 +connection with the subject or with related matters, or of legal,
7.69 +commercial, philosophical, ethical or political position regarding
7.70 +them.
7.71 +
7.72 +The ``Invariant Sections'' are certain Secondary Sections whose titles
7.73 +are designated, as being those of Invariant Sections, in the notice
7.74 +that says that the Document is released under this License. If a
7.75 +section does not fit the above definition of Secondary then it is not
7.76 +allowed to be designated as Invariant. The Document may contain zero
7.77 +Invariant Sections. If the Document does not identify any Invariant
7.78 +Sections then there are none.
7.79 +
7.80 +The ``Cover Texts'' are certain short passages of text that are listed,
7.81 +as Front-Cover Texts or Back-Cover Texts, in the notice that says that
7.82 +the Document is released under this License. A Front-Cover Text may
7.83 +be at most 5 words, and a Back-Cover Text may be at most 25 words.
7.84 +
7.85 +A ``Transparent'' copy of the Document means a machine-readable copy,
7.86 +represented in a format whose specification is available to the
7.87 +general public, that is suitable for revising the document
7.88 +straightforwardly with generic text editors or (for images composed of
7.89 +pixels) generic paint programs or (for drawings) some widely available
7.90 +drawing editor, and that is suitable for input to text formatters or
7.91 +for automatic translation to a variety of formats suitable for input
7.92 +to text formatters. A copy made in an otherwise Transparent file
7.93 +format whose markup, or absence of markup, has been arranged to thwart
7.94 +or discourage subsequent modification by readers is not Transparent.
7.95 +An image format is not Transparent if used for any substantial amount
7.96 +of text. A copy that is not ``Transparent'' is called ``Opaque''.
7.97 +
7.98 +Examples of suitable formats for Transparent copies include plain
7.99 +@sc{ascii} without markup, Texinfo input format, La@TeX{} input
7.100 +format, @acronym{SGML} or @acronym{XML} using a publicly available
7.101 +@acronym{DTD}, and standard-conforming simple @acronym{HTML},
7.102 +PostScript or @acronym{PDF} designed for human modification. Examples
7.103 +of transparent image formats include @acronym{PNG}, @acronym{XCF} and
7.104 +@acronym{JPG}. Opaque formats include proprietary formats that can be
7.105 +read and edited only by proprietary word processors, @acronym{SGML} or
7.106 +@acronym{XML} for which the @acronym{DTD} and/or processing tools are
7.107 +not generally available, and the machine-generated @acronym{HTML},
7.108 +PostScript or @acronym{PDF} produced by some word processors for
7.109 +output purposes only.
7.110 +
7.111 +The ``Title Page'' means, for a printed book, the title page itself,
7.112 +plus such following pages as are needed to hold, legibly, the material
7.113 +this License requires to appear in the title page. For works in
7.114 +formats which do not have any title page as such, ``Title Page'' means
7.115 +the text near the most prominent appearance of the work's title,
7.116 +preceding the beginning of the body of the text.
7.117 +
7.118 +A section ``Entitled XYZ'' means a named subunit of the Document whose
7.119 +title either is precisely XYZ or contains XYZ in parentheses following
7.120 +text that translates XYZ in another language. (Here XYZ stands for a
7.121 +specific section name mentioned below, such as ``Acknowledgements'',
7.122 +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
7.123 +of such a section when you modify the Document means that it remains a
7.124 +section ``Entitled XYZ'' according to this definition.
7.125 +
7.126 +The Document may include Warranty Disclaimers next to the notice which
7.127 +states that this License applies to the Document. These Warranty
7.128 +Disclaimers are considered to be included by reference in this
7.129 +License, but only as regards disclaiming warranties: any other
7.130 +implication that these Warranty Disclaimers may have is void and has
7.131 +no effect on the meaning of this License.
7.132 +
7.133 +@item
7.134 +VERBATIM COPYING
7.135 +
7.136 +You may copy and distribute the Document in any medium, either
7.137 +commercially or noncommercially, provided that this License, the
7.138 +copyright notices, and the license notice saying this License applies
7.139 +to the Document are reproduced in all copies, and that you add no other
7.140 +conditions whatsoever to those of this License. You may not use
7.141 +technical measures to obstruct or control the reading or further
7.142 +copying of the copies you make or distribute. However, you may accept
7.143 +compensation in exchange for copies. If you distribute a large enough
7.144 +number of copies you must also follow the conditions in section 3.
7.145 +
7.146 +You may also lend copies, under the same conditions stated above, and
7.147 +you may publicly display copies.
7.148 +
7.149 +@item
7.150 +COPYING IN QUANTITY
7.151 +
7.152 +If you publish printed copies (or copies in media that commonly have
7.153 +printed covers) of the Document, numbering more than 100, and the
7.154 +Document's license notice requires Cover Texts, you must enclose the
7.155 +copies in covers that carry, clearly and legibly, all these Cover
7.156 +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
7.157 +the back cover. Both covers must also clearly and legibly identify
7.158 +you as the publisher of these copies. The front cover must present
7.159 +the full title with all words of the title equally prominent and
7.160 +visible. You may add other material on the covers in addition.
7.161 +Copying with changes limited to the covers, as long as they preserve
7.162 +the title of the Document and satisfy these conditions, can be treated
7.163 +as verbatim copying in other respects.
7.164 +
7.165 +If the required texts for either cover are too voluminous to fit
7.166 +legibly, you should put the first ones listed (as many as fit
7.167 +reasonably) on the actual cover, and continue the rest onto adjacent
7.168 +pages.
7.169 +
7.170 +If you publish or distribute Opaque copies of the Document numbering
7.171 +more than 100, you must either include a machine-readable Transparent
7.172 +copy along with each Opaque copy, or state in or with each Opaque copy
7.173 +a computer-network location from which the general network-using
7.174 +public has access to download using public-standard network protocols
7.175 +a complete Transparent copy of the Document, free of added material.
7.176 +If you use the latter option, you must take reasonably prudent steps,
7.177 +when you begin distribution of Opaque copies in quantity, to ensure
7.178 +that this Transparent copy will remain thus accessible at the stated
7.179 +location until at least one year after the last time you distribute an
7.180 +Opaque copy (directly or through your agents or retailers) of that
7.181 +edition to the public.
7.182 +
7.183 +It is requested, but not required, that you contact the authors of the
7.184 +Document well before redistributing any large number of copies, to give
7.185 +them a chance to provide you with an updated version of the Document.
7.186 +
7.187 +@item
7.188 +MODIFICATIONS
7.189 +
7.190 +You may copy and distribute a Modified Version of the Document under
7.191 +the conditions of sections 2 and 3 above, provided that you release
7.192 +the Modified Version under precisely this License, with the Modified
7.193 +Version filling the role of the Document, thus licensing distribution
7.194 +and modification of the Modified Version to whoever possesses a copy
7.195 +of it. In addition, you must do these things in the Modified Version:
7.196 +
7.197 +@enumerate A
7.198 +@item
7.199 +Use in the Title Page (and on the covers, if any) a title distinct
7.200 +from that of the Document, and from those of previous versions
7.201 +(which should, if there were any, be listed in the History section
7.202 +of the Document). You may use the same title as a previous version
7.203 +if the original publisher of that version gives permission.
7.204 +
7.205 +@item
7.206 +List on the Title Page, as authors, one or more persons or entities
7.207 +responsible for authorship of the modifications in the Modified
7.208 +Version, together with at least five of the principal authors of the
7.209 +Document (all of its principal authors, if it has fewer than five),
7.210 +unless they release you from this requirement.
7.211 +
7.212 +@item
7.213 +State on the Title page the name of the publisher of the
7.214 +Modified Version, as the publisher.
7.215 +
7.216 +@item
7.217 +Preserve all the copyright notices of the Document.
7.218 +
7.219 +@item
7.220 +Add an appropriate copyright notice for your modifications
7.221 +adjacent to the other copyright notices.
7.222 +
7.223 +@item
7.224 +Include, immediately after the copyright notices, a license notice
7.225 +giving the public permission to use the Modified Version under the
7.226 +terms of this License, in the form shown in the Addendum below.
7.227 +
7.228 +@item
7.229 +Preserve in that license notice the full lists of Invariant Sections
7.230 +and required Cover Texts given in the Document's license notice.
7.231 +
7.232 +@item
7.233 +Include an unaltered copy of this License.
7.234 +
7.235 +@item
7.236 +Preserve the section Entitled ``History'', Preserve its Title, and add
7.237 +to it an item stating at least the title, year, new authors, and
7.238 +publisher of the Modified Version as given on the Title Page. If
7.239 +there is no section Entitled ``History'' in the Document, create one
7.240 +stating the title, year, authors, and publisher of the Document as
7.241 +given on its Title Page, then add an item describing the Modified
7.242 +Version as stated in the previous sentence.
7.243 +
7.244 +@item
7.245 +Preserve the network location, if any, given in the Document for
7.246 +public access to a Transparent copy of the Document, and likewise
7.247 +the network locations given in the Document for previous versions
7.248 +it was based on. These may be placed in the ``History'' section.
7.249 +You may omit a network location for a work that was published at
7.250 +least four years before the Document itself, or if the original
7.251 +publisher of the version it refers to gives permission.
7.252 +
7.253 +@item
7.254 +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
7.255 +the Title of the section, and preserve in the section all the
7.256 +substance and tone of each of the contributor acknowledgements and/or
7.257 +dedications given therein.
7.258 +
7.259 +@item
7.260 +Preserve all the Invariant Sections of the Document,
7.261 +unaltered in their text and in their titles. Section numbers
7.262 +or the equivalent are not considered part of the section titles.
7.263 +
7.264 +@item
7.265 +Delete any section Entitled ``Endorsements''. Such a section
7.266 +may not be included in the Modified Version.
7.267 +
7.268 +@item
7.269 +Do not retitle any existing section to be Entitled ``Endorsements'' or
7.270 +to conflict in title with any Invariant Section.
7.271 +
7.272 +@item
7.273 +Preserve any Warranty Disclaimers.
7.274 +@end enumerate
7.275 +
7.276 +If the Modified Version includes new front-matter sections or
7.277 +appendices that qualify as Secondary Sections and contain no material
7.278 +copied from the Document, you may at your option designate some or all
7.279 +of these sections as invariant. To do this, add their titles to the
7.280 +list of Invariant Sections in the Modified Version's license notice.
7.281 +These titles must be distinct from any other section titles.
7.282 +
7.283 +You may add a section Entitled ``Endorsements'', provided it contains
7.284 +nothing but endorsements of your Modified Version by various
7.285 +parties---for example, statements of peer review or that the text has
7.286 +been approved by an organization as the authoritative definition of a
7.287 +standard.
7.288 +
7.289 +You may add a passage of up to five words as a Front-Cover Text, and a
7.290 +passage of up to 25 words as a Back-Cover Text, to the end of the list
7.291 +of Cover Texts in the Modified Version. Only one passage of
7.292 +Front-Cover Text and one of Back-Cover Text may be added by (or
7.293 +through arrangements made by) any one entity. If the Document already
7.294 +includes a cover text for the same cover, previously added by you or
7.295 +by arrangement made by the same entity you are acting on behalf of,
7.296 +you may not add another; but you may replace the old one, on explicit
7.297 +permission from the previous publisher that added the old one.
7.298 +
7.299 +The author(s) and publisher(s) of the Document do not by this License
7.300 +give permission to use their names for publicity for or to assert or
7.301 +imply endorsement of any Modified Version.
7.302 +
7.303 +@item
7.304 +COMBINING DOCUMENTS
7.305 +
7.306 +You may combine the Document with other documents released under this
7.307 +License, under the terms defined in section 4 above for modified
7.308 +versions, provided that you include in the combination all of the
7.309 +Invariant Sections of all of the original documents, unmodified, and
7.310 +list them all as Invariant Sections of your combined work in its
7.311 +license notice, and that you preserve all their Warranty Disclaimers.
7.312 +
7.313 +The combined work need only contain one copy of this License, and
7.314 +multiple identical Invariant Sections may be replaced with a single
7.315 +copy. If there are multiple Invariant Sections with the same name but
7.316 +different contents, make the title of each such section unique by
7.317 +adding at the end of it, in parentheses, the name of the original
7.318 +author or publisher of that section if known, or else a unique number.
7.319 +Make the same adjustment to the section titles in the list of
7.320 +Invariant Sections in the license notice of the combined work.
7.321 +
7.322 +In the combination, you must combine any sections Entitled ``History''
7.323 +in the various original documents, forming one section Entitled
7.324 +``History''; likewise combine any sections Entitled ``Acknowledgements'',
7.325 +and any sections Entitled ``Dedications''. You must delete all
7.326 +sections Entitled ``Endorsements.''
7.327 +
7.328 +@item
7.329 +COLLECTIONS OF DOCUMENTS
7.330 +
7.331 +You may make a collection consisting of the Document and other documents
7.332 +released under this License, and replace the individual copies of this
7.333 +License in the various documents with a single copy that is included in
7.334 +the collection, provided that you follow the rules of this License for
7.335 +verbatim copying of each of the documents in all other respects.
7.336 +
7.337 +You may extract a single document from such a collection, and distribute
7.338 +it individually under this License, provided you insert a copy of this
7.339 +License into the extracted document, and follow this License in all
7.340 +other respects regarding verbatim copying of that document.
7.341 +
7.342 +@item
7.343 +AGGREGATION WITH INDEPENDENT WORKS
7.344 +
7.345 +A compilation of the Document or its derivatives with other separate
7.346 +and independent documents or works, in or on a volume of a storage or
7.347 +distribution medium, is called an ``aggregate'' if the copyright
7.348 +resulting from the compilation is not used to limit the legal rights
7.349 +of the compilation's users beyond what the individual works permit.
7.350 +When the Document is included in an aggregate, this License does not
7.351 +apply to the other works in the aggregate which are not themselves
7.352 +derivative works of the Document.
7.353 +
7.354 +If the Cover Text requirement of section 3 is applicable to these
7.355 +copies of the Document, then if the Document is less than one half of
7.356 +the entire aggregate, the Document's Cover Texts may be placed on
7.357 +covers that bracket the Document within the aggregate, or the
7.358 +electronic equivalent of covers if the Document is in electronic form.
7.359 +Otherwise they must appear on printed covers that bracket the whole
7.360 +aggregate.
7.361 +
7.362 +@item
7.363 +TRANSLATION
7.364 +
7.365 +Translation is considered a kind of modification, so you may
7.366 +distribute translations of the Document under the terms of section 4.
7.367 +Replacing Invariant Sections with translations requires special
7.368 +permission from their copyright holders, but you may include
7.369 +translations of some or all Invariant Sections in addition to the
7.370 +original versions of these Invariant Sections. You may include a
7.371 +translation of this License, and all the license notices in the
7.372 +Document, and any Warranty Disclaimers, provided that you also include
7.373 +the original English version of this License and the original versions
7.374 +of those notices and disclaimers. In case of a disagreement between
7.375 +the translation and the original version of this License or a notice
7.376 +or disclaimer, the original version will prevail.
7.377 +
7.378 +If a section in the Document is Entitled ``Acknowledgements'',
7.379 +``Dedications'', or ``History'', the requirement (section 4) to Preserve
7.380 +its Title (section 1) will typically require changing the actual
7.381 +title.
7.382 +
7.383 +@item
7.384 +TERMINATION
7.385 +
7.386 +You may not copy, modify, sublicense, or distribute the Document except
7.387 +as expressly provided for under this License. Any other attempt to
7.388 +copy, modify, sublicense or distribute the Document is void, and will
7.389 +automatically terminate your rights under this License. However,
7.390 +parties who have received copies, or rights, from you under this
7.391 +License will not have their licenses terminated so long as such
7.392 +parties remain in full compliance.
7.393 +
7.394 +@item
7.395 +FUTURE REVISIONS OF THIS LICENSE
7.396 +
7.397 +The Free Software Foundation may publish new, revised versions
7.398 +of the GNU Free Documentation License from time to time. Such new
7.399 +versions will be similar in spirit to the present version, but may
7.400 +differ in detail to address new problems or concerns. See
7.401 +@uref{http://www.gnu.org/copyleft/}.
7.402 +
7.403 +Each version of the License is given a distinguishing version number.
7.404 +If the Document specifies that a particular numbered version of this
7.405 +License ``or any later version'' applies to it, you have the option of
7.406 +following the terms and conditions either of that specified version or
7.407 +of any later version that has been published (not as a draft) by the
7.408 +Free Software Foundation. If the Document does not specify a version
7.409 +number of this License, you may choose any version ever published (not
7.410 +as a draft) by the Free Software Foundation.
7.411 +@end enumerate
7.412 +
7.413 +@page
7.414 +@appendixsubsec ADDENDUM: How to use this License for your documents
7.415 +
7.416 +To use this License in a document you have written, include a copy of
7.417 +the License in the document and put the following copyright and
7.418 +license notices just after the title page:
7.419 +
7.420 +@smallexample
7.421 +@group
7.422 + Copyright (C) @var{year} @var{your name}.
7.423 + Permission is granted to copy, distribute and/or modify this document
7.424 + under the terms of the GNU Free Documentation License, Version 1.2
7.425 + or any later version published by the Free Software Foundation;
7.426 + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
7.427 + Texts. A copy of the license is included in the section entitled ``GNU
7.428 + Free Documentation License''.
7.429 +@end group
7.430 +@end smallexample
7.431 +
7.432 +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
7.433 +replace the ``with...Texts.'' line with this:
7.434 +
7.435 +@smallexample
7.436 +@group
7.437 + with the Invariant Sections being @var{list their titles}, with
7.438 + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
7.439 + being @var{list}.
7.440 +@end group
7.441 +@end smallexample
7.442 +
7.443 +If you have Invariant Sections without Cover Texts, or some other
7.444 +combination of the three, merge those two alternatives to suit the
7.445 +situation.
7.446 +
7.447 +If your document contains nontrivial examples of program code, we
7.448 +recommend releasing these examples in parallel under your choice of
7.449 +free software license, such as the GNU General Public License,
7.450 +to permit their use in free software.
7.451 +
7.452 +@c Local Variables:
7.453 +@c ispell-local-pdict: "ispell-dict"
7.454 +@c End:
7.455 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/work/alpar/attic/texi/flf-graph.texi Thu Apr 29 08:42:05 2004 +0000
8.3 @@ -0,0 +1,242 @@
8.4 +@node The Full Feature Graph Class
8.5 +@section The Full Feature Graph Class
8.6 +@cindex Full Feature Graph Class
8.7 +
8.8 +This section describes what an imaginary full feature graph class knows.
8.9 +The set of features provided by a real graph implementation is typically
8.10 +a subset of the features below.
8.11 +
8.12 +On the other hand, each graph algorithm requires the underlying graph
8.13 +structure to provide a certain (typically small) set of features in order
8.14 +to be able to run.
8.15 +
8.16 +@subsection Declaration
8.17 +
8.18 +@deftp {Class} {class Graph}
8.19 +@code{Graph} is the imaginary @emph{full feature graph class}.
8.20 +@code{G} denotes the instance of this class in the exaples below.
8.21 +@c Each node and edge has a user defined data sturcure
8.22 +@c @var{N} and @var{E} statically attached to it.
8.23 +@end deftp
8.24 +
8.25 +@subsection Types
8.26 +
8.27 +@c @deftp {Type} Graph::NodeType
8.28 +@c @deftpx {Type} Graph::EdgeType
8.29 +@c The type of the data stored statically for each node and edge.
8.30 +@c @end deftp
8.31 +
8.32 +@anchor{Graph-NodeIterator}
8.33 +@deftp {Type} Graph::NodeIt
8.34 +@c @deftpx {Type} Graph::NodeIterator
8.35 +These types points a node uniquely. The difference between the
8.36 +@code{NodeIt} and the @code{NodeIterator} is that @code{NodeIt}
8.37 +requires the graph structure itself for most of the operations.
8.38 +For examples using iterators you can go through all nodes as follows.
8.39 +@quotation
8.40 +@verbatim
8.41 +Graph G;
8.42 +int nodenum=0;
8.43 +for(Graph::NodeIterator n(G);n.valid();++n) ++nodenum;
8.44 +@end verbatim
8.45 +@end quotation
8.46 +Using @code{NodeIt} the last line looks like this.
8.47 +@quotation
8.48 +@verbatim
8.49 +for(Graph::NodeIt n(G);n.valid();n=G.next(n)) ++nodenum;
8.50 +@end verbatim
8.51 +@end quotation
8.52 +or
8.53 +@quotation
8.54 +@verbatim
8.55 +MyGraph::NodeIt n;
8.56 +for(G.getFirst(n);G.valid(n);G.goNext(n)) ++nodenum;
8.57 +@end verbatim
8.58 +@end quotation
8.59 +@end deftp
8.60 +
8.61 +@deftp {Type} Graph::EdgeIt
8.62 +@deftpx {Type} Graph::InEdgeIt
8.63 +@deftpx {Type} Graph::OutEdgeIt
8.64 +@deftpx {Type} Graph::EachEdgeIt
8.65 +@c @deftpx {Type} Graph::BiEdgeIt
8.66 +@c @deftpx {Type} Graph::SymEdgeIt
8.67 +Each of these types points an edge uniquely. The difference between the
8.68 +@code{EdgeIt} and the
8.69 +@c @mref{Graph-NodeIterator,@code{EdgeIterator}}
8.70 +@mref{Graph-NodeIterator , EdgeIterator}
8.71 +series is that
8.72 +@code{EdgeIt} requires the graph structure itself for most of the
8.73 +operations.
8.74 +@end deftp
8.75 +
8.76 +@anchor{Graph-EdgeIterator}
8.77 +@c @deftp {Type} Graph::EdgeIterator
8.78 +@c @deftpx {Type} Graph::InEdgeIterator
8.79 +@c @deftpx {Type} Graph::OutEdgeIterator
8.80 +@c @deftpx {Type} Graph::BiEdgeIterator
8.81 +@c @deftpx {Type} Graph::SymEdgeIterator
8.82 +@c @deftpx {Type} Graph::EachEdgeIterator
8.83 +@c Each of these types points an edge uniquely. The difference between the
8.84 +@c @code{EdgeIt} and the @code{EdgeIterator} series is that
8.85 +@c @code{EdgeIt} requires the graph structure itself for most of the
8.86 +@c operations.
8.87 +
8.88 +@c For the @code{EdgeIterator} types you can use operator @code{++}
8.89 +@c (both the prefix and the posfix one) to obtain the next edge.
8.90 +@c @end deftp
8.91 +
8.92 +@deftp {Type} Graph::NodeMap<typename T>
8.93 +@deftpx {Type} Graph::EdgeMap<typename T>
8.94 +There are the default property maps for the edges and the nodes.
8.95 +@end deftp
8.96 +
8.97 +@deftp {Type} Graph::DynNodeMap<typename T>
8.98 +@deftpx {Type} Graph::DynEdgeMap<typename T>
8.99 +There are the default @emph{dynamic} property maps for the edges and the nodes.
8.100 +@end deftp
8.101 +
8.102 +@subsection Member Functions
8.103 +
8.104 +@subsubsection Constructors
8.105 +
8.106 +@deftypefun { } Graph::Graph ()
8.107 +The default constructor.
8.108 +@end deftypefun
8.109 +
8.110 +@c @deftypefun { } Graph::Graph (Graph@tie{}&)
8.111 +@deftypefun { } Graph::Graph (Graph &)
8.112 +The copy constructor.
8.113 +@end deftypefun
8.114 +
8.115 +@subsubsection Graph Maintenence Operations
8.116 +
8.117 +@deftypefun NodeIt Graph::addNode ()
8.118 +Adds a new node to the graph and returns a @code{NodeIt} pointing to it.
8.119 +@end deftypefun
8.120 +
8.121 +@deftypefun EdgeIt Graph::addEdge (@w{const @mref{Graph-NodeIterator,NodeIt} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIt} @var{to}})
8.122 +Adds a new edge with tail @var{from} and head @var{to} to the graph
8.123 +and returns an @code{EdgeIt} pointing to it.
8.124 +@end deftypefun
8.125 +
8.126 +@deftypefun void Graph::delete (@w{const @mref{Graph-NodeIterator,NodeIt} @var{n}})
8.127 +Deletes the node @var{n}. It also deletes the adjacent edges.
8.128 +@end deftypefun
8.129 +
8.130 +@deftypefun void Graph::delete (@w{const @mref{Graph-EdgeIterator,EdgeIt} @var{e}})
8.131 +Deletes the edge @var{n}.
8.132 +@end deftypefun
8.133 +
8.134 +@deftypefun void Graph::clear ()
8.135 +Deletes all edges and nodes from the graph.
8.136 +@end deftypefun
8.137 +
8.138 +@deftypefun int Graph::nodeNum ()
8.139 +Returns the number of the nodes in the graph.
8.140 +??? Is it necessary???
8.141 +@end deftypefun
8.142 +
8.143 +@subsubsection NodeIt Operations
8.144 +
8.145 +@deftypefun NodeIt Graph::getFirst (NodeIt &@var{n}) const
8.146 +@deftypefunx NodeIt Graph::getNext (NodeIt @var{n}) const
8.147 +@deftypefunx {NodeIt &} Graph::next (NodeIt &@var{n})
8.148 +The nodes in the graph forms a list. @code{getFirst(n)} sets @var{n} to
8.149 +be the first node. @code{getNext(n)} gives back the subsequent
8.150 +node. @code{next(n)} is equivalent to @code{n=getNext(n)}, though it
8.151 +might be faster. ??? What should be the return value ???
8.152 +@end deftypefun
8.153 +
8.154 +@deftypefun bool Graph::valid (NodeIt &@var{e})
8.155 +@c @deftypefunx bool NodeIt::valid ()
8.156 +These functions check if and NodeIt is valid or not.
8.157 +@c ??? Which one should be implemented ???
8.158 +@end deftypefun
8.159 +
8.160 +@subsubsection EdgeIt Operations
8.161 +
8.162 +@deftypefun EachEdgeIt Graph::getFirst (const EachEdgeIt & @var{e}) const
8.163 +@deftypefunx EachEdgeIt Graph::getNext (EachEdgeIt @var{n}) const
8.164 +@deftypefunx {EachEdgeIt &} Graph::next (EachEdgeIt &@var{n})
8.165 +With these functions you can go though all the edges of the graph.
8.166 +@c ??? What should be the return value ???
8.167 +@end deftypefun
8.168 +
8.169 +@deftypefun InEdgeIt &Graph::getFirst (InEdgeIt & @var{e}, const NodeIt @var{n})
8.170 +@deftypefunx OutEdgeIt &Graph::getFirst (OutEdgeIt & @var{e}, const NodeIt @var{n})
8.171 +@c @deftypefunx SymEdgeIt &Graph::getFirst (SymEdgeIt & @var{e}, const NodeIt @var{n})
8.172 +The edges leaving from
8.173 +or
8.174 +arriving at
8.175 +@c or adjacent with
8.176 +a node forms a
8.177 +list. These functions give back the first elements of these
8.178 +lists. The exact behavior depends on the type of @var{e}.
8.179 +
8.180 +If @var{e} is an @code{InEdgeIt} or an @code{OutEdgeIt} then
8.181 +@code{getFirst} sets @var{e} to be the first incoming or outgoing edge
8.182 +of the node @var{n}, respectively.
8.183 +
8.184 +@c If @var{e} is a @code{SymEdgeIt} then
8.185 +@c @code{getFirst} sets @var{e} to be the first incoming if there exists one
8.186 +@c otherwise the first outgoing edge.
8.187 +
8.188 +If there are no such edges, @var{e} will be invalid.
8.189 +
8.190 +@end deftypefun
8.191 +
8.192 +@deftypefun InEdgeIt Graph::next (const InEdgeIt @var{e})
8.193 +@deftypefunx OutEdgeIt Graph::next (const OutEdgeIt @var{e})
8.194 +@deftypefunx SymEdgeIt Graph::next (const SymEdgeIt @var{e})
8.195 +These functions give back the edge that follows @var{e}
8.196 +@end deftypefun
8.197 +
8.198 +@deftypefun {InEdgeIt &} Graph::goNext (InEdgeIt &@var{e})
8.199 +@deftypefunx {OutEdgeIt &} Graph::goNext (OutEdgeIt &@var{e})
8.200 +@deftypefunx {SymEdgeIt &} Graph::goNext (SymEdgeIt &@var{e})
8.201 +@code{G.goNext(e)} is equivalent to @code{e=G.next(e)}, though it
8.202 +might be faster.
8.203 +??? What should be the return value ???
8.204 +@end deftypefun
8.205 +
8.206 +@deftypefun bool Graph::valid (EdgeIt &@var{e})
8.207 +@deftypefunx bool EdgeIt::valid ()
8.208 +These functions check if and EdgeIt is valid or not.
8.209 +??? Which one should be implemented ???
8.210 +@end deftypefun
8.211 +
8.212 +@deftypefun NodeIt Graph::tail (const EdgeIt @var{e})
8.213 +@deftypefunx NodeIt Graph::head (const EdgeIt @var{e})
8.214 +@deftypefunx NodeIt Graph::aNode (const InEdgeIt @var{e})
8.215 +@deftypefunx NodeIt Graph::aNode (const OutEdgeIt @var{e})
8.216 +@deftypefunx NodeIt Graph::aNode (const SymEdgeIt @var{e})
8.217 +@deftypefunx NodeIt Graph::bNode (const InEdgeIt @var{e})
8.218 +@deftypefunx NodeIt Graph::bNode (const OutEdgeIt @var{e})
8.219 +@deftypefunx NodeIt Graph::bNode (const SymEdgeIt @var{e})
8.220 +There queries give back the two endpoints of the edge @var{e}. For a
8.221 +directed edge @var{e}, @code{tail(e)} and @code{head(e)} is its tail and
8.222 +its head, respectively. For an undirected @var{e}, they are two
8.223 +endpoints, but you should not rely on which end is which.
8.224 +
8.225 +@code{aNode(e)} is the node which @var{e} is bounded to, i.e. it is
8.226 +equal to @code{tail(e)} if @var{e} is an @code{OutEdgeIt} and
8.227 +@code{head(e)} if @var{e} is an @code{InEdgeIt}. If @var{e} is a
8.228 +@code{SymEdgeIt} and it or its first preceding edge was created by
8.229 +@code{getFirst(e,n)}, then @code{aNode(e)} is equal to @var{n}.
8.230 +
8.231 +@code{bNode(e)} is the other end of the edge.
8.232 +
8.233 +@deftypefun void Graph::setInvalid (EdgeIt &@var{e})
8.234 +@deftypefunx void Graph::setInvalid (EdgeIt &@var{e})
8.235 +These functions set the corresponding iterator to be invalid.
8.236 +@end deftypefun
8.237 +
8.238 +@c ???It is implemented in an other way now. (Member function <-> Graph global)???
8.239 +@end deftypefun
8.240 +
8.241 +
8.242 +
8.243 +@c @deftypevar int from
8.244 +@c the tail of the created edge.
8.245 +@c @end deftypevar
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/work/alpar/attic/texi/texinfo.tex Thu Apr 29 08:42:05 2004 +0000
9.3 @@ -0,0 +1,6615 @@
9.4 +% texinfo.tex -- TeX macros to handle Texinfo files.
9.5 +%
9.6 +% Load plain if necessary, i.e., if running under initex.
9.7 +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
9.8 +%
9.9 +\def\texinfoversion{2003-07-28.08}
9.10 +%
9.11 +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9.12 +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
9.13 +%
9.14 +% This texinfo.tex file is free software; you can redistribute it and/or
9.15 +% modify it under the terms of the GNU General Public License as
9.16 +% published by the Free Software Foundation; either version 2, or (at
9.17 +% your option) any later version.
9.18 +%
9.19 +% This texinfo.tex file is distributed in the hope that it will be
9.20 +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
9.21 +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9.22 +% General Public License for more details.
9.23 +%
9.24 +% You should have received a copy of the GNU General Public License
9.25 +% along with this texinfo.tex file; see the file COPYING. If not, write
9.26 +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
9.27 +% Boston, MA 02111-1307, USA.
9.28 +%
9.29 +% In other words, you are welcome to use, share and improve this program.
9.30 +% You are forbidden to forbid anyone else to use, share and improve
9.31 +% what you give them. Help stamp out software-hoarding!
9.32 +%
9.33 +% Please try the latest version of texinfo.tex before submitting bug
9.34 +% reports; you can get the latest version from:
9.35 +% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
9.36 +% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
9.37 +% ftp://tug.org/tex/texinfo.tex
9.38 +% (and all CTAN mirrors, see http://www.ctan.org),
9.39 +% and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
9.40 +%
9.41 +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
9.42 +%
9.43 +% The texinfo.tex in any given Texinfo distribution could well be out
9.44 +% of date, so if that's what you're using, please check.
9.45 +%
9.46 +% Send bug reports to bug-texinfo@gnu.org. Please include including a
9.47 +% complete document in each bug report with which we can reproduce the
9.48 +% problem. Patches are, of course, greatly appreciated.
9.49 +%
9.50 +% To process a Texinfo manual with TeX, it's most reliable to use the
9.51 +% texi2dvi shell script that comes with the distribution. For a simple
9.52 +% manual foo.texi, however, you can get away with this:
9.53 +% tex foo.texi
9.54 +% texindex foo.??
9.55 +% tex foo.texi
9.56 +% tex foo.texi
9.57 +% dvips foo.dvi -o # or whatever; this makes foo.ps.
9.58 +% The extra TeX runs get the cross-reference information correct.
9.59 +% Sometimes one run after texindex suffices, and sometimes you need more
9.60 +% than two; texi2dvi does it as many times as necessary.
9.61 +%
9.62 +% It is possible to adapt texinfo.tex for other languages, to some
9.63 +% extent. You can get the existing language-specific files from the
9.64 +% full Texinfo distribution.
9.65 +
9.66 +\message{Loading texinfo [version \texinfoversion]:}
9.67 +
9.68 +% If in a .fmt file, print the version number
9.69 +% and turn on active characters that we couldn't do earlier because
9.70 +% they might have appeared in the input file name.
9.71 +\everyjob{\message{[Texinfo version \texinfoversion]}%
9.72 + \catcode`+=\active \catcode`\_=\active}
9.73 +
9.74 +\message{Basics,}
9.75 +\chardef\other=12
9.76 +
9.77 +% We never want plain's \outer definition of \+ in Texinfo.
9.78 +% For @tex, we can use \tabalign.
9.79 +\let\+ = \relax
9.80 +
9.81 +% Save some plain tex macros whose names we will redefine.
9.82 +\let\ptexb=\b
9.83 +\let\ptexbullet=\bullet
9.84 +\let\ptexc=\c
9.85 +\let\ptexcomma=\,
9.86 +\let\ptexdot=\.
9.87 +\let\ptexdots=\dots
9.88 +\let\ptexend=\end
9.89 +\let\ptexequiv=\equiv
9.90 +\let\ptexexclam=\!
9.91 +\let\ptexgtr=>
9.92 +\let\ptexhat=^
9.93 +\let\ptexi=\i
9.94 +\let\ptexindent=\indent
9.95 +\let\ptexlbrace=\{
9.96 +\let\ptexless=<
9.97 +\let\ptexplus=+
9.98 +\let\ptexrbrace=\}
9.99 +\let\ptexslash=\/
9.100 +\let\ptexstar=\*
9.101 +\let\ptext=\t
9.102 +
9.103 +% If this character appears in an error message or help string, it
9.104 +% starts a new line in the output.
9.105 +\newlinechar = `^^J
9.106 +
9.107 +% Set up fixed words for English if not already set.
9.108 +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
9.109 +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
9.110 +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
9.111 +\ifx\putwordin\undefined \gdef\putwordin{in}\fi
9.112 +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
9.113 +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
9.114 +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
9.115 +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
9.116 +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
9.117 +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
9.118 +\ifx\putwordof\undefined \gdef\putwordof{of}\fi
9.119 +\ifx\putwordon\undefined \gdef\putwordon{on}\fi
9.120 +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
9.121 +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
9.122 +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
9.123 +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
9.124 +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
9.125 +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
9.126 +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
9.127 +%
9.128 +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
9.129 +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
9.130 +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
9.131 +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
9.132 +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
9.133 +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
9.134 +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
9.135 +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
9.136 +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
9.137 +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
9.138 +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
9.139 +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
9.140 +%
9.141 +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
9.142 +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
9.143 +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
9.144 +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
9.145 +\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
9.146 +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
9.147 +\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
9.148 +
9.149 +% In some macros, we cannot use the `\? notation---the left quote is
9.150 +% in some cases the escape char.
9.151 +\chardef\colonChar = `\:
9.152 +\chardef\commaChar = `\,
9.153 +\chardef\dotChar = `\.
9.154 +\chardef\equalChar = `\=
9.155 +\chardef\exclamChar= `\!
9.156 +\chardef\questChar = `\?
9.157 +\chardef\semiChar = `\;
9.158 +\chardef\spaceChar = `\ %
9.159 +\chardef\underChar = `\_
9.160 +
9.161 +% Ignore a token.
9.162 +%
9.163 +\def\gobble#1{}
9.164 +
9.165 +% True if #1 is the empty string, i.e., called like `\ifempty{}'.
9.166 +%
9.167 +\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
9.168 +\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
9.169 +
9.170 +% Hyphenation fixes.
9.171 +\hyphenation{ap-pen-dix}
9.172 +\hyphenation{eshell}
9.173 +\hyphenation{mini-buf-fer mini-buf-fers}
9.174 +\hyphenation{time-stamp}
9.175 +\hyphenation{white-space}
9.176 +
9.177 +% Margin to add to right of even pages, to left of odd pages.
9.178 +\newdimen\bindingoffset
9.179 +\newdimen\normaloffset
9.180 +\newdimen\pagewidth \newdimen\pageheight
9.181 +
9.182 +% Sometimes it is convenient to have everything in the transcript file
9.183 +% and nothing on the terminal. We don't just call \tracingall here,
9.184 +% since that produces some useless output on the terminal. We also make
9.185 +% some effort to order the tracing commands to reduce output in the log
9.186 +% file; cf. trace.sty in LaTeX.
9.187 +%
9.188 +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
9.189 +\def\loggingall{%
9.190 + \tracingstats2
9.191 + \tracingpages1
9.192 + \tracinglostchars2 % 2 gives us more in etex
9.193 + \tracingparagraphs1
9.194 + \tracingoutput1
9.195 + \tracingmacros2
9.196 + \tracingrestores1
9.197 + \showboxbreadth\maxdimen \showboxdepth\maxdimen
9.198 + \ifx\eTeXversion\undefined\else % etex gives us more logging
9.199 + \tracingscantokens1
9.200 + \tracingifs1
9.201 + \tracinggroups1
9.202 + \tracingnesting2
9.203 + \tracingassigns1
9.204 + \fi
9.205 + \tracingcommands3 % 3 gives us more in etex
9.206 + \errorcontextlines\maxdimen
9.207 +}%
9.208 +
9.209 +% add check for \lastpenalty to plain's definitions. If the last thing
9.210 +% we did was a \nobreak, we don't want to insert more space.
9.211 +%
9.212 +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
9.213 + \removelastskip\penalty-50\smallskip\fi\fi}
9.214 +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
9.215 + \removelastskip\penalty-100\medskip\fi\fi}
9.216 +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
9.217 + \removelastskip\penalty-200\bigskip\fi\fi}
9.218 +
9.219 +% For @cropmarks command.
9.220 +% Do @cropmarks to get crop marks.
9.221 +%
9.222 +\newif\ifcropmarks
9.223 +\let\cropmarks = \cropmarkstrue
9.224 +%
9.225 +% Dimensions to add cropmarks at corners.
9.226 +% Added by P. A. MacKay, 12 Nov. 1986
9.227 +%
9.228 +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
9.229 +\newdimen\cornerlong \cornerlong=1pc
9.230 +\newdimen\cornerthick \cornerthick=.3pt
9.231 +\newdimen\topandbottommargin \topandbottommargin=.75in
9.232 +
9.233 +% Main output routine.
9.234 +\chardef\PAGE = 255
9.235 +\output = {\onepageout{\pagecontents\PAGE}}
9.236 +
9.237 +\newbox\headlinebox
9.238 +\newbox\footlinebox
9.239 +
9.240 +% \onepageout takes a vbox as an argument. Note that \pagecontents
9.241 +% does insertions, but you have to call it yourself.
9.242 +\def\onepageout#1{%
9.243 + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
9.244 + %
9.245 + \ifodd\pageno \advance\hoffset by \bindingoffset
9.246 + \else \advance\hoffset by -\bindingoffset\fi
9.247 + %
9.248 + % Do this outside of the \shipout so @code etc. will be expanded in
9.249 + % the headline as they should be, not taken literally (outputting ''code).
9.250 + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
9.251 + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
9.252 + %
9.253 + {%
9.254 + % Have to do this stuff outside the \shipout because we want it to
9.255 + % take effect in \write's, yet the group defined by the \vbox ends
9.256 + % before the \shipout runs.
9.257 + %
9.258 + \escapechar = `\\ % use backslash in output files.
9.259 + \indexdummies % don't expand commands in the output.
9.260 + \normalturnoffactive % \ in index entries must not stay \, e.g., if
9.261 + % the page break happens to be in the middle of an example.
9.262 + \shipout\vbox{%
9.263 + % Do this early so pdf references go to the beginning of the page.
9.264 + \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
9.265 + %
9.266 + \ifcropmarks \vbox to \outervsize\bgroup
9.267 + \hsize = \outerhsize
9.268 + \vskip-\topandbottommargin
9.269 + \vtop to0pt{%
9.270 + \line{\ewtop\hfil\ewtop}%
9.271 + \nointerlineskip
9.272 + \line{%
9.273 + \vbox{\moveleft\cornerthick\nstop}%
9.274 + \hfill
9.275 + \vbox{\moveright\cornerthick\nstop}%
9.276 + }%
9.277 + \vss}%
9.278 + \vskip\topandbottommargin
9.279 + \line\bgroup
9.280 + \hfil % center the page within the outer (page) hsize.
9.281 + \ifodd\pageno\hskip\bindingoffset\fi
9.282 + \vbox\bgroup
9.283 + \fi
9.284 + %
9.285 + \unvbox\headlinebox
9.286 + \pagebody{#1}%
9.287 + \ifdim\ht\footlinebox > 0pt
9.288 + % Only leave this space if the footline is nonempty.
9.289 + % (We lessened \vsize for it in \oddfootingxxx.)
9.290 + % The \baselineskip=24pt in plain's \makefootline has no effect.
9.291 + \vskip 2\baselineskip
9.292 + \unvbox\footlinebox
9.293 + \fi
9.294 + %
9.295 + \ifcropmarks
9.296 + \egroup % end of \vbox\bgroup
9.297 + \hfil\egroup % end of (centering) \line\bgroup
9.298 + \vskip\topandbottommargin plus1fill minus1fill
9.299 + \boxmaxdepth = \cornerthick
9.300 + \vbox to0pt{\vss
9.301 + \line{%
9.302 + \vbox{\moveleft\cornerthick\nsbot}%
9.303 + \hfill
9.304 + \vbox{\moveright\cornerthick\nsbot}%
9.305 + }%
9.306 + \nointerlineskip
9.307 + \line{\ewbot\hfil\ewbot}%
9.308 + }%
9.309 + \egroup % \vbox from first cropmarks clause
9.310 + \fi
9.311 + }% end of \shipout\vbox
9.312 + }% end of group with \normalturnoffactive
9.313 + \advancepageno
9.314 + \ifnum\outputpenalty>-20000 \else\dosupereject\fi
9.315 +}
9.316 +
9.317 +\newinsert\margin \dimen\margin=\maxdimen
9.318 +
9.319 +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
9.320 +{\catcode`\@ =11
9.321 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
9.322 +% marginal hacks, juha@viisa.uucp (Juha Takala)
9.323 +\ifvoid\margin\else % marginal info is present
9.324 + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
9.325 +\dimen@=\dp#1 \unvbox#1
9.326 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
9.327 +\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
9.328 +}
9.329 +
9.330 +% Here are the rules for the cropmarks. Note that they are
9.331 +% offset so that the space between them is truly \outerhsize or \outervsize
9.332 +% (P. A. MacKay, 12 November, 1986)
9.333 +%
9.334 +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
9.335 +\def\nstop{\vbox
9.336 + {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
9.337 +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
9.338 +\def\nsbot{\vbox
9.339 + {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
9.340 +
9.341 +% Parse an argument, then pass it to #1. The argument is the rest of
9.342 +% the input line (except we remove a trailing comment). #1 should be a
9.343 +% macro which expects an ordinary undelimited TeX argument.
9.344 +%
9.345 +\def\parsearg#1{%
9.346 + \let\next = #1%
9.347 + \begingroup
9.348 + \obeylines
9.349 + \futurelet\temp\parseargx
9.350 +}
9.351 +
9.352 +% If the next token is an obeyed space (from an @example environment or
9.353 +% the like), remove it and recurse. Otherwise, we're done.
9.354 +\def\parseargx{%
9.355 + % \obeyedspace is defined far below, after the definition of \sepspaces.
9.356 + \ifx\obeyedspace\temp
9.357 + \expandafter\parseargdiscardspace
9.358 + \else
9.359 + \expandafter\parseargline
9.360 + \fi
9.361 +}
9.362 +
9.363 +% Remove a single space (as the delimiter token to the macro call).
9.364 +{\obeyspaces %
9.365 + \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
9.366 +
9.367 +{\obeylines %
9.368 + \gdef\parseargline#1^^M{%
9.369 + \endgroup % End of the group started in \parsearg.
9.370 + %
9.371 + % First remove any @c comment, then any @comment.
9.372 + % Result of each macro is put in \toks0.
9.373 + \argremovec #1\c\relax %
9.374 + \expandafter\argremovecomment \the\toks0 \comment\relax %
9.375 + %
9.376 + % Call the caller's macro, saved as \next in \parsearg.
9.377 + \expandafter\next\expandafter{\the\toks0}%
9.378 + }%
9.379 +}
9.380 +
9.381 +% Since all \c{,omment} does is throw away the argument, we can let TeX
9.382 +% do that for us. The \relax here is matched by the \relax in the call
9.383 +% in \parseargline; it could be more or less anything, its purpose is
9.384 +% just to delimit the argument to the \c.
9.385 +\def\argremovec#1\c#2\relax{\toks0 = {#1}}
9.386 +\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
9.387 +
9.388 +% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
9.389 +% @end itemize @c foo
9.390 +% will have two active spaces as part of the argument with the
9.391 +% `itemize'. Here we remove all active spaces from #1, and assign the
9.392 +% result to \toks0.
9.393 +%
9.394 +% This loses if there are any *other* active characters besides spaces
9.395 +% in the argument -- _ ^ +, for example -- since they get expanded.
9.396 +% Fortunately, Texinfo does not define any such commands. (If it ever
9.397 +% does, the catcode of the characters in questionwill have to be changed
9.398 +% here.) But this means we cannot call \removeactivespaces as part of
9.399 +% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
9.400 +% that \parsearg gets might well have any character at all in it.
9.401 +%
9.402 +\def\removeactivespaces#1{%
9.403 + \begingroup
9.404 + \ignoreactivespaces
9.405 + \edef\temp{#1}%
9.406 + \global\toks0 = \expandafter{\temp}%
9.407 + \endgroup
9.408 +}
9.409 +
9.410 +% Change the active space to expand to nothing.
9.411 +%
9.412 +\begingroup
9.413 + \obeyspaces
9.414 + \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
9.415 +\endgroup
9.416 +
9.417 +
9.418 +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
9.419 +
9.420 +%% These are used to keep @begin/@end levels from running away
9.421 +%% Call \inENV within environments (after a \begingroup)
9.422 +\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
9.423 +\def\ENVcheck{%
9.424 +\ifENV\errmessage{Still within an environment; press RETURN to continue}
9.425 +\endgroup\fi} % This is not perfect, but it should reduce lossage
9.426 +
9.427 +% @begin foo is the same as @foo, for now.
9.428 +\newhelp\EMsimple{Press RETURN to continue.}
9.429 +
9.430 +\outer\def\begin{\parsearg\beginxxx}
9.431 +
9.432 +\def\beginxxx #1{%
9.433 +\expandafter\ifx\csname #1\endcsname\relax
9.434 +{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
9.435 +\csname #1\endcsname\fi}
9.436 +
9.437 +% @end foo executes the definition of \Efoo.
9.438 +%
9.439 +\def\end{\parsearg\endxxx}
9.440 +\def\endxxx #1{%
9.441 + \removeactivespaces{#1}%
9.442 + \edef\endthing{\the\toks0}%
9.443 + %
9.444 + \expandafter\ifx\csname E\endthing\endcsname\relax
9.445 + \expandafter\ifx\csname \endthing\endcsname\relax
9.446 + % There's no \foo, i.e., no ``environment'' foo.
9.447 + \errhelp = \EMsimple
9.448 + \errmessage{Undefined command `@end \endthing'}%
9.449 + \else
9.450 + \unmatchedenderror\endthing
9.451 + \fi
9.452 + \else
9.453 + % Everything's ok; the right environment has been started.
9.454 + \csname E\endthing\endcsname
9.455 + \fi
9.456 +}
9.457 +
9.458 +% There is an environment #1, but it hasn't been started. Give an error.
9.459 +%
9.460 +\def\unmatchedenderror#1{%
9.461 + \errhelp = \EMsimple
9.462 + \errmessage{This `@end #1' doesn't have a matching `@#1'}%
9.463 +}
9.464 +
9.465 +% Define the control sequence \E#1 to give an unmatched @end error.
9.466 +%
9.467 +\def\defineunmatchedend#1{%
9.468 + \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
9.469 +}
9.470 +
9.471 +
9.472 +%% Simple single-character @ commands
9.473 +
9.474 +% @@ prints an @
9.475 +% Kludge this until the fonts are right (grr).
9.476 +\def\@{{\tt\char64}}
9.477 +
9.478 +% This is turned off because it was never documented
9.479 +% and you can use @w{...} around a quote to suppress ligatures.
9.480 +%% Define @` and @' to be the same as ` and '
9.481 +%% but suppressing ligatures.
9.482 +%\def\`{{`}}
9.483 +%\def\'{{'}}
9.484 +
9.485 +% Used to generate quoted braces.
9.486 +\def\mylbrace {{\tt\char123}}
9.487 +\def\myrbrace {{\tt\char125}}
9.488 +\let\{=\mylbrace
9.489 +\let\}=\myrbrace
9.490 +\begingroup
9.491 + % Definitions to produce \{ and \} commands for indices,
9.492 + % and @{ and @} for the aux file.
9.493 + \catcode`\{ = \other \catcode`\} = \other
9.494 + \catcode`\[ = 1 \catcode`\] = 2
9.495 + \catcode`\! = 0 \catcode`\\ = \other
9.496 + !gdef!lbracecmd[\{]%
9.497 + !gdef!rbracecmd[\}]%
9.498 + !gdef!lbraceatcmd[@{]%
9.499 + !gdef!rbraceatcmd[@}]%
9.500 +!endgroup
9.501 +
9.502 +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
9.503 +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
9.504 +\let\, = \c
9.505 +\let\dotaccent = \.
9.506 +\def\ringaccent#1{{\accent23 #1}}
9.507 +\let\tieaccent = \t
9.508 +\let\ubaraccent = \b
9.509 +\let\udotaccent = \d
9.510 +
9.511 +% Other special characters: @questiondown @exclamdown
9.512 +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
9.513 +\def\questiondown{?`}
9.514 +\def\exclamdown{!`}
9.515 +
9.516 +% Dotless i and dotless j, used for accents.
9.517 +\def\imacro{i}
9.518 +\def\jmacro{j}
9.519 +\def\dotless#1{%
9.520 + \def\temp{#1}%
9.521 + \ifx\temp\imacro \ptexi
9.522 + \else\ifx\temp\jmacro \j
9.523 + \else \errmessage{@dotless can be used only with i or j}%
9.524 + \fi\fi
9.525 +}
9.526 +
9.527 +% Be sure we're in horizontal mode when doing a tie, since we make space
9.528 +% equivalent to this in @example-like environments. Otherwise, a space
9.529 +% at the beginning of a line will start with \penalty -- and
9.530 +% since \penalty is valid in vertical mode, we'd end up putting the
9.531 +% penalty on the vertical list instead of in the new paragraph.
9.532 +{\catcode`@ = 11
9.533 + % Avoid using \@M directly, because that causes trouble
9.534 + % if the definition is written into an index file.
9.535 + \global\let\tiepenalty = \@M
9.536 + \gdef\tie{\leavevmode\penalty\tiepenalty\ }
9.537 +}
9.538 +
9.539 +% @: forces normal size whitespace following.
9.540 +\def\:{\spacefactor=1000 }
9.541 +
9.542 +% @* forces a line break.
9.543 +\def\*{\hfil\break\hbox{}\ignorespaces}
9.544 +
9.545 +% @/ allows a line break.
9.546 +\let\/=\allowbreak
9.547 +
9.548 +% @. is an end-of-sentence period.
9.549 +\def\.{.\spacefactor=3000 }
9.550 +
9.551 +% @! is an end-of-sentence bang.
9.552 +\def\!{!\spacefactor=3000 }
9.553 +
9.554 +% @? is an end-of-sentence query.
9.555 +\def\?{?\spacefactor=3000 }
9.556 +
9.557 +% @w prevents a word break. Without the \leavevmode, @w at the
9.558 +% beginning of a paragraph, when TeX is still in vertical mode, would
9.559 +% produce a whole line of output instead of starting the paragraph.
9.560 +\def\w#1{\leavevmode\hbox{#1}}
9.561 +
9.562 +% @group ... @end group forces ... to be all on one page, by enclosing
9.563 +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
9.564 +% to keep its height that of a normal line. According to the rules for
9.565 +% \topskip (p.114 of the TeXbook), the glue inserted is
9.566 +% max (\topskip - \ht (first item), 0). If that height is large,
9.567 +% therefore, no glue is inserted, and the space between the headline and
9.568 +% the text is small, which looks bad.
9.569 +%
9.570 +% Another complication is that the group might be very large. This can
9.571 +% cause the glue on the previous page to be unduly stretched, because it
9.572 +% does not have much material. In this case, it's better to add an
9.573 +% explicit \vfill so that the extra space is at the bottom. The
9.574 +% threshold for doing this is if the group is more than \vfilllimit
9.575 +% percent of a page (\vfilllimit can be changed inside of @tex).
9.576 +%
9.577 +\newbox\groupbox
9.578 +\def\vfilllimit{0.7}
9.579 +%
9.580 +\def\group{\begingroup
9.581 + \ifnum\catcode13=\active \else
9.582 + \errhelp = \groupinvalidhelp
9.583 + \errmessage{@group invalid in context where filling is enabled}%
9.584 + \fi
9.585 + %
9.586 + % The \vtop we start below produces a box with normal height and large
9.587 + % depth; thus, TeX puts \baselineskip glue before it, and (when the
9.588 + % next line of text is done) \lineskip glue after it. (See p.82 of
9.589 + % the TeXbook.) Thus, space below is not quite equal to space
9.590 + % above. But it's pretty close.
9.591 + \def\Egroup{%
9.592 + \egroup % End the \vtop.
9.593 + % \dimen0 is the vertical size of the group's box.
9.594 + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
9.595 + % \dimen2 is how much space is left on the page (more or less).
9.596 + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
9.597 + % if the group doesn't fit on the current page, and it's a big big
9.598 + % group, force a page break.
9.599 + \ifdim \dimen0 > \dimen2
9.600 + \ifdim \pagetotal < \vfilllimit\pageheight
9.601 + \page
9.602 + \fi
9.603 + \fi
9.604 + \copy\groupbox
9.605 + \endgroup % End the \group.
9.606 + }%
9.607 + %
9.608 + \setbox\groupbox = \vtop\bgroup
9.609 + % We have to put a strut on the last line in case the @group is in
9.610 + % the midst of an example, rather than completely enclosing it.
9.611 + % Otherwise, the interline space between the last line of the group
9.612 + % and the first line afterwards is too small. But we can't put the
9.613 + % strut in \Egroup, since there it would be on a line by itself.
9.614 + % Hence this just inserts a strut at the beginning of each line.
9.615 + \everypar = {\strut}%
9.616 + %
9.617 + % Since we have a strut on every line, we don't need any of TeX's
9.618 + % normal interline spacing.
9.619 + \offinterlineskip
9.620 + %
9.621 + % OK, but now we have to do something about blank
9.622 + % lines in the input in @example-like environments, which normally
9.623 + % just turn into \lisppar, which will insert no space now that we've
9.624 + % turned off the interline space. Simplest is to make them be an
9.625 + % empty paragraph.
9.626 + \ifx\par\lisppar
9.627 + \edef\par{\leavevmode \par}%
9.628 + %
9.629 + % Reset ^^M's definition to new definition of \par.
9.630 + \obeylines
9.631 + \fi
9.632 + %
9.633 + % Do @comment since we are called inside an environment such as
9.634 + % @example, where each end-of-line in the input causes an
9.635 + % end-of-line in the output. We don't want the end-of-line after
9.636 + % the `@group' to put extra space in the output. Since @group
9.637 + % should appear on a line by itself (according to the Texinfo
9.638 + % manual), we don't worry about eating any user text.
9.639 + \comment
9.640 +}
9.641 +%
9.642 +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
9.643 +% message, so this ends up printing `@group can only ...'.
9.644 +%
9.645 +\newhelp\groupinvalidhelp{%
9.646 +group can only be used in environments such as @example,^^J%
9.647 +where each line of input produces a line of output.}
9.648 +
9.649 +% @need space-in-mils
9.650 +% forces a page break if there is not space-in-mils remaining.
9.651 +
9.652 +\newdimen\mil \mil=0.001in
9.653 +
9.654 +\def\need{\parsearg\needx}
9.655 +
9.656 +% Old definition--didn't work.
9.657 +%\def\needx #1{\par %
9.658 +%% This method tries to make TeX break the page naturally
9.659 +%% if the depth of the box does not fit.
9.660 +%{\baselineskip=0pt%
9.661 +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
9.662 +%\prevdepth=-1000pt
9.663 +%}}
9.664 +
9.665 +\def\needx#1{%
9.666 + % Ensure vertical mode, so we don't make a big box in the middle of a
9.667 + % paragraph.
9.668 + \par
9.669 + %
9.670 + % If the @need value is less than one line space, it's useless.
9.671 + \dimen0 = #1\mil
9.672 + \dimen2 = \ht\strutbox
9.673 + \advance\dimen2 by \dp\strutbox
9.674 + \ifdim\dimen0 > \dimen2
9.675 + %
9.676 + % Do a \strut just to make the height of this box be normal, so the
9.677 + % normal leading is inserted relative to the preceding line.
9.678 + % And a page break here is fine.
9.679 + \vtop to #1\mil{\strut\vfil}%
9.680 + %
9.681 + % TeX does not even consider page breaks if a penalty added to the
9.682 + % main vertical list is 10000 or more. But in order to see if the
9.683 + % empty box we just added fits on the page, we must make it consider
9.684 + % page breaks. On the other hand, we don't want to actually break the
9.685 + % page after the empty box. So we use a penalty of 9999.
9.686 + %
9.687 + % There is an extremely small chance that TeX will actually break the
9.688 + % page at this \penalty, if there are no other feasible breakpoints in
9.689 + % sight. (If the user is using lots of big @group commands, which
9.690 + % almost-but-not-quite fill up a page, TeX will have a hard time doing
9.691 + % good page breaking, for example.) However, I could not construct an
9.692 + % example where a page broke at this \penalty; if it happens in a real
9.693 + % document, then we can reconsider our strategy.
9.694 + \penalty9999
9.695 + %
9.696 + % Back up by the size of the box, whether we did a page break or not.
9.697 + \kern -#1\mil
9.698 + %
9.699 + % Do not allow a page break right after this kern.
9.700 + \nobreak
9.701 + \fi
9.702 +}
9.703 +
9.704 +% @br forces paragraph break
9.705 +
9.706 +\let\br = \par
9.707 +
9.708 +% @dots{} output an ellipsis using the current font.
9.709 +% We do .5em per period so that it has the same spacing in a typewriter
9.710 +% font as three actual period characters.
9.711 +%
9.712 +\def\dots{%
9.713 + \leavevmode
9.714 + \hbox to 1.5em{%
9.715 + \hskip 0pt plus 0.25fil minus 0.25fil
9.716 + .\hss.\hss.%
9.717 + \hskip 0pt plus 0.5fil minus 0.5fil
9.718 + }%
9.719 +}
9.720 +
9.721 +% @enddots{} is an end-of-sentence ellipsis.
9.722 +%
9.723 +\def\enddots{%
9.724 + \leavevmode
9.725 + \hbox to 2em{%
9.726 + \hskip 0pt plus 0.25fil minus 0.25fil
9.727 + .\hss.\hss.\hss.%
9.728 + \hskip 0pt plus 0.5fil minus 0.5fil
9.729 + }%
9.730 + \spacefactor=3000
9.731 +}
9.732 +
9.733 +% @page forces the start of a new page.
9.734 +%
9.735 +\def\page{\par\vfill\supereject}
9.736 +
9.737 +% @exdent text....
9.738 +% outputs text on separate line in roman font, starting at standard page margin
9.739 +
9.740 +% This records the amount of indent in the innermost environment.
9.741 +% That's how much \exdent should take out.
9.742 +\newskip\exdentamount
9.743 +
9.744 +% This defn is used inside fill environments such as @defun.
9.745 +\def\exdent{\parsearg\exdentyyy}
9.746 +\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
9.747 +
9.748 +% This defn is used inside nofill environments such as @example.
9.749 +\def\nofillexdent{\parsearg\nofillexdentyyy}
9.750 +\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
9.751 +\leftline{\hskip\leftskip{\rm#1}}}}
9.752 +
9.753 +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
9.754 +% paragraph. For more general purposes, use the \margin insertion
9.755 +% class. WHICH is `l' or `r'.
9.756 +%
9.757 +\newskip\inmarginspacing \inmarginspacing=1cm
9.758 +\def\strutdepth{\dp\strutbox}
9.759 +%
9.760 +\def\doinmargin#1#2{\strut\vadjust{%
9.761 + \nobreak
9.762 + \kern-\strutdepth
9.763 + \vtop to \strutdepth{%
9.764 + \baselineskip=\strutdepth
9.765 + \vss
9.766 + % if you have multiple lines of stuff to put here, you'll need to
9.767 + % make the vbox yourself of the appropriate size.
9.768 + \ifx#1l%
9.769 + \llap{\ignorespaces #2\hskip\inmarginspacing}%
9.770 + \else
9.771 + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
9.772 + \fi
9.773 + \null
9.774 + }%
9.775 +}}
9.776 +\def\inleftmargin{\doinmargin l}
9.777 +\def\inrightmargin{\doinmargin r}
9.778 +%
9.779 +% @inmargin{TEXT [, RIGHT-TEXT]}
9.780 +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
9.781 +% else use TEXT for both).
9.782 +%
9.783 +\def\inmargin#1{\parseinmargin #1,,\finish}
9.784 +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
9.785 + \setbox0 = \hbox{\ignorespaces #2}%
9.786 + \ifdim\wd0 > 0pt
9.787 + \def\lefttext{#1}% have both texts
9.788 + \def\righttext{#2}%
9.789 + \else
9.790 + \def\lefttext{#1}% have only one text
9.791 + \def\righttext{#1}%
9.792 + \fi
9.793 + %
9.794 + \ifodd\pageno
9.795 + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
9.796 + \else
9.797 + \def\temp{\inleftmargin\lefttext}%
9.798 + \fi
9.799 + \temp
9.800 +}
9.801 +
9.802 +% @include file insert text of that file as input.
9.803 +% Allow normal characters that we make active in the argument (a file name).
9.804 +\def\include{\begingroup
9.805 + \catcode`\\=\other
9.806 + \catcode`~=\other
9.807 + \catcode`^=\other
9.808 + \catcode`_=\other
9.809 + \catcode`|=\other
9.810 + \catcode`<=\other
9.811 + \catcode`>=\other
9.812 + \catcode`+=\other
9.813 + \parsearg\includezzz}
9.814 +% Restore active chars for included file.
9.815 +\def\includezzz#1{\endgroup\begingroup
9.816 + % Read the included file in a group so nested @include's work.
9.817 + \def\thisfile{#1}%
9.818 + \let\value=\expandablevalue
9.819 + \input\thisfile
9.820 +\endgroup}
9.821 +
9.822 +\def\thisfile{}
9.823 +
9.824 +% @center line
9.825 +% outputs that line, centered.
9.826 +%
9.827 +\def\center{\parsearg\docenter}
9.828 +\def\docenter#1{{%
9.829 + \ifhmode \hfil\break \fi
9.830 + \advance\hsize by -\leftskip
9.831 + \advance\hsize by -\rightskip
9.832 + \line{\hfil \ignorespaces#1\unskip \hfil}%
9.833 + \ifhmode \break \fi
9.834 +}}
9.835 +
9.836 +% @sp n outputs n lines of vertical space
9.837 +
9.838 +\def\sp{\parsearg\spxxx}
9.839 +\def\spxxx #1{\vskip #1\baselineskip}
9.840 +
9.841 +% @comment ...line which is ignored...
9.842 +% @c is the same as @comment
9.843 +% @ignore ... @end ignore is another way to write a comment
9.844 +
9.845 +\def\comment{\begingroup \catcode`\^^M=\other%
9.846 +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
9.847 +\commentxxx}
9.848 +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
9.849 +
9.850 +\let\c=\comment
9.851 +
9.852 +% @paragraphindent NCHARS
9.853 +% We'll use ems for NCHARS, close enough.
9.854 +% NCHARS can also be the word `asis' or `none'.
9.855 +% We cannot feasibly implement @paragraphindent asis, though.
9.856 +%
9.857 +\def\asisword{asis} % no translation, these are keywords
9.858 +\def\noneword{none}
9.859 +%
9.860 +\def\paragraphindent{\parsearg\doparagraphindent}
9.861 +\def\doparagraphindent#1{%
9.862 + \def\temp{#1}%
9.863 + \ifx\temp\asisword
9.864 + \else
9.865 + \ifx\temp\noneword
9.866 + \defaultparindent = 0pt
9.867 + \else
9.868 + \defaultparindent = #1em
9.869 + \fi
9.870 + \fi
9.871 + \parindent = \defaultparindent
9.872 +}
9.873 +
9.874 +% @exampleindent NCHARS
9.875 +% We'll use ems for NCHARS like @paragraphindent.
9.876 +% It seems @exampleindent asis isn't necessary, but
9.877 +% I preserve it to make it similar to @paragraphindent.
9.878 +\def\exampleindent{\parsearg\doexampleindent}
9.879 +\def\doexampleindent#1{%
9.880 + \def\temp{#1}%
9.881 + \ifx\temp\asisword
9.882 + \else
9.883 + \ifx\temp\noneword
9.884 + \lispnarrowing = 0pt
9.885 + \else
9.886 + \lispnarrowing = #1em
9.887 + \fi
9.888 + \fi
9.889 +}
9.890 +
9.891 +% @firstparagraphindent WORD
9.892 +% If WORD is `none', then suppress indentation of the first paragraph
9.893 +% after a section heading. If WORD is `insert', then do indent at such
9.894 +% paragraphs.
9.895 +%
9.896 +% The paragraph indentation is suppressed or not by calling
9.897 +% \suppressfirstparagraphindent, which the sectioning commands do.
9.898 +% We switch the definition of this back and forth according to WORD.
9.899 +% By default, we suppress indentation.
9.900 +%
9.901 +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
9.902 +\newdimen\currentparindent
9.903 +%
9.904 +\def\insertword{insert}
9.905 +%
9.906 +\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
9.907 +\def\dofirstparagraphindent#1{%
9.908 + \def\temp{#1}%
9.909 + \ifx\temp\noneword
9.910 + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
9.911 + \else\ifx\temp\insertword
9.912 + \let\suppressfirstparagraphindent = \relax
9.913 + \else
9.914 + \errhelp = \EMsimple
9.915 + \errmessage{Unknown @firstparagraphindent option `\temp'}%
9.916 + \fi\fi
9.917 +}
9.918 +
9.919 +% Here is how we actually suppress indentation. Redefine \everypar to
9.920 +% \kern backwards by \parindent, and then reset itself to empty.
9.921 +%
9.922 +% We also make \indent itself not actually do anything until the next
9.923 +% paragraph.
9.924 +%
9.925 +\gdef\dosuppressfirstparagraphindent{%
9.926 + \gdef\indent{%
9.927 + \global\let\indent=\ptexindent
9.928 + \global\everypar = {}%
9.929 + }%
9.930 + \global\everypar = {%
9.931 + \kern-\parindent
9.932 + \global\let\indent=\ptexindent
9.933 + \global\everypar = {}%
9.934 + }%
9.935 +}%
9.936 +
9.937 +
9.938 +% @asis just yields its argument. Used with @table, for example.
9.939 +%
9.940 +\def\asis#1{#1}
9.941 +
9.942 +% @math outputs its argument in math mode.
9.943 +% We don't use $'s directly in the definition of \math because we need
9.944 +% to set catcodes according to plain TeX first, to allow for subscripts,
9.945 +% superscripts, special math chars, etc.
9.946 +%
9.947 +\let\implicitmath = $%$ font-lock fix
9.948 +%
9.949 +% One complication: _ usually means subscripts, but it could also mean
9.950 +% an actual _ character, as in @math{@var{some_variable} + 1}. So make
9.951 +% _ within @math be active (mathcode "8000), and distinguish by seeing
9.952 +% if the current family is \slfam, which is what @var uses.
9.953 +%
9.954 +{\catcode\underChar = \active
9.955 +\gdef\mathunderscore{%
9.956 + \catcode\underChar=\active
9.957 + \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
9.958 +}}
9.959 +%
9.960 +% Another complication: we want \\ (and @\) to output a \ character.
9.961 +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
9.962 +% this is not advertised and we don't care. Texinfo does not
9.963 +% otherwise define @\.
9.964 +%
9.965 +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
9.966 +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
9.967 +%
9.968 +\def\math{%
9.969 + \tex
9.970 + \mathcode`\_="8000 \mathunderscore
9.971 + \let\\ = \mathbackslash
9.972 + \mathactive
9.973 + \implicitmath\finishmath}
9.974 +\def\finishmath#1{#1\implicitmath\Etex}
9.975 +
9.976 +% Some active characters (such as <) are spaced differently in math.
9.977 +% We have to reset their definitions in case the @math was an
9.978 +% argument to a command which set the catcodes (such as @item or @section).
9.979 +%
9.980 +{
9.981 + \catcode`^ = \active
9.982 + \catcode`< = \active
9.983 + \catcode`> = \active
9.984 + \catcode`+ = \active
9.985 + \gdef\mathactive{%
9.986 + \let^ = \ptexhat
9.987 + \let< = \ptexless
9.988 + \let> = \ptexgtr
9.989 + \let+ = \ptexplus
9.990 + }
9.991 +}
9.992 +
9.993 +% @bullet and @minus need the same treatment as @math, just above.
9.994 +\def\bullet{\implicitmath\ptexbullet\implicitmath}
9.995 +\def\minus{\implicitmath-\implicitmath}
9.996 +
9.997 +% @refill is a no-op.
9.998 +\let\refill=\relax
9.999 +
9.1000 +% If working on a large document in chapters, it is convenient to
9.1001 +% be able to disable indexing, cross-referencing, and contents, for test runs.
9.1002 +% This is done with @novalidate (before @setfilename).
9.1003 +%
9.1004 +\newif\iflinks \linkstrue % by default we want the aux files.
9.1005 +\let\novalidate = \linksfalse
9.1006 +
9.1007 +% @setfilename is done at the beginning of every texinfo file.
9.1008 +% So open here the files we need to have open while reading the input.
9.1009 +% This makes it possible to make a .fmt file for texinfo.
9.1010 +\def\setfilename{%
9.1011 + \iflinks
9.1012 + \readauxfile
9.1013 + \fi % \openindices needs to do some work in any case.
9.1014 + \openindices
9.1015 + \fixbackslash % Turn off hack to swallow `\input texinfo'.
9.1016 + \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
9.1017 + %
9.1018 + % If texinfo.cnf is present on the system, read it.
9.1019 + % Useful for site-wide @afourpaper, etc.
9.1020 + % Just to be on the safe side, close the input stream before the \input.
9.1021 + \openin 1 texinfo.cnf
9.1022 + \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
9.1023 + \closein1
9.1024 + \temp
9.1025 + %
9.1026 + \comment % Ignore the actual filename.
9.1027 +}
9.1028 +
9.1029 +% Called from \setfilename.
9.1030 +%
9.1031 +\def\openindices{%
9.1032 + \newindex{cp}%
9.1033 + \newcodeindex{fn}%
9.1034 + \newcodeindex{vr}%
9.1035 + \newcodeindex{tp}%
9.1036 + \newcodeindex{ky}%
9.1037 + \newcodeindex{pg}%
9.1038 +}
9.1039 +
9.1040 +% @bye.
9.1041 +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
9.1042 +
9.1043 +
9.1044 +\message{pdf,}
9.1045 +% adobe `portable' document format
9.1046 +\newcount\tempnum
9.1047 +\newcount\lnkcount
9.1048 +\newtoks\filename
9.1049 +\newcount\filenamelength
9.1050 +\newcount\pgn
9.1051 +\newtoks\toksA
9.1052 +\newtoks\toksB
9.1053 +\newtoks\toksC
9.1054 +\newtoks\toksD
9.1055 +\newbox\boxA
9.1056 +\newcount\countA
9.1057 +\newif\ifpdf
9.1058 +\newif\ifpdfmakepagedest
9.1059 +
9.1060 +\ifx\pdfoutput\undefined
9.1061 + \pdffalse
9.1062 + \let\pdfmkdest = \gobble
9.1063 + \let\pdfurl = \gobble
9.1064 + \let\endlink = \relax
9.1065 + \let\linkcolor = \relax
9.1066 + \let\pdfmakeoutlines = \relax
9.1067 +\else
9.1068 + \pdftrue
9.1069 + \pdfoutput = 1
9.1070 + \input pdfcolor
9.1071 + \def\dopdfimage#1#2#3{%
9.1072 + \def\imagewidth{#2}%
9.1073 + \def\imageheight{#3}%
9.1074 + % without \immediate, pdftex seg faults when the same image is
9.1075 + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
9.1076 + \ifnum\pdftexversion < 14
9.1077 + \immediate\pdfimage
9.1078 + \else
9.1079 + \immediate\pdfximage
9.1080 + \fi
9.1081 + \ifx\empty\imagewidth\else width \imagewidth \fi
9.1082 + \ifx\empty\imageheight\else height \imageheight \fi
9.1083 + \ifnum\pdftexversion<13
9.1084 + #1.pdf%
9.1085 + \else
9.1086 + {#1.pdf}%
9.1087 + \fi
9.1088 + \ifnum\pdftexversion < 14 \else
9.1089 + \pdfrefximage \pdflastximage
9.1090 + \fi}
9.1091 + \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
9.1092 + \def\pdfmkpgn#1{#1}
9.1093 + \let\linkcolor = \Blue % was Cyan, but that seems light?
9.1094 + \def\endlink{\Black\pdfendlink}
9.1095 + % Adding outlines to PDF; macros for calculating structure of outlines
9.1096 + % come from Petr Olsak
9.1097 + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
9.1098 + \else \csname#1\endcsname \fi}
9.1099 + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
9.1100 + \advance\tempnum by1
9.1101 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
9.1102 + \def\pdfmakeoutlines{{%
9.1103 + \openin 1 \jobname.toc
9.1104 + \ifeof 1\else\begingroup
9.1105 + \closein 1
9.1106 + % Thanh's hack / proper braces in bookmarks
9.1107 + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
9.1108 + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
9.1109 + %
9.1110 + \def\chapentry ##1##2##3{}
9.1111 + \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
9.1112 + \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
9.1113 + \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
9.1114 + \let\appendixentry = \chapentry
9.1115 + \let\unnumbchapentry = \chapentry
9.1116 + \let\unnumbsecentry = \secentry
9.1117 + \let\unnumbsubsecentry = \subsecentry
9.1118 + \let\unnumbsubsubsecentry = \subsubsecentry
9.1119 + \input \jobname.toc
9.1120 + \def\chapentry ##1##2##3{%
9.1121 + \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
9.1122 + \def\secentry ##1##2##3##4{%
9.1123 + \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
9.1124 + \def\subsecentry ##1##2##3##4##5{%
9.1125 + \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
9.1126 + \def\subsubsecentry ##1##2##3##4##5##6{%
9.1127 + \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
9.1128 + \let\appendixentry = \chapentry
9.1129 + \let\unnumbchapentry = \chapentry
9.1130 + \let\unnumbsecentry = \secentry
9.1131 + \let\unnumbsubsecentry = \subsecentry
9.1132 + \let\unnumbsubsubsecentry = \subsubsecentry
9.1133 + %
9.1134 + % Make special characters normal for writing to the pdf file.
9.1135 + %
9.1136 + \indexnofonts
9.1137 + \let\tt=\relax
9.1138 + \turnoffactive
9.1139 + \input \jobname.toc
9.1140 + \endgroup\fi
9.1141 + }}
9.1142 + \def\makelinks #1,{%
9.1143 + \def\params{#1}\def\E{END}%
9.1144 + \ifx\params\E
9.1145 + \let\nextmakelinks=\relax
9.1146 + \else
9.1147 + \let\nextmakelinks=\makelinks
9.1148 + \ifnum\lnkcount>0,\fi
9.1149 + \picknum{#1}%
9.1150 + \startlink attr{/Border [0 0 0]}
9.1151 + goto name{\pdfmkpgn{\the\pgn}}%
9.1152 + \linkcolor #1%
9.1153 + \advance\lnkcount by 1%
9.1154 + \endlink
9.1155 + \fi
9.1156 + \nextmakelinks
9.1157 + }
9.1158 + \def\picknum#1{\expandafter\pn#1}
9.1159 + \def\pn#1{%
9.1160 + \def\p{#1}%
9.1161 + \ifx\p\lbrace
9.1162 + \let\nextpn=\ppn
9.1163 + \else
9.1164 + \let\nextpn=\ppnn
9.1165 + \def\first{#1}
9.1166 + \fi
9.1167 + \nextpn
9.1168 + }
9.1169 + \def\ppn#1{\pgn=#1\gobble}
9.1170 + \def\ppnn{\pgn=\first}
9.1171 + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
9.1172 + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
9.1173 + \def\skipspaces#1{\def\PP{#1}\def\D{|}%
9.1174 + \ifx\PP\D\let\nextsp\relax
9.1175 + \else\let\nextsp\skipspaces
9.1176 + \ifx\p\space\else\addtokens{\filename}{\PP}%
9.1177 + \advance\filenamelength by 1
9.1178 + \fi
9.1179 + \fi
9.1180 + \nextsp}
9.1181 + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
9.1182 + \ifnum\pdftexversion < 14
9.1183 + \let \startlink \pdfannotlink
9.1184 + \else
9.1185 + \let \startlink \pdfstartlink
9.1186 + \fi
9.1187 + \def\pdfurl#1{%
9.1188 + \begingroup
9.1189 + \normalturnoffactive\def\@{@}%
9.1190 + \let\value=\expandablevalue
9.1191 + \leavevmode\Red
9.1192 + \startlink attr{/Border [0 0 0]}%
9.1193 + user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
9.1194 + % #1
9.1195 + \endgroup}
9.1196 + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
9.1197 + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
9.1198 + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
9.1199 + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
9.1200 + \def\maketoks{%
9.1201 + \expandafter\poptoks\the\toksA|ENDTOKS|
9.1202 + \ifx\first0\adn0
9.1203 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
9.1204 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
9.1205 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
9.1206 + \else
9.1207 + \ifnum0=\countA\else\makelink\fi
9.1208 + \ifx\first.\let\next=\done\else
9.1209 + \let\next=\maketoks
9.1210 + \addtokens{\toksB}{\the\toksD}
9.1211 + \ifx\first,\addtokens{\toksB}{\space}\fi
9.1212 + \fi
9.1213 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
9.1214 + \next}
9.1215 + \def\makelink{\addtokens{\toksB}%
9.1216 + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
9.1217 + \def\pdflink#1{%
9.1218 + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
9.1219 + \linkcolor #1\endlink}
9.1220 + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
9.1221 +\fi % \ifx\pdfoutput
9.1222 +
9.1223 +
9.1224 +\message{fonts,}
9.1225 +% Font-change commands.
9.1226 +
9.1227 +% Texinfo sort of supports the sans serif font style, which plain TeX does not.
9.1228 +% So we set up a \sf analogous to plain's \rm, etc.
9.1229 +\newfam\sffam
9.1230 +\def\sf{\fam=\sffam \tensf}
9.1231 +\let\li = \sf % Sometimes we call it \li, not \sf.
9.1232 +
9.1233 +% We don't need math for this one.
9.1234 +\def\ttsl{\tenttsl}
9.1235 +
9.1236 +% Default leading.
9.1237 +\newdimen\textleading \textleading = 13.2pt
9.1238 +
9.1239 +% Set the baselineskip to #1, and the lineskip and strut size
9.1240 +% correspondingly. There is no deep meaning behind these magic numbers
9.1241 +% used as factors; they just match (closely enough) what Knuth defined.
9.1242 +%
9.1243 +\def\lineskipfactor{.08333}
9.1244 +\def\strutheightpercent{.70833}
9.1245 +\def\strutdepthpercent {.29167}
9.1246 +%
9.1247 +\def\setleading#1{%
9.1248 + \normalbaselineskip = #1\relax
9.1249 + \normallineskip = \lineskipfactor\normalbaselineskip
9.1250 + \normalbaselines
9.1251 + \setbox\strutbox =\hbox{%
9.1252 + \vrule width0pt height\strutheightpercent\baselineskip
9.1253 + depth \strutdepthpercent \baselineskip
9.1254 + }%
9.1255 +}
9.1256 +
9.1257 +% Set the font macro #1 to the font named #2, adding on the
9.1258 +% specified font prefix (normally `cm').
9.1259 +% #3 is the font's design size, #4 is a scale factor
9.1260 +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
9.1261 +
9.1262 +% Use cm as the default font prefix.
9.1263 +% To specify the font prefix, you must define \fontprefix
9.1264 +% before you read in texinfo.tex.
9.1265 +\ifx\fontprefix\undefined
9.1266 +\def\fontprefix{cm}
9.1267 +\fi
9.1268 +% Support font families that don't use the same naming scheme as CM.
9.1269 +\def\rmshape{r}
9.1270 +\def\rmbshape{bx} %where the normal face is bold
9.1271 +\def\bfshape{b}
9.1272 +\def\bxshape{bx}
9.1273 +\def\ttshape{tt}
9.1274 +\def\ttbshape{tt}
9.1275 +\def\ttslshape{sltt}
9.1276 +\def\itshape{ti}
9.1277 +\def\itbshape{bxti}
9.1278 +\def\slshape{sl}
9.1279 +\def\slbshape{bxsl}
9.1280 +\def\sfshape{ss}
9.1281 +\def\sfbshape{ss}
9.1282 +\def\scshape{csc}
9.1283 +\def\scbshape{csc}
9.1284 +
9.1285 +\newcount\mainmagstep
9.1286 +\ifx\bigger\relax
9.1287 + % not really supported.
9.1288 + \mainmagstep=\magstep1
9.1289 + \setfont\textrm\rmshape{12}{1000}
9.1290 + \setfont\texttt\ttshape{12}{1000}
9.1291 +\else
9.1292 + \mainmagstep=\magstephalf
9.1293 + \setfont\textrm\rmshape{10}{\mainmagstep}
9.1294 + \setfont\texttt\ttshape{10}{\mainmagstep}
9.1295 +\fi
9.1296 +% Instead of cmb10, you may want to use cmbx10.
9.1297 +% cmbx10 is a prettier font on its own, but cmb10
9.1298 +% looks better when embedded in a line with cmr10
9.1299 +% (in Bob's opinion).
9.1300 +\setfont\textbf\bfshape{10}{\mainmagstep}
9.1301 +\setfont\textit\itshape{10}{\mainmagstep}
9.1302 +\setfont\textsl\slshape{10}{\mainmagstep}
9.1303 +\setfont\textsf\sfshape{10}{\mainmagstep}
9.1304 +\setfont\textsc\scshape{10}{\mainmagstep}
9.1305 +\setfont\textttsl\ttslshape{10}{\mainmagstep}
9.1306 +\font\texti=cmmi10 scaled \mainmagstep
9.1307 +\font\textsy=cmsy10 scaled \mainmagstep
9.1308 +
9.1309 +% A few fonts for @defun, etc.
9.1310 +\setfont\defbf\bxshape{10}{\magstep1} %was 1314
9.1311 +\setfont\deftt\ttshape{10}{\magstep1}
9.1312 +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
9.1313 +
9.1314 +% Fonts for indices, footnotes, small examples (9pt).
9.1315 +\setfont\smallrm\rmshape{9}{1000}
9.1316 +\setfont\smalltt\ttshape{9}{1000}
9.1317 +\setfont\smallbf\bfshape{10}{900}
9.1318 +\setfont\smallit\itshape{9}{1000}
9.1319 +\setfont\smallsl\slshape{9}{1000}
9.1320 +\setfont\smallsf\sfshape{9}{1000}
9.1321 +\setfont\smallsc\scshape{10}{900}
9.1322 +\setfont\smallttsl\ttslshape{10}{900}
9.1323 +\font\smalli=cmmi9
9.1324 +\font\smallsy=cmsy9
9.1325 +
9.1326 +% Fonts for small examples (8pt).
9.1327 +\setfont\smallerrm\rmshape{8}{1000}
9.1328 +\setfont\smallertt\ttshape{8}{1000}
9.1329 +\setfont\smallerbf\bfshape{10}{800}
9.1330 +\setfont\smallerit\itshape{8}{1000}
9.1331 +\setfont\smallersl\slshape{8}{1000}
9.1332 +\setfont\smallersf\sfshape{8}{1000}
9.1333 +\setfont\smallersc\scshape{10}{800}
9.1334 +\setfont\smallerttsl\ttslshape{10}{800}
9.1335 +\font\smalleri=cmmi8
9.1336 +\font\smallersy=cmsy8
9.1337 +
9.1338 +% Fonts for title page:
9.1339 +\setfont\titlerm\rmbshape{12}{\magstep3}
9.1340 +\setfont\titleit\itbshape{10}{\magstep4}
9.1341 +\setfont\titlesl\slbshape{10}{\magstep4}
9.1342 +\setfont\titlett\ttbshape{12}{\magstep3}
9.1343 +\setfont\titlettsl\ttslshape{10}{\magstep4}
9.1344 +\setfont\titlesf\sfbshape{17}{\magstep1}
9.1345 +\let\titlebf=\titlerm
9.1346 +\setfont\titlesc\scbshape{10}{\magstep4}
9.1347 +\font\titlei=cmmi12 scaled \magstep3
9.1348 +\font\titlesy=cmsy10 scaled \magstep4
9.1349 +\def\authorrm{\secrm}
9.1350 +\def\authortt{\sectt}
9.1351 +
9.1352 +% Chapter (and unnumbered) fonts (17.28pt).
9.1353 +\setfont\chaprm\rmbshape{12}{\magstep2}
9.1354 +\setfont\chapit\itbshape{10}{\magstep3}
9.1355 +\setfont\chapsl\slbshape{10}{\magstep3}
9.1356 +\setfont\chaptt\ttbshape{12}{\magstep2}
9.1357 +\setfont\chapttsl\ttslshape{10}{\magstep3}
9.1358 +\setfont\chapsf\sfbshape{17}{1000}
9.1359 +\let\chapbf=\chaprm
9.1360 +\setfont\chapsc\scbshape{10}{\magstep3}
9.1361 +\font\chapi=cmmi12 scaled \magstep2
9.1362 +\font\chapsy=cmsy10 scaled \magstep3
9.1363 +
9.1364 +% Section fonts (14.4pt).
9.1365 +\setfont\secrm\rmbshape{12}{\magstep1}
9.1366 +\setfont\secit\itbshape{10}{\magstep2}
9.1367 +\setfont\secsl\slbshape{10}{\magstep2}
9.1368 +\setfont\sectt\ttbshape{12}{\magstep1}
9.1369 +\setfont\secttsl\ttslshape{10}{\magstep2}
9.1370 +\setfont\secsf\sfbshape{12}{\magstep1}
9.1371 +\let\secbf\secrm
9.1372 +\setfont\secsc\scbshape{10}{\magstep2}
9.1373 +\font\seci=cmmi12 scaled \magstep1
9.1374 +\font\secsy=cmsy10 scaled \magstep2
9.1375 +
9.1376 +% Subsection fonts (13.15pt).
9.1377 +\setfont\ssecrm\rmbshape{12}{\magstephalf}
9.1378 +\setfont\ssecit\itbshape{10}{1315}
9.1379 +\setfont\ssecsl\slbshape{10}{1315}
9.1380 +\setfont\ssectt\ttbshape{12}{\magstephalf}
9.1381 +\setfont\ssecttsl\ttslshape{10}{1315}
9.1382 +\setfont\ssecsf\sfbshape{12}{\magstephalf}
9.1383 +\let\ssecbf\ssecrm
9.1384 +\setfont\ssecsc\scbshape{10}{\magstep1}
9.1385 +\font\sseci=cmmi12 scaled \magstephalf
9.1386 +\font\ssecsy=cmsy10 scaled 1315
9.1387 +% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
9.1388 +% but that is not a standard magnification.
9.1389 +
9.1390 +% In order for the font changes to affect most math symbols and letters,
9.1391 +% we have to define the \textfont of the standard families. Since
9.1392 +% texinfo doesn't allow for producing subscripts and superscripts except
9.1393 +% in the main text, we don't bother to reset \scriptfont and
9.1394 +% \scriptscriptfont (which would also require loading a lot more fonts).
9.1395 +%
9.1396 +\def\resetmathfonts{%
9.1397 + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
9.1398 + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
9.1399 + \textfont\ttfam=\tentt \textfont\sffam=\tensf
9.1400 +}
9.1401 +
9.1402 +% The font-changing commands redefine the meanings of \tenSTYLE, instead
9.1403 +% of just \STYLE. We do this so that font changes will continue to work
9.1404 +% in math mode, where it is the current \fam that is relevant in most
9.1405 +% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
9.1406 +% \tenbf}, for example. By redefining \tenbf, we obviate the need to
9.1407 +% redefine \bf itself.
9.1408 +\def\textfonts{%
9.1409 + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
9.1410 + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
9.1411 + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
9.1412 + \resetmathfonts \setleading{\textleading}}
9.1413 +\def\titlefonts{%
9.1414 + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
9.1415 + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
9.1416 + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
9.1417 + \let\tenttsl=\titlettsl
9.1418 + \resetmathfonts \setleading{25pt}}
9.1419 +\def\titlefont#1{{\titlefonts\rm #1}}
9.1420 +\def\chapfonts{%
9.1421 + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
9.1422 + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
9.1423 + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
9.1424 + \resetmathfonts \setleading{19pt}}
9.1425 +\def\secfonts{%
9.1426 + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
9.1427 + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
9.1428 + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
9.1429 + \resetmathfonts \setleading{16pt}}
9.1430 +\def\subsecfonts{%
9.1431 + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
9.1432 + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
9.1433 + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
9.1434 + \resetmathfonts \setleading{15pt}}
9.1435 +\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
9.1436 +\def\smallfonts{%
9.1437 + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
9.1438 + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
9.1439 + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
9.1440 + \let\tenttsl=\smallttsl
9.1441 + \resetmathfonts \setleading{10.5pt}}
9.1442 +\def\smallerfonts{%
9.1443 + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
9.1444 + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
9.1445 + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
9.1446 + \let\tenttsl=\smallerttsl
9.1447 + \resetmathfonts \setleading{9.5pt}}
9.1448 +
9.1449 +% Set the fonts to use with the @small... environments.
9.1450 +\let\smallexamplefonts = \smallfonts
9.1451 +
9.1452 +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
9.1453 +% can fit this many characters:
9.1454 +% 8.5x11=86 smallbook=72 a4=90 a5=69
9.1455 +% If we use \smallerfonts (8pt), then we can fit this many characters:
9.1456 +% 8.5x11=90+ smallbook=80 a4=90+ a5=77
9.1457 +% For me, subjectively, the few extra characters that fit aren't worth
9.1458 +% the additional smallness of 8pt. So I'm making the default 9pt.
9.1459 +%
9.1460 +% By the way, for comparison, here's what fits with @example (10pt):
9.1461 +% 8.5x11=71 smallbook=60 a4=75 a5=58
9.1462 +%
9.1463 +% I wish we used A4 paper on this side of the Atlantic.
9.1464 +%
9.1465 +% --karl, 24jan03.
9.1466 +
9.1467 +
9.1468 +% Set up the default fonts, so we can use them for creating boxes.
9.1469 +%
9.1470 +\textfonts
9.1471 +
9.1472 +% Define these so they can be easily changed for other fonts.
9.1473 +\def\angleleft{$\langle$}
9.1474 +\def\angleright{$\rangle$}
9.1475 +
9.1476 +% Count depth in font-changes, for error checks
9.1477 +\newcount\fontdepth \fontdepth=0
9.1478 +
9.1479 +% Fonts for short table of contents.
9.1480 +\setfont\shortcontrm\rmshape{12}{1000}
9.1481 +\setfont\shortcontbf\bxshape{12}{1000}
9.1482 +\setfont\shortcontsl\slshape{12}{1000}
9.1483 +\setfont\shortconttt\ttshape{12}{1000}
9.1484 +
9.1485 +%% Add scribe-like font environments, plus @l for inline lisp (usually sans
9.1486 +%% serif) and @ii for TeX italic
9.1487 +
9.1488 +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
9.1489 +% unless the following character is such as not to need one.
9.1490 +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
9.1491 + \ptexslash\fi\fi\fi}
9.1492 +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
9.1493 +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
9.1494 +
9.1495 +\let\i=\smartitalic
9.1496 +\let\var=\smartslanted
9.1497 +\let\dfn=\smartslanted
9.1498 +\let\emph=\smartitalic
9.1499 +\let\cite=\smartslanted
9.1500 +
9.1501 +\def\b#1{{\bf #1}}
9.1502 +\let\strong=\b
9.1503 +
9.1504 +% We can't just use \exhyphenpenalty, because that only has effect at
9.1505 +% the end of a paragraph. Restore normal hyphenation at the end of the
9.1506 +% group within which \nohyphenation is presumably called.
9.1507 +%
9.1508 +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
9.1509 +\def\restorehyphenation{\hyphenchar\font = `- }
9.1510 +
9.1511 +% Set sfcode to normal for the chars that usually have another value.
9.1512 +% Can't use plain's \frenchspacing because it uses the `\x notation, and
9.1513 +% sometimes \x has an active definition that messes things up.
9.1514 +%
9.1515 +\catcode`@=11
9.1516 + \def\frenchspacing{%
9.1517 + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
9.1518 + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
9.1519 + }
9.1520 +\catcode`@=\other
9.1521 +
9.1522 +\def\t#1{%
9.1523 + {\tt \rawbackslash \frenchspacing #1}%
9.1524 + \null
9.1525 +}
9.1526 +\let\ttfont=\t
9.1527 +\def\samp#1{`\tclose{#1}'\null}
9.1528 +\setfont\keyrm\rmshape{8}{1000}
9.1529 +\font\keysy=cmsy9
9.1530 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
9.1531 + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
9.1532 + \vbox{\hrule\kern-0.4pt
9.1533 + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
9.1534 + \kern-0.4pt\hrule}%
9.1535 + \kern-.06em\raise0.4pt\hbox{\angleright}}}}
9.1536 +% The old definition, with no lozenge:
9.1537 +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
9.1538 +\def\ctrl #1{{\tt \rawbackslash \hat}#1}
9.1539 +
9.1540 +% @file, @option are the same as @samp.
9.1541 +\let\file=\samp
9.1542 +\let\option=\samp
9.1543 +
9.1544 +% @code is a modification of @t,
9.1545 +% which makes spaces the same size as normal in the surrounding text.
9.1546 +\def\tclose#1{%
9.1547 + {%
9.1548 + % Change normal interword space to be same as for the current font.
9.1549 + \spaceskip = \fontdimen2\font
9.1550 + %
9.1551 + % Switch to typewriter.
9.1552 + \tt
9.1553 + %
9.1554 + % But `\ ' produces the large typewriter interword space.
9.1555 + \def\ {{\spaceskip = 0pt{} }}%
9.1556 + %
9.1557 + % Turn off hyphenation.
9.1558 + \nohyphenation
9.1559 + %
9.1560 + \rawbackslash
9.1561 + \frenchspacing
9.1562 + #1%
9.1563 + }%
9.1564 + \null
9.1565 +}
9.1566 +
9.1567 +% We *must* turn on hyphenation at `-' and `_' in \code.
9.1568 +% Otherwise, it is too hard to avoid overfull hboxes
9.1569 +% in the Emacs manual, the Library manual, etc.
9.1570 +
9.1571 +% Unfortunately, TeX uses one parameter (\hyphenchar) to control
9.1572 +% both hyphenation at - and hyphenation within words.
9.1573 +% We must therefore turn them both off (\tclose does that)
9.1574 +% and arrange explicitly to hyphenate at a dash.
9.1575 +% -- rms.
9.1576 +{
9.1577 + \catcode`\-=\active
9.1578 + \catcode`\_=\active
9.1579 + %
9.1580 + \global\def\code{\begingroup
9.1581 + \catcode`\-=\active \let-\codedash
9.1582 + \catcode`\_=\active \let_\codeunder
9.1583 + \codex
9.1584 + }
9.1585 + %
9.1586 + % If we end up with any active - characters when handling the index,
9.1587 + % just treat them as a normal -.
9.1588 + \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
9.1589 +}
9.1590 +
9.1591 +\def\realdash{-}
9.1592 +\def\codedash{-\discretionary{}{}{}}
9.1593 +\def\codeunder{%
9.1594 + % this is all so @math{@code{var_name}+1} can work. In math mode, _
9.1595 + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
9.1596 + % will therefore expand the active definition of _, which is us
9.1597 + % (inside @code that is), therefore an endless loop.
9.1598 + \ifusingtt{\ifmmode
9.1599 + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
9.1600 + \else\normalunderscore \fi
9.1601 + \discretionary{}{}{}}%
9.1602 + {\_}%
9.1603 +}
9.1604 +\def\codex #1{\tclose{#1}\endgroup}
9.1605 +
9.1606 +% @kbd is like @code, except that if the argument is just one @key command,
9.1607 +% then @kbd has no effect.
9.1608 +
9.1609 +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
9.1610 +% `example' (@kbd uses ttsl only inside of @example and friends),
9.1611 +% or `code' (@kbd uses normal tty font always).
9.1612 +\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
9.1613 +\def\kbdinputstylexxx#1{%
9.1614 + \def\arg{#1}%
9.1615 + \ifx\arg\worddistinct
9.1616 + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
9.1617 + \else\ifx\arg\wordexample
9.1618 + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
9.1619 + \else\ifx\arg\wordcode
9.1620 + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
9.1621 + \else
9.1622 + \errhelp = \EMsimple
9.1623 + \errmessage{Unknown @kbdinputstyle option `\arg'}%
9.1624 + \fi\fi\fi
9.1625 +}
9.1626 +\def\worddistinct{distinct}
9.1627 +\def\wordexample{example}
9.1628 +\def\wordcode{code}
9.1629 +
9.1630 +% Default is `distinct.'
9.1631 +\kbdinputstyle distinct
9.1632 +
9.1633 +\def\xkey{\key}
9.1634 +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
9.1635 +\ifx\one\xkey\ifx\threex\three \key{#2}%
9.1636 +\else{\tclose{\kbdfont\look}}\fi
9.1637 +\else{\tclose{\kbdfont\look}}\fi}
9.1638 +
9.1639 +% For @url, @env, @command quotes seem unnecessary, so use \code.
9.1640 +\let\url=\code
9.1641 +\let\env=\code
9.1642 +\let\command=\code
9.1643 +
9.1644 +% @uref (abbreviation for `urlref') takes an optional (comma-separated)
9.1645 +% second argument specifying the text to display and an optional third
9.1646 +% arg as text to display instead of (rather than in addition to) the url
9.1647 +% itself. First (mandatory) arg is the url. Perhaps eventually put in
9.1648 +% a hypertex \special here.
9.1649 +%
9.1650 +\def\uref#1{\douref #1,,,\finish}
9.1651 +\def\douref#1,#2,#3,#4\finish{\begingroup
9.1652 + \unsepspaces
9.1653 + \pdfurl{#1}%
9.1654 + \setbox0 = \hbox{\ignorespaces #3}%
9.1655 + \ifdim\wd0 > 0pt
9.1656 + \unhbox0 % third arg given, show only that
9.1657 + \else
9.1658 + \setbox0 = \hbox{\ignorespaces #2}%
9.1659 + \ifdim\wd0 > 0pt
9.1660 + \ifpdf
9.1661 + \unhbox0 % PDF: 2nd arg given, show only it
9.1662 + \else
9.1663 + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
9.1664 + \fi
9.1665 + \else
9.1666 + \code{#1}% only url given, so show it
9.1667 + \fi
9.1668 + \fi
9.1669 + \endlink
9.1670 +\endgroup}
9.1671 +
9.1672 +% rms does not like angle brackets --karl, 17may97.
9.1673 +% So now @email is just like @uref, unless we are pdf.
9.1674 +%
9.1675 +%\def\email#1{\angleleft{\tt #1}\angleright}
9.1676 +\ifpdf
9.1677 + \def\email#1{\doemail#1,,\finish}
9.1678 + \def\doemail#1,#2,#3\finish{\begingroup
9.1679 + \unsepspaces
9.1680 + \pdfurl{mailto:#1}%
9.1681 + \setbox0 = \hbox{\ignorespaces #2}%
9.1682 + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
9.1683 + \endlink
9.1684 + \endgroup}
9.1685 +\else
9.1686 + \let\email=\uref
9.1687 +\fi
9.1688 +
9.1689 +% Check if we are currently using a typewriter font. Since all the
9.1690 +% Computer Modern typewriter fonts have zero interword stretch (and
9.1691 +% shrink), and it is reasonable to expect all typewriter fonts to have
9.1692 +% this property, we can check that font parameter.
9.1693 +%
9.1694 +\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
9.1695 +
9.1696 +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
9.1697 +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
9.1698 +%
9.1699 +\def\dmn#1{\thinspace #1}
9.1700 +
9.1701 +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
9.1702 +
9.1703 +% @l was never documented to mean ``switch to the Lisp font'',
9.1704 +% and it is not used as such in any manual I can find. We need it for
9.1705 +% Polish suppressed-l. --karl, 22sep96.
9.1706 +%\def\l#1{{\li #1}\null}
9.1707 +
9.1708 +% Explicit font changes: @r, @sc, undocumented @ii.
9.1709 +\def\r#1{{\rm #1}} % roman font
9.1710 +\def\sc#1{{\smallcaps#1}} % smallcaps font
9.1711 +\def\ii#1{{\it #1}} % italic font
9.1712 +
9.1713 +% @acronym downcases the argument and prints in smallcaps.
9.1714 +\def\acronym#1{{\smallcaps \lowercase{#1}}}
9.1715 +
9.1716 +% @pounds{} is a sterling sign.
9.1717 +\def\pounds{{\it\$}}
9.1718 +
9.1719 +% @registeredsymbol - R in a circle. For now, only works in text size;
9.1720 +% we'd have to redo the font mechanism to change the \scriptstyle and
9.1721 +% \scriptscriptstyle font sizes to make it look right in headings.
9.1722 +% Adapted from the plain.tex definition of \copyright.
9.1723 +%
9.1724 +\def\registeredsymbol{%
9.1725 + $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
9.1726 + }$%
9.1727 +}
9.1728 +
9.1729 +
9.1730 +\message{page headings,}
9.1731 +
9.1732 +\newskip\titlepagetopglue \titlepagetopglue = 1.5in
9.1733 +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
9.1734 +
9.1735 +% First the title page. Must do @settitle before @titlepage.
9.1736 +\newif\ifseenauthor
9.1737 +\newif\iffinishedtitlepage
9.1738 +
9.1739 +% Do an implicit @contents or @shortcontents after @end titlepage if the
9.1740 +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
9.1741 +%
9.1742 +\newif\ifsetcontentsaftertitlepage
9.1743 + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
9.1744 +\newif\ifsetshortcontentsaftertitlepage
9.1745 + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
9.1746 +
9.1747 +\def\shorttitlepage{\parsearg\shorttitlepagezzz}
9.1748 +\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
9.1749 + \endgroup\page\hbox{}\page}
9.1750 +
9.1751 +\def\titlepage{\begingroup \parindent=0pt \textfonts
9.1752 + \let\subtitlerm=\tenrm
9.1753 + \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
9.1754 + %
9.1755 + \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
9.1756 + \let\tt=\authortt}%
9.1757 + %
9.1758 + % Leave some space at the very top of the page.
9.1759 + \vglue\titlepagetopglue
9.1760 + %
9.1761 + % Now you can print the title using @title.
9.1762 + \def\title{\parsearg\titlezzz}%
9.1763 + \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
9.1764 + % print a rule at the page bottom also.
9.1765 + \finishedtitlepagefalse
9.1766 + \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
9.1767 + % No rule at page bottom unless we print one at the top with @title.
9.1768 + \finishedtitlepagetrue
9.1769 + %
9.1770 + % Now you can put text using @subtitle.
9.1771 + \def\subtitle{\parsearg\subtitlezzz}%
9.1772 + \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
9.1773 + %
9.1774 + % @author should come last, but may come many times.
9.1775 + \def\author{\parsearg\authorzzz}%
9.1776 + \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
9.1777 + {\authorfont \leftline{##1}}}%
9.1778 + %
9.1779 + % Most title ``pages'' are actually two pages long, with space
9.1780 + % at the top of the second. We don't want the ragged left on the second.
9.1781 + \let\oldpage = \page
9.1782 + \def\page{%
9.1783 + \iffinishedtitlepage\else
9.1784 + \finishtitlepage
9.1785 + \fi
9.1786 + \oldpage
9.1787 + \let\page = \oldpage
9.1788 + \hbox{}}%
9.1789 +% \def\page{\oldpage \hbox{}}
9.1790 +}
9.1791 +
9.1792 +\def\Etitlepage{%
9.1793 + \iffinishedtitlepage\else
9.1794 + \finishtitlepage
9.1795 + \fi
9.1796 + % It is important to do the page break before ending the group,
9.1797 + % because the headline and footline are only empty inside the group.
9.1798 + % If we use the new definition of \page, we always get a blank page
9.1799 + % after the title page, which we certainly don't want.
9.1800 + \oldpage
9.1801 + \endgroup
9.1802 + %
9.1803 + % Need this before the \...aftertitlepage checks so that if they are
9.1804 + % in effect the toc pages will come out with page numbers.
9.1805 + \HEADINGSon
9.1806 + %
9.1807 + % If they want short, they certainly want long too.
9.1808 + \ifsetshortcontentsaftertitlepage
9.1809 + \shortcontents
9.1810 + \contents
9.1811 + \global\let\shortcontents = \relax
9.1812 + \global\let\contents = \relax
9.1813 + \fi
9.1814 + %
9.1815 + \ifsetcontentsaftertitlepage
9.1816 + \contents
9.1817 + \global\let\contents = \relax
9.1818 + \global\let\shortcontents = \relax
9.1819 + \fi
9.1820 +}
9.1821 +
9.1822 +\def\finishtitlepage{%
9.1823 + \vskip4pt \hrule height 2pt width \hsize
9.1824 + \vskip\titlepagebottomglue
9.1825 + \finishedtitlepagetrue
9.1826 +}
9.1827 +
9.1828 +%%% Set up page headings and footings.
9.1829 +
9.1830 +\let\thispage=\folio
9.1831 +
9.1832 +\newtoks\evenheadline % headline on even pages
9.1833 +\newtoks\oddheadline % headline on odd pages
9.1834 +\newtoks\evenfootline % footline on even pages
9.1835 +\newtoks\oddfootline % footline on odd pages
9.1836 +
9.1837 +% Now make Tex use those variables
9.1838 +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
9.1839 + \else \the\evenheadline \fi}}
9.1840 +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
9.1841 + \else \the\evenfootline \fi}\HEADINGShook}
9.1842 +\let\HEADINGShook=\relax
9.1843 +
9.1844 +% Commands to set those variables.
9.1845 +% For example, this is what @headings on does
9.1846 +% @evenheading @thistitle|@thispage|@thischapter
9.1847 +% @oddheading @thischapter|@thispage|@thistitle
9.1848 +% @evenfooting @thisfile||
9.1849 +% @oddfooting ||@thisfile
9.1850 +
9.1851 +\def\evenheading{\parsearg\evenheadingxxx}
9.1852 +\def\oddheading{\parsearg\oddheadingxxx}
9.1853 +\def\everyheading{\parsearg\everyheadingxxx}
9.1854 +
9.1855 +\def\evenfooting{\parsearg\evenfootingxxx}
9.1856 +\def\oddfooting{\parsearg\oddfootingxxx}
9.1857 +\def\everyfooting{\parsearg\everyfootingxxx}
9.1858 +
9.1859 +{\catcode`\@=0 %
9.1860 +
9.1861 +\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
9.1862 +\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
9.1863 +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
9.1864 +
9.1865 +\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
9.1866 +\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
9.1867 +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
9.1868 +
9.1869 +\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
9.1870 +
9.1871 +\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
9.1872 +\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
9.1873 +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
9.1874 +
9.1875 +\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
9.1876 +\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
9.1877 + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
9.1878 + %
9.1879 + % Leave some space for the footline. Hopefully ok to assume
9.1880 + % @evenfooting will not be used by itself.
9.1881 + \global\advance\pageheight by -\baselineskip
9.1882 + \global\advance\vsize by -\baselineskip
9.1883 +}
9.1884 +
9.1885 +\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
9.1886 +%
9.1887 +}% unbind the catcode of @.
9.1888 +
9.1889 +% @headings double turns headings on for double-sided printing.
9.1890 +% @headings single turns headings on for single-sided printing.
9.1891 +% @headings off turns them off.
9.1892 +% @headings on same as @headings double, retained for compatibility.
9.1893 +% @headings after turns on double-sided headings after this page.
9.1894 +% @headings doubleafter turns on double-sided headings after this page.
9.1895 +% @headings singleafter turns on single-sided headings after this page.
9.1896 +% By default, they are off at the start of a document,
9.1897 +% and turned `on' after @end titlepage.
9.1898 +
9.1899 +\def\headings #1 {\csname HEADINGS#1\endcsname}
9.1900 +
9.1901 +\def\HEADINGSoff{
9.1902 +\global\evenheadline={\hfil} \global\evenfootline={\hfil}
9.1903 +\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
9.1904 +\HEADINGSoff
9.1905 +% When we turn headings on, set the page number to 1.
9.1906 +% For double-sided printing, put current file name in lower left corner,
9.1907 +% chapter name on inside top of right hand pages, document
9.1908 +% title on inside top of left hand pages, and page numbers on outside top
9.1909 +% edge of all pages.
9.1910 +\def\HEADINGSdouble{
9.1911 +\global\pageno=1
9.1912 +\global\evenfootline={\hfil}
9.1913 +\global\oddfootline={\hfil}
9.1914 +\global\evenheadline={\line{\folio\hfil\thistitle}}
9.1915 +\global\oddheadline={\line{\thischapter\hfil\folio}}
9.1916 +\global\let\contentsalignmacro = \chapoddpage
9.1917 +}
9.1918 +\let\contentsalignmacro = \chappager
9.1919 +
9.1920 +% For single-sided printing, chapter title goes across top left of page,
9.1921 +% page number on top right.
9.1922 +\def\HEADINGSsingle{
9.1923 +\global\pageno=1
9.1924 +\global\evenfootline={\hfil}
9.1925 +\global\oddfootline={\hfil}
9.1926 +\global\evenheadline={\line{\thischapter\hfil\folio}}
9.1927 +\global\oddheadline={\line{\thischapter\hfil\folio}}
9.1928 +\global\let\contentsalignmacro = \chappager
9.1929 +}
9.1930 +\def\HEADINGSon{\HEADINGSdouble}
9.1931 +
9.1932 +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
9.1933 +\let\HEADINGSdoubleafter=\HEADINGSafter
9.1934 +\def\HEADINGSdoublex{%
9.1935 +\global\evenfootline={\hfil}
9.1936 +\global\oddfootline={\hfil}
9.1937 +\global\evenheadline={\line{\folio\hfil\thistitle}}
9.1938 +\global\oddheadline={\line{\thischapter\hfil\folio}}
9.1939 +\global\let\contentsalignmacro = \chapoddpage
9.1940 +}
9.1941 +
9.1942 +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
9.1943 +\def\HEADINGSsinglex{%
9.1944 +\global\evenfootline={\hfil}
9.1945 +\global\oddfootline={\hfil}
9.1946 +\global\evenheadline={\line{\thischapter\hfil\folio}}
9.1947 +\global\oddheadline={\line{\thischapter\hfil\folio}}
9.1948 +\global\let\contentsalignmacro = \chappager
9.1949 +}
9.1950 +
9.1951 +% Subroutines used in generating headings
9.1952 +% This produces Day Month Year style of output.
9.1953 +% Only define if not already defined, in case a txi-??.tex file has set
9.1954 +% up a different format (e.g., txi-cs.tex does this).
9.1955 +\ifx\today\undefined
9.1956 +\def\today{%
9.1957 + \number\day\space
9.1958 + \ifcase\month
9.1959 + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
9.1960 + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
9.1961 + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
9.1962 + \fi
9.1963 + \space\number\year}
9.1964 +\fi
9.1965 +
9.1966 +% @settitle line... specifies the title of the document, for headings.
9.1967 +% It generates no output of its own.
9.1968 +\def\thistitle{\putwordNoTitle}
9.1969 +\def\settitle{\parsearg\settitlezzz}
9.1970 +\def\settitlezzz #1{\gdef\thistitle{#1}}
9.1971 +
9.1972 +
9.1973 +\message{tables,}
9.1974 +% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
9.1975 +
9.1976 +% default indentation of table text
9.1977 +\newdimen\tableindent \tableindent=.8in
9.1978 +% default indentation of @itemize and @enumerate text
9.1979 +\newdimen\itemindent \itemindent=.3in
9.1980 +% margin between end of table item and start of table text.
9.1981 +\newdimen\itemmargin \itemmargin=.1in
9.1982 +
9.1983 +% used internally for \itemindent minus \itemmargin
9.1984 +\newdimen\itemmax
9.1985 +
9.1986 +% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
9.1987 +% these defs.
9.1988 +% They also define \itemindex
9.1989 +% to index the item name in whatever manner is desired (perhaps none).
9.1990 +
9.1991 +\newif\ifitemxneedsnegativevskip
9.1992 +
9.1993 +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
9.1994 +
9.1995 +\def\internalBitem{\smallbreak \parsearg\itemzzz}
9.1996 +\def\internalBitemx{\itemxpar \parsearg\itemzzz}
9.1997 +
9.1998 +\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
9.1999 +\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
9.2000 +
9.2001 +\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
9.2002 +\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
9.2003 +
9.2004 +\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
9.2005 + \itemzzz {#1}}
9.2006 +
9.2007 +\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
9.2008 + \itemzzz {#1}}
9.2009 +
9.2010 +\def\itemzzz #1{\begingroup %
9.2011 + \advance\hsize by -\rightskip
9.2012 + \advance\hsize by -\tableindent
9.2013 + \setbox0=\hbox{\itemfont{#1}}%
9.2014 + \itemindex{#1}%
9.2015 + \nobreak % This prevents a break before @itemx.
9.2016 + %
9.2017 + % If the item text does not fit in the space we have, put it on a line
9.2018 + % by itself, and do not allow a page break either before or after that
9.2019 + % line. We do not start a paragraph here because then if the next
9.2020 + % command is, e.g., @kindex, the whatsit would get put into the
9.2021 + % horizontal list on a line by itself, resulting in extra blank space.
9.2022 + \ifdim \wd0>\itemmax
9.2023 + %
9.2024 + % Make this a paragraph so we get the \parskip glue and wrapping,
9.2025 + % but leave it ragged-right.
9.2026 + \begingroup
9.2027 + \advance\leftskip by-\tableindent
9.2028 + \advance\hsize by\tableindent
9.2029 + \advance\rightskip by0pt plus1fil
9.2030 + \leavevmode\unhbox0\par
9.2031 + \endgroup
9.2032 + %
9.2033 + % We're going to be starting a paragraph, but we don't want the
9.2034 + % \parskip glue -- logically it's part of the @item we just started.
9.2035 + \nobreak \vskip-\parskip
9.2036 + %
9.2037 + % Stop a page break at the \parskip glue coming up. (Unfortunately
9.2038 + % we can't prevent a possible page break at the following
9.2039 + % \baselineskip glue.) However, if what follows is an environment
9.2040 + % such as @example, there will be no \parskip glue; then
9.2041 + % the negative vskip we just would cause the example and the item to
9.2042 + % crash together. So we use this bizarre value of 10001 as a signal
9.2043 + % to \aboveenvbreak to insert \parskip glue after all.
9.2044 + % (Possibly there are other commands that could be followed by
9.2045 + % @example which need the same treatment, but not section titles; or
9.2046 + % maybe section titles are the only special case and they should be
9.2047 + % penalty 10001...)
9.2048 + \penalty 10001
9.2049 + \endgroup
9.2050 + \itemxneedsnegativevskipfalse
9.2051 + \else
9.2052 + % The item text fits into the space. Start a paragraph, so that the
9.2053 + % following text (if any) will end up on the same line.
9.2054 + \noindent
9.2055 + % Do this with kerns and \unhbox so that if there is a footnote in
9.2056 + % the item text, it can migrate to the main vertical list and
9.2057 + % eventually be printed.
9.2058 + \nobreak\kern-\tableindent
9.2059 + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
9.2060 + \unhbox0
9.2061 + \nobreak\kern\dimen0
9.2062 + \endgroup
9.2063 + \itemxneedsnegativevskiptrue
9.2064 + \fi
9.2065 +}
9.2066 +
9.2067 +\def\item{\errmessage{@item while not in a table}}
9.2068 +\def\itemx{\errmessage{@itemx while not in a table}}
9.2069 +\def\kitem{\errmessage{@kitem while not in a table}}
9.2070 +\def\kitemx{\errmessage{@kitemx while not in a table}}
9.2071 +\def\xitem{\errmessage{@xitem while not in a table}}
9.2072 +\def\xitemx{\errmessage{@xitemx while not in a table}}
9.2073 +
9.2074 +% Contains a kludge to get @end[description] to work.
9.2075 +\def\description{\tablez{\dontindex}{1}{}{}{}{}}
9.2076 +
9.2077 +% @table, @ftable, @vtable.
9.2078 +\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
9.2079 +{\obeylines\obeyspaces%
9.2080 +\gdef\tablex #1^^M{%
9.2081 +\tabley\dontindex#1 \endtabley}}
9.2082 +
9.2083 +\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
9.2084 +{\obeylines\obeyspaces%
9.2085 +\gdef\ftablex #1^^M{%
9.2086 +\tabley\fnitemindex#1 \endtabley
9.2087 +\def\Eftable{\endgraf\afterenvbreak\endgroup}%
9.2088 +\let\Etable=\relax}}
9.2089 +
9.2090 +\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
9.2091 +{\obeylines\obeyspaces%
9.2092 +\gdef\vtablex #1^^M{%
9.2093 +\tabley\vritemindex#1 \endtabley
9.2094 +\def\Evtable{\endgraf\afterenvbreak\endgroup}%
9.2095 +\let\Etable=\relax}}
9.2096 +
9.2097 +\def\dontindex #1{}
9.2098 +\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
9.2099 +\def\vritemindex #1{\doind {vr}{\code{#1}}}%
9.2100 +
9.2101 +{\obeyspaces %
9.2102 +\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
9.2103 +\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
9.2104 +
9.2105 +\def\tablez #1#2#3#4#5#6{%
9.2106 +\aboveenvbreak %
9.2107 +\begingroup %
9.2108 +\def\Edescription{\Etable}% Necessary kludge.
9.2109 +\let\itemindex=#1%
9.2110 +\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
9.2111 +\ifnum 0#4>0 \tableindent=#4\mil \fi %
9.2112 +\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
9.2113 +\def\itemfont{#2}%
9.2114 +\itemmax=\tableindent %
9.2115 +\advance \itemmax by -\itemmargin %
9.2116 +\advance \leftskip by \tableindent %
9.2117 +\exdentamount=\tableindent
9.2118 +\parindent = 0pt
9.2119 +\parskip = \smallskipamount
9.2120 +\ifdim \parskip=0pt \parskip=2pt \fi%
9.2121 +\def\Etable{\endgraf\afterenvbreak\endgroup}%
9.2122 +\let\item = \internalBitem %
9.2123 +\let\itemx = \internalBitemx %
9.2124 +\let\kitem = \internalBkitem %
9.2125 +\let\kitemx = \internalBkitemx %
9.2126 +\let\xitem = \internalBxitem %
9.2127 +\let\xitemx = \internalBxitemx %
9.2128 +}
9.2129 +
9.2130 +% This is the counter used by @enumerate, which is really @itemize
9.2131 +
9.2132 +\newcount \itemno
9.2133 +
9.2134 +\def\itemize{\parsearg\itemizezzz}
9.2135 +
9.2136 +\def\itemizezzz #1{%
9.2137 + \begingroup % ended by the @end itemize
9.2138 + \itemizey {#1}{\Eitemize}
9.2139 +}
9.2140 +
9.2141 +\def\itemizey#1#2{%
9.2142 + \aboveenvbreak
9.2143 + \itemmax=\itemindent
9.2144 + \advance\itemmax by -\itemmargin
9.2145 + \advance\leftskip by \itemindent
9.2146 + \exdentamount=\itemindent
9.2147 + \parindent=0pt
9.2148 + \parskip=\smallskipamount
9.2149 + \ifdim\parskip=0pt \parskip=2pt \fi
9.2150 + \def#2{\endgraf\afterenvbreak\endgroup}%
9.2151 + \def\itemcontents{#1}%
9.2152 + % @itemize with no arg is equivalent to @itemize @bullet.
9.2153 + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
9.2154 + \let\item=\itemizeitem
9.2155 +}
9.2156 +
9.2157 +% \splitoff TOKENS\endmark defines \first to be the first token in
9.2158 +% TOKENS, and \rest to be the remainder.
9.2159 +%
9.2160 +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
9.2161 +
9.2162 +% Allow an optional argument of an uppercase letter, lowercase letter,
9.2163 +% or number, to specify the first label in the enumerated list. No
9.2164 +% argument is the same as `1'.
9.2165 +%
9.2166 +\def\enumerate{\parsearg\enumeratezzz}
9.2167 +\def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
9.2168 +\def\enumeratey #1 #2\endenumeratey{%
9.2169 + \begingroup % ended by the @end enumerate
9.2170 + %
9.2171 + % If we were given no argument, pretend we were given `1'.
9.2172 + \def\thearg{#1}%
9.2173 + \ifx\thearg\empty \def\thearg{1}\fi
9.2174 + %
9.2175 + % Detect if the argument is a single token. If so, it might be a
9.2176 + % letter. Otherwise, the only valid thing it can be is a number.
9.2177 + % (We will always have one token, because of the test we just made.
9.2178 + % This is a good thing, since \splitoff doesn't work given nothing at
9.2179 + % all -- the first parameter is undelimited.)
9.2180 + \expandafter\splitoff\thearg\endmark
9.2181 + \ifx\rest\empty
9.2182 + % Only one token in the argument. It could still be anything.
9.2183 + % A ``lowercase letter'' is one whose \lccode is nonzero.
9.2184 + % An ``uppercase letter'' is one whose \lccode is both nonzero, and
9.2185 + % not equal to itself.
9.2186 + % Otherwise, we assume it's a number.
9.2187 + %
9.2188 + % We need the \relax at the end of the \ifnum lines to stop TeX from
9.2189 + % continuing to look for a <number>.
9.2190 + %
9.2191 + \ifnum\lccode\expandafter`\thearg=0\relax
9.2192 + \numericenumerate % a number (we hope)
9.2193 + \else
9.2194 + % It's a letter.
9.2195 + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
9.2196 + \lowercaseenumerate % lowercase letter
9.2197 + \else
9.2198 + \uppercaseenumerate % uppercase letter
9.2199 + \fi
9.2200 + \fi
9.2201 + \else
9.2202 + % Multiple tokens in the argument. We hope it's a number.
9.2203 + \numericenumerate
9.2204 + \fi
9.2205 +}
9.2206 +
9.2207 +% An @enumerate whose labels are integers. The starting integer is
9.2208 +% given in \thearg.
9.2209 +%
9.2210 +\def\numericenumerate{%
9.2211 + \itemno = \thearg
9.2212 + \startenumeration{\the\itemno}%
9.2213 +}
9.2214 +
9.2215 +% The starting (lowercase) letter is in \thearg.
9.2216 +\def\lowercaseenumerate{%
9.2217 + \itemno = \expandafter`\thearg
9.2218 + \startenumeration{%
9.2219 + % Be sure we're not beyond the end of the alphabet.
9.2220 + \ifnum\itemno=0
9.2221 + \errmessage{No more lowercase letters in @enumerate; get a bigger
9.2222 + alphabet}%
9.2223 + \fi
9.2224 + \char\lccode\itemno
9.2225 + }%
9.2226 +}
9.2227 +
9.2228 +% The starting (uppercase) letter is in \thearg.
9.2229 +\def\uppercaseenumerate{%
9.2230 + \itemno = \expandafter`\thearg
9.2231 + \startenumeration{%
9.2232 + % Be sure we're not beyond the end of the alphabet.
9.2233 + \ifnum\itemno=0
9.2234 + \errmessage{No more uppercase letters in @enumerate; get a bigger
9.2235 + alphabet}
9.2236 + \fi
9.2237 + \char\uccode\itemno
9.2238 + }%
9.2239 +}
9.2240 +
9.2241 +% Call itemizey, adding a period to the first argument and supplying the
9.2242 +% common last two arguments. Also subtract one from the initial value in
9.2243 +% \itemno, since @item increments \itemno.
9.2244 +%
9.2245 +\def\startenumeration#1{%
9.2246 + \advance\itemno by -1
9.2247 + \itemizey{#1.}\Eenumerate\flushcr
9.2248 +}
9.2249 +
9.2250 +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
9.2251 +% to @enumerate.
9.2252 +%
9.2253 +\def\alphaenumerate{\enumerate{a}}
9.2254 +\def\capsenumerate{\enumerate{A}}
9.2255 +\def\Ealphaenumerate{\Eenumerate}
9.2256 +\def\Ecapsenumerate{\Eenumerate}
9.2257 +
9.2258 +% Definition of @item while inside @itemize.
9.2259 +
9.2260 +\def\itemizeitem{%
9.2261 +\advance\itemno by 1
9.2262 +{\let\par=\endgraf \smallbreak}%
9.2263 +\ifhmode \errmessage{In hmode at itemizeitem}\fi
9.2264 +{\parskip=0in \hskip 0pt
9.2265 +\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
9.2266 +\vadjust{\penalty 1200}}%
9.2267 +\flushcr}
9.2268 +
9.2269 +% @multitable macros
9.2270 +% Amy Hendrickson, 8/18/94, 3/6/96
9.2271 +%
9.2272 +% @multitable ... @end multitable will make as many columns as desired.
9.2273 +% Contents of each column will wrap at width given in preamble. Width
9.2274 +% can be specified either with sample text given in a template line,
9.2275 +% or in percent of \hsize, the current width of text on page.
9.2276 +
9.2277 +% Table can continue over pages but will only break between lines.
9.2278 +
9.2279 +% To make preamble:
9.2280 +%
9.2281 +% Either define widths of columns in terms of percent of \hsize:
9.2282 +% @multitable @columnfractions .25 .3 .45
9.2283 +% @item ...
9.2284 +%
9.2285 +% Numbers following @columnfractions are the percent of the total
9.2286 +% current hsize to be used for each column. You may use as many
9.2287 +% columns as desired.
9.2288 +
9.2289 +
9.2290 +% Or use a template:
9.2291 +% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
9.2292 +% @item ...
9.2293 +% using the widest term desired in each column.
9.2294 +%
9.2295 +% For those who want to use more than one line's worth of words in
9.2296 +% the preamble, break the line within one argument and it
9.2297 +% will parse correctly, i.e.,
9.2298 +%
9.2299 +% @multitable {Column 1 template} {Column 2 template} {Column 3
9.2300 +% template}
9.2301 +% Not:
9.2302 +% @multitable {Column 1 template} {Column 2 template}
9.2303 +% {Column 3 template}
9.2304 +
9.2305 +% Each new table line starts with @item, each subsequent new column
9.2306 +% starts with @tab. Empty columns may be produced by supplying @tab's
9.2307 +% with nothing between them for as many times as empty columns are needed,
9.2308 +% ie, @tab@tab@tab will produce two empty columns.
9.2309 +
9.2310 +% @item, @tab, @multitable or @end multitable do not need to be on their
9.2311 +% own lines, but it will not hurt if they are.
9.2312 +
9.2313 +% Sample multitable:
9.2314 +
9.2315 +% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
9.2316 +% @item first col stuff @tab second col stuff @tab third col
9.2317 +% @item
9.2318 +% first col stuff
9.2319 +% @tab
9.2320 +% second col stuff
9.2321 +% @tab
9.2322 +% third col
9.2323 +% @item first col stuff @tab second col stuff
9.2324 +% @tab Many paragraphs of text may be used in any column.
9.2325 +%
9.2326 +% They will wrap at the width determined by the template.
9.2327 +% @item@tab@tab This will be in third column.
9.2328 +% @end multitable
9.2329 +
9.2330 +% Default dimensions may be reset by user.
9.2331 +% @multitableparskip is vertical space between paragraphs in table.
9.2332 +% @multitableparindent is paragraph indent in table.
9.2333 +% @multitablecolmargin is horizontal space to be left between columns.
9.2334 +% @multitablelinespace is space to leave between table items, baseline
9.2335 +% to baseline.
9.2336 +% 0pt means it depends on current normal line spacing.
9.2337 +%
9.2338 +\newskip\multitableparskip
9.2339 +\newskip\multitableparindent
9.2340 +\newdimen\multitablecolspace
9.2341 +\newskip\multitablelinespace
9.2342 +\multitableparskip=0pt
9.2343 +\multitableparindent=6pt
9.2344 +\multitablecolspace=12pt
9.2345 +\multitablelinespace=0pt
9.2346 +
9.2347 +% Macros used to set up halign preamble:
9.2348 +%
9.2349 +\let\endsetuptable\relax
9.2350 +\def\xendsetuptable{\endsetuptable}
9.2351 +\let\columnfractions\relax
9.2352 +\def\xcolumnfractions{\columnfractions}
9.2353 +\newif\ifsetpercent
9.2354 +
9.2355 +% #1 is the part of the @columnfraction before the decimal point, which
9.2356 +% is presumably either 0 or the empty string (but we don't check, we
9.2357 +% just throw it away). #2 is the decimal part, which we use as the
9.2358 +% percent of \hsize for this column.
9.2359 +\def\pickupwholefraction#1.#2 {%
9.2360 + \global\advance\colcount by 1
9.2361 + \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
9.2362 + \setuptable
9.2363 +}
9.2364 +
9.2365 +\newcount\colcount
9.2366 +\def\setuptable#1{%
9.2367 + \def\firstarg{#1}%
9.2368 + \ifx\firstarg\xendsetuptable
9.2369 + \let\go = \relax
9.2370 + \else
9.2371 + \ifx\firstarg\xcolumnfractions
9.2372 + \global\setpercenttrue
9.2373 + \else
9.2374 + \ifsetpercent
9.2375 + \let\go\pickupwholefraction
9.2376 + \else
9.2377 + \global\advance\colcount by 1
9.2378 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
9.2379 + % separator; typically that is always in the input, anyway.
9.2380 + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
9.2381 + \fi
9.2382 + \fi
9.2383 + \ifx\go\pickupwholefraction
9.2384 + % Put the argument back for the \pickupwholefraction call, so
9.2385 + % we'll always have a period there to be parsed.
9.2386 + \def\go{\pickupwholefraction#1}%
9.2387 + \else
9.2388 + \let\go = \setuptable
9.2389 + \fi%
9.2390 + \fi
9.2391 + \go
9.2392 +}
9.2393 +
9.2394 +% @multitable ... @end multitable definitions:
9.2395 +%
9.2396 +\def\multitable{\parsearg\dotable}
9.2397 +\def\dotable#1{\bgroup
9.2398 + \vskip\parskip
9.2399 + \let\item=\crcrwithfootnotes
9.2400 + % A \tab used to include \hskip1sp. But then the space in a template
9.2401 + % line is not enough. That is bad. So let's go back to just & until
9.2402 + % we encounter the problem it was intended to solve again. --karl,
9.2403 + % nathan@acm.org, 20apr99.
9.2404 + \let\tab=&%
9.2405 + \let\startfootins=\startsavedfootnote
9.2406 + \tolerance=9500
9.2407 + \hbadness=9500
9.2408 + \setmultitablespacing
9.2409 + \parskip=\multitableparskip
9.2410 + \parindent=\multitableparindent
9.2411 + \overfullrule=0pt
9.2412 + \global\colcount=0
9.2413 + \def\Emultitable{%
9.2414 + \global\setpercentfalse
9.2415 + \crcrwithfootnotes\crcr
9.2416 + \egroup\egroup
9.2417 + }%
9.2418 + %
9.2419 + % To parse everything between @multitable and @item:
9.2420 + \setuptable#1 \endsetuptable
9.2421 + %
9.2422 + % \everycr will reset column counter, \colcount, at the end of
9.2423 + % each line. Every column entry will cause \colcount to advance by one.
9.2424 + % The table preamble
9.2425 + % looks at the current \colcount to find the correct column width.
9.2426 + \everycr{\noalign{%
9.2427 + %
9.2428 + % \filbreak%% keeps underfull box messages off when table breaks over pages.
9.2429 + % Maybe so, but it also creates really weird page breaks when the table
9.2430 + % breaks over pages. Wouldn't \vfil be better? Wait until the problem
9.2431 + % manifests itself, so it can be fixed for real --karl.
9.2432 + \global\colcount=0\relax}}%
9.2433 + %
9.2434 + % This preamble sets up a generic column definition, which will
9.2435 + % be used as many times as user calls for columns.
9.2436 + % \vtop will set a single line and will also let text wrap and
9.2437 + % continue for many paragraphs if desired.
9.2438 + \halign\bgroup&\global\advance\colcount by 1\relax
9.2439 + \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
9.2440 + %
9.2441 + % In order to keep entries from bumping into each other
9.2442 + % we will add a \leftskip of \multitablecolspace to all columns after
9.2443 + % the first one.
9.2444 + %
9.2445 + % If a template has been used, we will add \multitablecolspace
9.2446 + % to the width of each template entry.
9.2447 + %
9.2448 + % If the user has set preamble in terms of percent of \hsize we will
9.2449 + % use that dimension as the width of the column, and the \leftskip
9.2450 + % will keep entries from bumping into each other. Table will start at
9.2451 + % left margin and final column will justify at right margin.
9.2452 + %
9.2453 + % Make sure we don't inherit \rightskip from the outer environment.
9.2454 + \rightskip=0pt
9.2455 + \ifnum\colcount=1
9.2456 + % The first column will be indented with the surrounding text.
9.2457 + \advance\hsize by\leftskip
9.2458 + \else
9.2459 + \ifsetpercent \else
9.2460 + % If user has not set preamble in terms of percent of \hsize
9.2461 + % we will advance \hsize by \multitablecolspace.
9.2462 + \advance\hsize by \multitablecolspace
9.2463 + \fi
9.2464 + % In either case we will make \leftskip=\multitablecolspace:
9.2465 + \leftskip=\multitablecolspace
9.2466 + \fi
9.2467 + % Ignoring space at the beginning and end avoids an occasional spurious
9.2468 + % blank line, when TeX decides to break the line at the space before the
9.2469 + % box from the multistrut, so the strut ends up on a line by itself.
9.2470 + % For example:
9.2471 + % @multitable @columnfractions .11 .89
9.2472 + % @item @code{#}
9.2473 + % @tab Legal holiday which is valid in major parts of the whole country.
9.2474 + % Is automatically provided with highlighting sequences respectively marking
9.2475 + % characters.
9.2476 + \noindent\ignorespaces##\unskip\multistrut}\cr
9.2477 +}
9.2478 +
9.2479 +\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
9.2480 +% If so, do nothing. If not, give it an appropriate dimension based on
9.2481 +% current baselineskip.
9.2482 +\ifdim\multitablelinespace=0pt
9.2483 +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
9.2484 +\global\advance\multitablelinespace by-\ht0
9.2485 +%% strut to put in table in case some entry doesn't have descenders,
9.2486 +%% to keep lines equally spaced
9.2487 +\let\multistrut = \strut
9.2488 +\else
9.2489 +%% FIXME: what is \box0 supposed to be?
9.2490 +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
9.2491 +width0pt\relax} \fi
9.2492 +%% Test to see if parskip is larger than space between lines of
9.2493 +%% table. If not, do nothing.
9.2494 +%% If so, set to same dimension as multitablelinespace.
9.2495 +\ifdim\multitableparskip>\multitablelinespace
9.2496 +\global\multitableparskip=\multitablelinespace
9.2497 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
9.2498 + %% than skip between lines in the table.
9.2499 +\fi%
9.2500 +\ifdim\multitableparskip=0pt
9.2501 +\global\multitableparskip=\multitablelinespace
9.2502 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
9.2503 + %% than skip between lines in the table.
9.2504 +\fi}
9.2505 +
9.2506 +% In case a @footnote appears inside an alignment, save the footnote
9.2507 +% text to a box and make the \insert when a row of the table is
9.2508 +% finished. Otherwise, the insertion is lost, it never migrates to the
9.2509 +% main vertical list. --kasal, 22jan03.
9.2510 +%
9.2511 +\newbox\savedfootnotes
9.2512 +%
9.2513 +% \dotable \let's \startfootins to this, so that \dofootnote will call
9.2514 +% it instead of starting the insertion right away.
9.2515 +\def\startsavedfootnote{%
9.2516 + \global\setbox\savedfootnotes = \vbox\bgroup
9.2517 + \unvbox\savedfootnotes
9.2518 +}
9.2519 +\def\crcrwithfootnotes{%
9.2520 + \crcr
9.2521 + \ifvoid\savedfootnotes \else
9.2522 + \noalign{\insert\footins{\box\savedfootnotes}}%
9.2523 + \fi
9.2524 +}
9.2525 +
9.2526 +\message{conditionals,}
9.2527 +% Prevent errors for section commands.
9.2528 +% Used in @ignore and in failing conditionals.
9.2529 +\def\ignoresections{%
9.2530 + \let\appendix=\relax
9.2531 + \let\appendixsec=\relax
9.2532 + \let\appendixsection=\relax
9.2533 + \let\appendixsubsec=\relax
9.2534 + \let\appendixsubsection=\relax
9.2535 + \let\appendixsubsubsec=\relax
9.2536 + \let\appendixsubsubsection=\relax
9.2537 + %\let\begin=\relax
9.2538 + %\let\bye=\relax
9.2539 + \let\centerchap=\relax
9.2540 + \let\chapter=\relax
9.2541 + \let\contents=\relax
9.2542 + \let\section=\relax
9.2543 + \let\smallbook=\relax
9.2544 + \let\subsec=\relax
9.2545 + \let\subsection=\relax
9.2546 + \let\subsubsec=\relax
9.2547 + \let\subsubsection=\relax
9.2548 + \let\titlepage=\relax
9.2549 + \let\top=\relax
9.2550 + \let\unnumbered=\relax
9.2551 + \let\unnumberedsec=\relax
9.2552 + \let\unnumberedsection=\relax
9.2553 + \let\unnumberedsubsec=\relax
9.2554 + \let\unnumberedsubsection=\relax
9.2555 + \let\unnumberedsubsubsec=\relax
9.2556 + \let\unnumberedsubsubsection=\relax
9.2557 +}
9.2558 +
9.2559 +% Ignore @ignore, @ifhtml, @ifinfo, and the like.
9.2560 +%
9.2561 +\def\direntry{\doignore{direntry}}
9.2562 +\def\documentdescriptionword{documentdescription}
9.2563 +\def\documentdescription{\doignore{documentdescription}}
9.2564 +\def\html{\doignore{html}}
9.2565 +\def\ifhtml{\doignore{ifhtml}}
9.2566 +\def\ifinfo{\doignore{ifinfo}}
9.2567 +\def\ifnottex{\doignore{ifnottex}}
9.2568 +\def\ifplaintext{\doignore{ifplaintext}}
9.2569 +\def\ifxml{\doignore{ifxml}}
9.2570 +\def\ignore{\doignore{ignore}}
9.2571 +\def\menu{\doignore{menu}}
9.2572 +\def\xml{\doignore{xml}}
9.2573 +
9.2574 +% @dircategory CATEGORY -- specify a category of the dir file
9.2575 +% which this file should belong to. Ignore this in TeX.
9.2576 +\let\dircategory = \comment
9.2577 +
9.2578 +% Ignore text until a line `@end #1', keeping track of nested conditionals.
9.2579 +%
9.2580 +% A count to remember the depth of nesting.
9.2581 +\newcount\doignorecount \doignorecount = 0
9.2582 +
9.2583 +\def\doignore#1{\begingroup
9.2584 + % Don't complain about control sequences we have declared \outer.
9.2585 + \ignoresections
9.2586 + %
9.2587 + % Make sure that spaces turn into tokens that match what \doignoretext wants.
9.2588 + \catcode\spaceChar = 10
9.2589 + %
9.2590 + % Ignore braces, so mismatched braces don't cause trouble.
9.2591 + \catcode`\{ = 9
9.2592 + \catcode`\} = 9
9.2593 + %
9.2594 + % Count number of #1's that we've seen.
9.2595 + \doignorecount = 0
9.2596 + %
9.2597 + % Swallow text until we reach the matching `@end #1'.
9.2598 + \expandafter \dodoignore \csname#1\endcsname {#1}%
9.2599 +}
9.2600 +
9.2601 +{ \catcode`@=11 % We want to use \ST@P which cannot appear in texinfo source.
9.2602 + \obeylines %
9.2603 + %
9.2604 + \gdef\dodoignore#1#2{%
9.2605 + % #1 contains, e.g., \ifinfo, a.k.a. @ifinfo.
9.2606 + % #2 contains the string `ifinfo'.
9.2607 + %
9.2608 + % Define a command to find the next `@end #2', which must be on a line
9.2609 + % by itself.
9.2610 + \long\def\doignoretext##1^^M\end #2{\doignoretextyyy##1^^M#1\ST@P}%
9.2611 + % And this command to find another #1 command, at the beginning of a
9.2612 + % line. (Otherwise, we would consider a line `@c @ifset', for
9.2613 + % example, to count as an @ifset for nesting.)
9.2614 + \long\def\doignoretextyyy##1^^M#1##2\ST@P{\doignoreyyy{##2}\ST@P}%
9.2615 + %
9.2616 + % And now expand that command.
9.2617 + \obeylines %
9.2618 + \doignoretext ^^M%
9.2619 + }%
9.2620 +}
9.2621 +
9.2622 +\def\doignoreyyy#1{%
9.2623 + \def\temp{#1}%
9.2624 + \ifx\temp\empty % Nothing found.
9.2625 + \let\next\doignoretextzzz
9.2626 + \else % Found a nested condition, ...
9.2627 + \advance\doignorecount by 1
9.2628 + \let\next\doignoretextyyy % ..., look for another.
9.2629 + % If we're here, #1 ends with \ifinfo (for example).
9.2630 + \fi
9.2631 + \next #1% the token \ST@P is present just after this macro.
9.2632 +}
9.2633 +
9.2634 +% We have to swallow the remaining "\ST@P".
9.2635 +%
9.2636 +\def\doignoretextzzz#1{%
9.2637 + \ifnum\doignorecount = 0 % We have just found the outermost @end.
9.2638 + \let\next\enddoignore
9.2639 + \else % Still inside a nested condition.
9.2640 + \advance\doignorecount by -1
9.2641 + \let\next\doignoretext % Look for the next @end.
9.2642 + \fi
9.2643 + \next
9.2644 +}
9.2645 +
9.2646 +% Finish off ignored text.
9.2647 +\def\enddoignore{\endgroup\ignorespaces}
9.2648 +
9.2649 +
9.2650 +% @set VAR sets the variable VAR to an empty value.
9.2651 +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
9.2652 +%
9.2653 +% Since we want to separate VAR from REST-OF-LINE (which might be
9.2654 +% empty), we can't just use \parsearg; we have to insert a space of our
9.2655 +% own to delimit the rest of the line, and then take it out again if we
9.2656 +% didn't need it. Make sure the catcode of space is correct to avoid
9.2657 +% losing inside @example, for instance.
9.2658 +%
9.2659 +\def\set{\begingroup\catcode` =10
9.2660 + \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
9.2661 + \parsearg\setxxx}
9.2662 +\def\setxxx#1{\setyyy#1 \endsetyyy}
9.2663 +\def\setyyy#1 #2\endsetyyy{%
9.2664 + \def\temp{#2}%
9.2665 + \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
9.2666 + \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
9.2667 + \fi
9.2668 + \endgroup
9.2669 +}
9.2670 +% Can't use \xdef to pre-expand #2 and save some time, since \temp or
9.2671 +% \next or other control sequences that we've defined might get us into
9.2672 +% an infinite loop. Consider `@set foo @cite{bar}'.
9.2673 +\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
9.2674 +
9.2675 +% @clear VAR clears (i.e., unsets) the variable VAR.
9.2676 +%
9.2677 +\def\clear{\parsearg\clearxxx}
9.2678 +\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
9.2679 +
9.2680 +% @value{foo} gets the text saved in variable foo.
9.2681 +{
9.2682 + \catcode`\_ = \active
9.2683 + %
9.2684 + % We might end up with active _ or - characters in the argument if
9.2685 + % we're called from @code, as @code{@value{foo-bar_}}. So \let any
9.2686 + % such active characters to their normal equivalents.
9.2687 + \gdef\value{\begingroup
9.2688 + \catcode`\-=\other \catcode`\_=\other
9.2689 + \indexbreaks \let_\normalunderscore
9.2690 + \valuexxx}
9.2691 +}
9.2692 +\def\valuexxx#1{\expandablevalue{#1}\endgroup}
9.2693 +
9.2694 +% We have this subroutine so that we can handle at least some @value's
9.2695 +% properly in indexes (we \let\value to this in \indexdummies). Ones
9.2696 +% whose names contain - or _ still won't work, but we can't do anything
9.2697 +% about that. The command has to be fully expandable (if the variable
9.2698 +% is set), since the result winds up in the index file. This means that
9.2699 +% if the variable's value contains other Texinfo commands, it's almost
9.2700 +% certain it will fail (although perhaps we could fix that with
9.2701 +% sufficient work to do a one-level expansion on the result, instead of
9.2702 +% complete).
9.2703 +%
9.2704 +\def\expandablevalue#1{%
9.2705 + \expandafter\ifx\csname SET#1\endcsname\relax
9.2706 + {[No value for ``#1'']}%
9.2707 + \message{Variable `#1', used in @value, is not set.}%
9.2708 + \else
9.2709 + \csname SET#1\endcsname
9.2710 + \fi
9.2711 +}
9.2712 +
9.2713 +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
9.2714 +% with @set.
9.2715 +%
9.2716 +\def\ifset{\parsearg\doifset}
9.2717 +\def\doifset#1{%
9.2718 + \expandafter\ifx\csname SET#1\endcsname\relax
9.2719 + \let\next=\ifsetfail
9.2720 + \else
9.2721 + \let\next=\ifsetsucceed
9.2722 + \fi
9.2723 + \next
9.2724 +}
9.2725 +\def\ifsetsucceed{\conditionalsucceed{ifset}}
9.2726 +\def\ifsetfail{\doignore{ifset}}
9.2727 +\defineunmatchedend{ifset}
9.2728 +
9.2729 +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
9.2730 +% defined with @set, or has been undefined with @clear.
9.2731 +%
9.2732 +\def\ifclear{\parsearg\doifclear}
9.2733 +\def\doifclear#1{%
9.2734 + \expandafter\ifx\csname SET#1\endcsname\relax
9.2735 + \let\next=\ifclearsucceed
9.2736 + \else
9.2737 + \let\next=\ifclearfail
9.2738 + \fi
9.2739 + \next
9.2740 +}
9.2741 +\def\ifclearsucceed{\conditionalsucceed{ifclear}}
9.2742 +\def\ifclearfail{\doignore{ifclear}}
9.2743 +\defineunmatchedend{ifclear}
9.2744 +
9.2745 +% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
9.2746 +% read the text following, through the first @end iftex (etc.). Make
9.2747 +% `@end iftex' (etc.) valid only after an @iftex.
9.2748 +%
9.2749 +\def\iftex{\conditionalsucceed{iftex}}
9.2750 +\def\ifnothtml{\conditionalsucceed{ifnothtml}}
9.2751 +\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
9.2752 +\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
9.2753 +\defineunmatchedend{iftex}
9.2754 +\defineunmatchedend{ifnothtml}
9.2755 +\defineunmatchedend{ifnotinfo}
9.2756 +\defineunmatchedend{ifnotplaintext}
9.2757 +
9.2758 +% True conditional. Since \set globally defines its variables, we can
9.2759 +% just start and end a group (to keep the @end definition undefined at
9.2760 +% the outer level).
9.2761 +%
9.2762 +\def\conditionalsucceed#1{\begingroup
9.2763 + \expandafter\def\csname E#1\endcsname{\endgroup}%
9.2764 +}
9.2765 +
9.2766 +% @defininfoenclose.
9.2767 +\let\definfoenclose=\comment
9.2768 +
9.2769 +
9.2770 +\message{indexing,}
9.2771 +% Index generation facilities
9.2772 +
9.2773 +% Define \newwrite to be identical to plain tex's \newwrite
9.2774 +% except not \outer, so it can be used within \newindex.
9.2775 +{\catcode`\@=11
9.2776 +\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
9.2777 +
9.2778 +% \newindex {foo} defines an index named foo.
9.2779 +% It automatically defines \fooindex such that
9.2780 +% \fooindex ...rest of line... puts an entry in the index foo.
9.2781 +% It also defines \fooindfile to be the number of the output channel for
9.2782 +% the file that accumulates this index. The file's extension is foo.
9.2783 +% The name of an index should be no more than 2 characters long
9.2784 +% for the sake of vms.
9.2785 +%
9.2786 +\def\newindex#1{%
9.2787 + \iflinks
9.2788 + \expandafter\newwrite \csname#1indfile\endcsname
9.2789 + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
9.2790 + \fi
9.2791 + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
9.2792 + \noexpand\doindex{#1}}
9.2793 +}
9.2794 +
9.2795 +% @defindex foo == \newindex{foo}
9.2796 +%
9.2797 +\def\defindex{\parsearg\newindex}
9.2798 +
9.2799 +% Define @defcodeindex, like @defindex except put all entries in @code.
9.2800 +%
9.2801 +\def\defcodeindex{\parsearg\newcodeindex}
9.2802 +%
9.2803 +\def\newcodeindex#1{%
9.2804 + \iflinks
9.2805 + \expandafter\newwrite \csname#1indfile\endcsname
9.2806 + \openout \csname#1indfile\endcsname \jobname.#1
9.2807 + \fi
9.2808 + \expandafter\xdef\csname#1index\endcsname{%
9.2809 + \noexpand\docodeindex{#1}}%
9.2810 +}
9.2811 +
9.2812 +
9.2813 +% @synindex foo bar makes index foo feed into index bar.
9.2814 +% Do this instead of @defindex foo if you don't want it as a separate index.
9.2815 +%
9.2816 +% @syncodeindex foo bar similar, but put all entries made for index foo
9.2817 +% inside @code.
9.2818 +%
9.2819 +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
9.2820 +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
9.2821 +
9.2822 +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
9.2823 +% #3 the target index (bar).
9.2824 +\def\dosynindex#1#2#3{%
9.2825 + % Only do \closeout if we haven't already done it, else we'll end up
9.2826 + % closing the target index.
9.2827 + \expandafter \ifx\csname donesynindex#2\endcsname \undefined
9.2828 + % The \closeout helps reduce unnecessary open files; the limit on the
9.2829 + % Acorn RISC OS is a mere 16 files.
9.2830 + \expandafter\closeout\csname#2indfile\endcsname
9.2831 + \expandafter\let\csname\donesynindex#2\endcsname = 1
9.2832 + \fi
9.2833 + % redefine \fooindfile:
9.2834 + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
9.2835 + \expandafter\let\csname#2indfile\endcsname=\temp
9.2836 + % redefine \fooindex:
9.2837 + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
9.2838 +}
9.2839 +
9.2840 +% Define \doindex, the driver for all \fooindex macros.
9.2841 +% Argument #1 is generated by the calling \fooindex macro,
9.2842 +% and it is "foo", the name of the index.
9.2843 +
9.2844 +% \doindex just uses \parsearg; it calls \doind for the actual work.
9.2845 +% This is because \doind is more useful to call from other macros.
9.2846 +
9.2847 +% There is also \dosubind {index}{topic}{subtopic}
9.2848 +% which makes an entry in a two-level index such as the operation index.
9.2849 +
9.2850 +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
9.2851 +\def\singleindexer #1{\doind{\indexname}{#1}}
9.2852 +
9.2853 +% like the previous two, but they put @code around the argument.
9.2854 +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
9.2855 +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
9.2856 +
9.2857 +% Take care of Texinfo commands that can appear in an index entry.
9.2858 +% Since there are some commands we want to expand, and others we don't,
9.2859 +% we have to laboriously prevent expansion for those that we don't.
9.2860 +%
9.2861 +\def\indexdummies{%
9.2862 + \def\@{@}% change to @@ when we switch to @ as escape char in index files.
9.2863 + \def\ {\realbackslash\space }%
9.2864 + % Need these in case \tex is in effect and \{ is a \delimiter again.
9.2865 + % But can't use \lbracecmd and \rbracecmd because texindex assumes
9.2866 + % braces and backslashes are used only as delimiters.
9.2867 + \let\{ = \mylbrace
9.2868 + \let\} = \myrbrace
9.2869 + %
9.2870 + % \definedummyword defines \#1 as \realbackslash #1\space, thus
9.2871 + % effectively preventing its expansion. This is used only for control
9.2872 + % words, not control letters, because the \space would be incorrect
9.2873 + % for control characters, but is needed to separate the control word
9.2874 + % from whatever follows.
9.2875 + %
9.2876 + % For control letters, we have \definedummyletter, which omits the
9.2877 + % space.
9.2878 + %
9.2879 + % These can be used both for control words that take an argument and
9.2880 + % those that do not. If it is followed by {arg} in the input, then
9.2881 + % that will dutifully get written to the index (or wherever).
9.2882 + %
9.2883 + \def\definedummyword##1{%
9.2884 + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
9.2885 + }%
9.2886 + \def\definedummyletter##1{%
9.2887 + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
9.2888 + }%
9.2889 + %
9.2890 + % Do the redefinitions.
9.2891 + \commondummies
9.2892 +}
9.2893 +
9.2894 +% For the aux file, @ is the escape character. So we want to redefine
9.2895 +% everything using @ instead of \realbackslash. When everything uses
9.2896 +% @, this will be simpler.
9.2897 +%
9.2898 +\def\atdummies{%
9.2899 + \def\@{@@}%
9.2900 + \def\ {@ }%
9.2901 + \let\{ = \lbraceatcmd
9.2902 + \let\} = \rbraceatcmd
9.2903 + %
9.2904 + % (See comments in \indexdummies.)
9.2905 + \def\definedummyword##1{%
9.2906 + \expandafter\def\csname ##1\endcsname{@##1\space}%
9.2907 + }%
9.2908 + \def\definedummyletter##1{%
9.2909 + \expandafter\def\csname ##1\endcsname{@##1}%
9.2910 + }%
9.2911 + %
9.2912 + % Do the redefinitions.
9.2913 + \commondummies
9.2914 +}
9.2915 +
9.2916 +% Called from \indexdummies and \atdummies. \definedummyword and
9.2917 +% \definedummyletter must be defined first.
9.2918 +%
9.2919 +\def\commondummies{%
9.2920 + %
9.2921 + \normalturnoffactive
9.2922 + %
9.2923 + % Control letters and accents.
9.2924 + \definedummyletter{_}%
9.2925 + \definedummyletter{,}%
9.2926 + \definedummyletter{"}%
9.2927 + \definedummyletter{`}%
9.2928 + \definedummyletter{'}%
9.2929 + \definedummyletter{^}%
9.2930 + \definedummyletter{~}%
9.2931 + \definedummyletter{=}%
9.2932 + \definedummyword{u}%
9.2933 + \definedummyword{v}%
9.2934 + \definedummyword{H}%
9.2935 + \definedummyword{dotaccent}%
9.2936 + \definedummyword{ringaccent}%
9.2937 + \definedummyword{tieaccent}%
9.2938 + \definedummyword{ubaraccent}%
9.2939 + \definedummyword{udotaccent}%
9.2940 + \definedummyword{dotless}%
9.2941 + %
9.2942 + % Other non-English letters.
9.2943 + \definedummyword{AA}%
9.2944 + \definedummyword{AE}%
9.2945 + \definedummyword{L}%
9.2946 + \definedummyword{OE}%
9.2947 + \definedummyword{O}%
9.2948 + \definedummyword{aa}%
9.2949 + \definedummyword{ae}%
9.2950 + \definedummyword{l}%
9.2951 + \definedummyword{oe}%
9.2952 + \definedummyword{o}%
9.2953 + \definedummyword{ss}%
9.2954 + %
9.2955 + % Although these internal commands shouldn't show up, sometimes they do.
9.2956 + \definedummyword{bf}%
9.2957 + \definedummyword{gtr}%
9.2958 + \definedummyword{hat}%
9.2959 + \definedummyword{less}%
9.2960 + \definedummyword{sf}%
9.2961 + \definedummyword{sl}%
9.2962 + \definedummyword{tclose}%
9.2963 + \definedummyword{tt}%
9.2964 + %
9.2965 + % Texinfo font commands.
9.2966 + \definedummyword{b}%
9.2967 + \definedummyword{i}%
9.2968 + \definedummyword{r}%
9.2969 + \definedummyword{sc}%
9.2970 + \definedummyword{t}%
9.2971 + %
9.2972 + \definedummyword{TeX}%
9.2973 + \definedummyword{acronym}%
9.2974 + \definedummyword{cite}%
9.2975 + \definedummyword{code}%
9.2976 + \definedummyword{command}%
9.2977 + \definedummyword{dfn}%
9.2978 + \definedummyword{dots}%
9.2979 + \definedummyword{emph}%
9.2980 + \definedummyword{env}%
9.2981 + \definedummyword{file}%
9.2982 + \definedummyword{kbd}%
9.2983 + \definedummyword{key}%
9.2984 + \definedummyword{math}%
9.2985 + \definedummyword{option}%
9.2986 + \definedummyword{samp}%
9.2987 + \definedummyword{strong}%
9.2988 + \definedummyword{uref}%
9.2989 + \definedummyword{url}%
9.2990 + \definedummyword{var}%
9.2991 + \definedummyword{w}%
9.2992 + %
9.2993 + % Assorted special characters.
9.2994 + \definedummyword{bullet}%
9.2995 + \definedummyword{copyright}%
9.2996 + \definedummyword{dots}%
9.2997 + \definedummyword{enddots}%
9.2998 + \definedummyword{equiv}%
9.2999 + \definedummyword{error}%
9.3000 + \definedummyword{expansion}%
9.3001 + \definedummyword{minus}%
9.3002 + \definedummyword{pounds}%
9.3003 + \definedummyword{point}%
9.3004 + \definedummyword{print}%
9.3005 + \definedummyword{result}%
9.3006 + %
9.3007 + % Handle some cases of @value -- where the variable name does not
9.3008 + % contain - or _, and the value does not contain any
9.3009 + % (non-fully-expandable) commands.
9.3010 + \let\value = \expandablevalue
9.3011 + %
9.3012 + % Normal spaces, not active ones.
9.3013 + \unsepspaces
9.3014 + %
9.3015 + % No macro expansion.
9.3016 + \turnoffmacros
9.3017 +}
9.3018 +
9.3019 +% If an index command is used in an @example environment, any spaces
9.3020 +% therein should become regular spaces in the raw index file, not the
9.3021 +% expansion of \tie (\leavevmode \penalty \@M \ ).
9.3022 +{\obeyspaces
9.3023 + \gdef\unsepspaces{\obeyspaces\let =\space}}
9.3024 +
9.3025 +
9.3026 +% \indexnofonts is used when outputting the strings to sort the index
9.3027 +% by, and when constructing control sequence names. It eliminates all
9.3028 +% control sequences and just writes whatever the best ASCII sort string
9.3029 +% would be for a given command (usually its argument).
9.3030 +%
9.3031 +\def\indexdummytex{TeX}
9.3032 +\def\indexdummydots{...}
9.3033 +%
9.3034 +\def\indexnofonts{%
9.3035 + \def\ { }%
9.3036 + \def\@{@}%
9.3037 + % how to handle braces?
9.3038 + \def\_{\normalunderscore}%
9.3039 + %
9.3040 + \let\,=\asis
9.3041 + \let\"=\asis
9.3042 + \let\`=\asis
9.3043 + \let\'=\asis
9.3044 + \let\^=\asis
9.3045 + \let\~=\asis
9.3046 + \let\==\asis
9.3047 + \let\u=\asis
9.3048 + \let\v=\asis
9.3049 + \let\H=\asis
9.3050 + \let\dotaccent=\asis
9.3051 + \let\ringaccent=\asis
9.3052 + \let\tieaccent=\asis
9.3053 + \let\ubaraccent=\asis
9.3054 + \let\udotaccent=\asis
9.3055 + \let\dotless=\asis
9.3056 + %
9.3057 + % Other non-English letters.
9.3058 + \def\AA{AA}%
9.3059 + \def\AE{AE}%
9.3060 + \def\L{L}%
9.3061 + \def\OE{OE}%
9.3062 + \def\O{O}%
9.3063 + \def\aa{aa}%
9.3064 + \def\ae{ae}%
9.3065 + \def\l{l}%
9.3066 + \def\oe{oe}%
9.3067 + \def\o{o}%
9.3068 + \def\ss{ss}%
9.3069 + \def\exclamdown{!}%
9.3070 + \def\questiondown{?}%
9.3071 + %
9.3072 + % Don't no-op \tt, since it isn't a user-level command
9.3073 + % and is used in the definitions of the active chars like <, >, |, etc.
9.3074 + % Likewise with the other plain tex font commands.
9.3075 + %\let\tt=\asis
9.3076 + %
9.3077 + % Texinfo font commands.
9.3078 + \let\b=\asis
9.3079 + \let\i=\asis
9.3080 + \let\r=\asis
9.3081 + \let\sc=\asis
9.3082 + \let\t=\asis
9.3083 + %
9.3084 + \let\TeX=\indexdummytex
9.3085 + \let\acronym=\asis
9.3086 + \let\cite=\asis
9.3087 + \let\code=\asis
9.3088 + \let\command=\asis
9.3089 + \let\dfn=\asis
9.3090 + \let\dots=\indexdummydots
9.3091 + \let\emph=\asis
9.3092 + \let\env=\asis
9.3093 + \let\file=\asis
9.3094 + \let\kbd=\asis
9.3095 + \let\key=\asis
9.3096 + \let\math=\asis
9.3097 + \let\option=\asis
9.3098 + \let\samp=\asis
9.3099 + \let\strong=\asis
9.3100 + \let\uref=\asis
9.3101 + \let\url=\asis
9.3102 + \let\var=\asis
9.3103 + \let\w=\asis
9.3104 +}
9.3105 +
9.3106 +\let\indexbackslash=0 %overridden during \printindex.
9.3107 +\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
9.3108 +
9.3109 +% For \ifx comparisons.
9.3110 +\def\emptymacro{\empty}
9.3111 +
9.3112 +% Most index entries go through here, but \dosubind is the general case.
9.3113 +%
9.3114 +\def\doind#1#2{\dosubind{#1}{#2}\empty}
9.3115 +
9.3116 +% Workhorse for all \fooindexes.
9.3117 +% #1 is name of index, #2 is stuff to put there, #3 is subentry --
9.3118 +% \empty if called from \doind, as we usually are. The main exception
9.3119 +% is with defuns, which call us directly.
9.3120 +%
9.3121 +\def\dosubind#1#2#3{%
9.3122 + % Put the index entry in the margin if desired.
9.3123 + \ifx\SETmarginindex\relax\else
9.3124 + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
9.3125 + \fi
9.3126 + {%
9.3127 + \count255=\lastpenalty
9.3128 + {%
9.3129 + \indexdummies % Must do this here, since \bf, etc expand at this stage
9.3130 + \escapechar=`\\
9.3131 + {%
9.3132 + \let\folio = 0% We will expand all macros now EXCEPT \folio.
9.3133 + \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
9.3134 + % so it will be output as is; and it will print as backslash.
9.3135 + %
9.3136 + % The main index entry text.
9.3137 + \toks0 = {#2}%
9.3138 + %
9.3139 + % If third arg is present, precede it with space in sort key.
9.3140 + \def\thirdarg{#3}%
9.3141 + \ifx\thirdarg\emptymacro \else
9.3142 + % If the third (subentry) arg is present, add it to the index
9.3143 + % line to write.
9.3144 + \toks0 = \expandafter{\the\toks0 \space #3}%
9.3145 + \fi
9.3146 + %
9.3147 + % Process the index entry with all font commands turned off, to
9.3148 + % get the string to sort by.
9.3149 + {\indexnofonts
9.3150 + \edef\temp{\the\toks0}% need full expansion
9.3151 + \xdef\indexsorttmp{\temp}%
9.3152 + }%
9.3153 + %
9.3154 + % Set up the complete index entry, with both the sort key and
9.3155 + % the original text, including any font commands. We write
9.3156 + % three arguments to \entry to the .?? file (four in the
9.3157 + % subentry case), texindex reduces to two when writing the .??s
9.3158 + % sorted result.
9.3159 + \edef\temp{%
9.3160 + \write\csname#1indfile\endcsname{%
9.3161 + \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
9.3162 + }%
9.3163 + %
9.3164 + % If a skip is the last thing on the list now, preserve it
9.3165 + % by backing up by \lastskip, doing the \write, then inserting
9.3166 + % the skip again. Otherwise, the whatsit generated by the
9.3167 + % \write will make \lastskip zero. The result is that sequences
9.3168 + % like this:
9.3169 + % @end defun
9.3170 + % @tindex whatever
9.3171 + % @defun ...
9.3172 + % will have extra space inserted, because the \medbreak in the
9.3173 + % start of the @defun won't see the skip inserted by the @end of
9.3174 + % the previous defun.
9.3175 + %
9.3176 + % But don't do any of this if we're not in vertical mode. We
9.3177 + % don't want to do a \vskip and prematurely end a paragraph.
9.3178 + %
9.3179 + % Avoid page breaks due to these extra skips, too.
9.3180 + %
9.3181 + \iflinks
9.3182 + \ifvmode
9.3183 + \skip0 = \lastskip
9.3184 + \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
9.3185 + \fi
9.3186 + %
9.3187 + \temp % do the write
9.3188 + %
9.3189 + \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
9.3190 + \fi
9.3191 + }%
9.3192 + }%
9.3193 + \penalty\count255
9.3194 + }%
9.3195 +}
9.3196 +
9.3197 +% The index entry written in the file actually looks like
9.3198 +% \entry {sortstring}{page}{topic}
9.3199 +% or
9.3200 +% \entry {sortstring}{page}{topic}{subtopic}
9.3201 +% The texindex program reads in these files and writes files
9.3202 +% containing these kinds of lines:
9.3203 +% \initial {c}
9.3204 +% before the first topic whose initial is c
9.3205 +% \entry {topic}{pagelist}
9.3206 +% for a topic that is used without subtopics
9.3207 +% \primary {topic}
9.3208 +% for the beginning of a topic that is used with subtopics
9.3209 +% \secondary {subtopic}{pagelist}
9.3210 +% for each subtopic.
9.3211 +
9.3212 +% Define the user-accessible indexing commands
9.3213 +% @findex, @vindex, @kindex, @cindex.
9.3214 +
9.3215 +\def\findex {\fnindex}
9.3216 +\def\kindex {\kyindex}
9.3217 +\def\cindex {\cpindex}
9.3218 +\def\vindex {\vrindex}
9.3219 +\def\tindex {\tpindex}
9.3220 +\def\pindex {\pgindex}
9.3221 +
9.3222 +\def\cindexsub {\begingroup\obeylines\cindexsub}
9.3223 +{\obeylines %
9.3224 +\gdef\cindexsub "#1" #2^^M{\endgroup %
9.3225 +\dosubind{cp}{#2}{#1}}}
9.3226 +
9.3227 +% Define the macros used in formatting output of the sorted index material.
9.3228 +
9.3229 +% @printindex causes a particular index (the ??s file) to get printed.
9.3230 +% It does not print any chapter heading (usually an @unnumbered).
9.3231 +%
9.3232 +\def\printindex{\parsearg\doprintindex}
9.3233 +\def\doprintindex#1{\begingroup
9.3234 + \dobreak \chapheadingskip{10000}%
9.3235 + %
9.3236 + \smallfonts \rm
9.3237 + \tolerance = 9500
9.3238 + \everypar = {}% don't want the \kern\-parindent from indentation suppression.
9.3239 + \indexbreaks
9.3240 + %
9.3241 + % See if the index file exists and is nonempty.
9.3242 + % Change catcode of @ here so that if the index file contains
9.3243 + % \initial {@}
9.3244 + % as its first line, TeX doesn't complain about mismatched braces
9.3245 + % (because it thinks @} is a control sequence).
9.3246 + \catcode`\@ = 11
9.3247 + \openin 1 \jobname.#1s
9.3248 + \ifeof 1
9.3249 + % \enddoublecolumns gets confused if there is no text in the index,
9.3250 + % and it loses the chapter title and the aux file entries for the
9.3251 + % index. The easiest way to prevent this problem is to make sure
9.3252 + % there is some text.
9.3253 + \putwordIndexNonexistent
9.3254 + \else
9.3255 + %
9.3256 + % If the index file exists but is empty, then \openin leaves \ifeof
9.3257 + % false. We have to make TeX try to read something from the file, so
9.3258 + % it can discover if there is anything in it.
9.3259 + \read 1 to \temp
9.3260 + \ifeof 1
9.3261 + \putwordIndexIsEmpty
9.3262 + \else
9.3263 + % Index files are almost Texinfo source, but we use \ as the escape
9.3264 + % character. It would be better to use @, but that's too big a change
9.3265 + % to make right now.
9.3266 + \def\indexbackslash{\rawbackslashxx}%
9.3267 + \catcode`\\ = 0
9.3268 + \escapechar = `\\
9.3269 + \begindoublecolumns
9.3270 + \input \jobname.#1s
9.3271 + \enddoublecolumns
9.3272 + \fi
9.3273 + \fi
9.3274 + \closein 1
9.3275 +\endgroup}
9.3276 +
9.3277 +% These macros are used by the sorted index file itself.
9.3278 +% Change them to control the appearance of the index.
9.3279 +
9.3280 +\def\initial#1{{%
9.3281 + % Some minor font changes for the special characters.
9.3282 + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
9.3283 + %
9.3284 + % Remove any glue we may have, we'll be inserting our own.
9.3285 + \removelastskip
9.3286 + %
9.3287 + % We like breaks before the index initials, so insert a bonus.
9.3288 + \penalty -300
9.3289 + %
9.3290 + % Typeset the initial. Making this add up to a whole number of
9.3291 + % baselineskips increases the chance of the dots lining up from column
9.3292 + % to column. It still won't often be perfect, because of the stretch
9.3293 + % we need before each entry, but it's better.
9.3294 + %
9.3295 + % No shrink because it confuses \balancecolumns.
9.3296 + \vskip 1.67\baselineskip plus .5\baselineskip
9.3297 + \leftline{\secbf #1}%
9.3298 + \vskip .33\baselineskip plus .1\baselineskip
9.3299 + %
9.3300 + % Do our best not to break after the initial.
9.3301 + \nobreak
9.3302 +}}
9.3303 +
9.3304 +% This typesets a paragraph consisting of #1, dot leaders, and then #2
9.3305 +% flush to the right margin. It is used for index and table of contents
9.3306 +% entries. The paragraph is indented by \leftskip.
9.3307 +%
9.3308 +\def\entry#1#2{\begingroup
9.3309 + %
9.3310 + % Start a new paragraph if necessary, so our assignments below can't
9.3311 + % affect previous text.
9.3312 + \par
9.3313 + %
9.3314 + % Do not fill out the last line with white space.
9.3315 + \parfillskip = 0in
9.3316 + %
9.3317 + % No extra space above this paragraph.
9.3318 + \parskip = 0in
9.3319 + %
9.3320 + % Do not prefer a separate line ending with a hyphen to fewer lines.
9.3321 + \finalhyphendemerits = 0
9.3322 + %
9.3323 + % \hangindent is only relevant when the entry text and page number
9.3324 + % don't both fit on one line. In that case, bob suggests starting the
9.3325 + % dots pretty far over on the line. Unfortunately, a large
9.3326 + % indentation looks wrong when the entry text itself is broken across
9.3327 + % lines. So we use a small indentation and put up with long leaders.
9.3328 + %
9.3329 + % \hangafter is reset to 1 (which is the value we want) at the start
9.3330 + % of each paragraph, so we need not do anything with that.
9.3331 + \hangindent = 2em
9.3332 + %
9.3333 + % When the entry text needs to be broken, just fill out the first line
9.3334 + % with blank space.
9.3335 + \rightskip = 0pt plus1fil
9.3336 + %
9.3337 + % A bit of stretch before each entry for the benefit of balancing columns.
9.3338 + \vskip 0pt plus1pt
9.3339 + %
9.3340 + % Start a ``paragraph'' for the index entry so the line breaking
9.3341 + % parameters we've set above will have an effect.
9.3342 + \noindent
9.3343 + %
9.3344 + % Insert the text of the index entry. TeX will do line-breaking on it.
9.3345 + #1%
9.3346 + % The following is kludged to not output a line of dots in the index if
9.3347 + % there are no page numbers. The next person who breaks this will be
9.3348 + % cursed by a Unix daemon.
9.3349 + \def\tempa{{\rm }}%
9.3350 + \def\tempb{#2}%
9.3351 + \edef\tempc{\tempa}%
9.3352 + \edef\tempd{\tempb}%
9.3353 + \ifx\tempc\tempd\ \else%
9.3354 + %
9.3355 + % If we must, put the page number on a line of its own, and fill out
9.3356 + % this line with blank space. (The \hfil is overwhelmed with the
9.3357 + % fill leaders glue in \indexdotfill if the page number does fit.)
9.3358 + \hfil\penalty50
9.3359 + \null\nobreak\indexdotfill % Have leaders before the page number.
9.3360 + %
9.3361 + % The `\ ' here is removed by the implicit \unskip that TeX does as
9.3362 + % part of (the primitive) \par. Without it, a spurious underfull
9.3363 + % \hbox ensues.
9.3364 + \ifpdf
9.3365 + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
9.3366 + \else
9.3367 + \ #2% The page number ends the paragraph.
9.3368 + \fi
9.3369 + \fi%
9.3370 + \par
9.3371 +\endgroup}
9.3372 +
9.3373 +% Like \dotfill except takes at least 1 em.
9.3374 +\def\indexdotfill{\cleaders
9.3375 + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
9.3376 +
9.3377 +\def\primary #1{\line{#1\hfil}}
9.3378 +
9.3379 +\newskip\secondaryindent \secondaryindent=0.5cm
9.3380 +\def\secondary#1#2{{%
9.3381 + \parfillskip=0in
9.3382 + \parskip=0in
9.3383 + \hangindent=1in
9.3384 + \hangafter=1
9.3385 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
9.3386 + \ifpdf
9.3387 + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
9.3388 + \else
9.3389 + #2
9.3390 + \fi
9.3391 + \par
9.3392 +}}
9.3393 +
9.3394 +% Define two-column mode, which we use to typeset indexes.
9.3395 +% Adapted from the TeXbook, page 416, which is to say,
9.3396 +% the manmac.tex format used to print the TeXbook itself.
9.3397 +\catcode`\@=11
9.3398 +
9.3399 +\newbox\partialpage
9.3400 +\newdimen\doublecolumnhsize
9.3401 +
9.3402 +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
9.3403 + % Grab any single-column material above us.
9.3404 + \output = {%
9.3405 + %
9.3406 + % Here is a possibility not foreseen in manmac: if we accumulate a
9.3407 + % whole lot of material, we might end up calling this \output
9.3408 + % routine twice in a row (see the doublecol-lose test, which is
9.3409 + % essentially a couple of indexes with @setchapternewpage off). In
9.3410 + % that case we just ship out what is in \partialpage with the normal
9.3411 + % output routine. Generally, \partialpage will be empty when this
9.3412 + % runs and this will be a no-op. See the indexspread.tex test case.
9.3413 + \ifvoid\partialpage \else
9.3414 + \onepageout{\pagecontents\partialpage}%
9.3415 + \fi
9.3416 + %
9.3417 + \global\setbox\partialpage = \vbox{%
9.3418 + % Unvbox the main output page.
9.3419 + \unvbox\PAGE
9.3420 + \kern-\topskip \kern\baselineskip
9.3421 + }%
9.3422 + }%
9.3423 + \eject % run that output routine to set \partialpage
9.3424 + %
9.3425 + % Use the double-column output routine for subsequent pages.
9.3426 + \output = {\doublecolumnout}%
9.3427 + %
9.3428 + % Change the page size parameters. We could do this once outside this
9.3429 + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
9.3430 + % format, but then we repeat the same computation. Repeating a couple
9.3431 + % of assignments once per index is clearly meaningless for the
9.3432 + % execution time, so we may as well do it in one place.
9.3433 + %
9.3434 + % First we halve the line length, less a little for the gutter between
9.3435 + % the columns. We compute the gutter based on the line length, so it
9.3436 + % changes automatically with the paper format. The magic constant
9.3437 + % below is chosen so that the gutter has the same value (well, +-<1pt)
9.3438 + % as it did when we hard-coded it.
9.3439 + %
9.3440 + % We put the result in a separate register, \doublecolumhsize, so we
9.3441 + % can restore it in \pagesofar, after \hsize itself has (potentially)
9.3442 + % been clobbered.
9.3443 + %
9.3444 + \doublecolumnhsize = \hsize
9.3445 + \advance\doublecolumnhsize by -.04154\hsize
9.3446 + \divide\doublecolumnhsize by 2
9.3447 + \hsize = \doublecolumnhsize
9.3448 + %
9.3449 + % Double the \vsize as well. (We don't need a separate register here,
9.3450 + % since nobody clobbers \vsize.)
9.3451 + \vsize = 2\vsize
9.3452 +}
9.3453 +
9.3454 +% The double-column output routine for all double-column pages except
9.3455 +% the last.
9.3456 +%
9.3457 +\def\doublecolumnout{%
9.3458 + \splittopskip=\topskip \splitmaxdepth=\maxdepth
9.3459 + % Get the available space for the double columns -- the normal
9.3460 + % (undoubled) page height minus any material left over from the
9.3461 + % previous page.
9.3462 + \dimen@ = \vsize
9.3463 + \divide\dimen@ by 2
9.3464 + \advance\dimen@ by -\ht\partialpage
9.3465 + %
9.3466 + % box0 will be the left-hand column, box2 the right.
9.3467 + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
9.3468 + \onepageout\pagesofar
9.3469 + \unvbox255
9.3470 + \penalty\outputpenalty
9.3471 +}
9.3472 +%
9.3473 +% Re-output the contents of the output page -- any previous material,
9.3474 +% followed by the two boxes we just split, in box0 and box2.
9.3475 +\def\pagesofar{%
9.3476 + \unvbox\partialpage
9.3477 + %
9.3478 + \hsize = \doublecolumnhsize
9.3479 + \wd0=\hsize \wd2=\hsize
9.3480 + \hbox to\pagewidth{\box0\hfil\box2}%
9.3481 +}
9.3482 +%
9.3483 +% All done with double columns.
9.3484 +\def\enddoublecolumns{%
9.3485 + \output = {%
9.3486 + % Split the last of the double-column material. Leave it on the
9.3487 + % current page, no automatic page break.
9.3488 + \balancecolumns
9.3489 + %
9.3490 + % If we end up splitting too much material for the current page,
9.3491 + % though, there will be another page break right after this \output
9.3492 + % invocation ends. Having called \balancecolumns once, we do not
9.3493 + % want to call it again. Therefore, reset \output to its normal
9.3494 + % definition right away. (We hope \balancecolumns will never be
9.3495 + % called on to balance too much material, but if it is, this makes
9.3496 + % the output somewhat more palatable.)
9.3497 + \global\output = {\onepageout{\pagecontents\PAGE}}%
9.3498 + }%
9.3499 + \eject
9.3500 + \endgroup % started in \begindoublecolumns
9.3501 + %
9.3502 + % \pagegoal was set to the doubled \vsize above, since we restarted
9.3503 + % the current page. We're now back to normal single-column
9.3504 + % typesetting, so reset \pagegoal to the normal \vsize (after the
9.3505 + % \endgroup where \vsize got restored).
9.3506 + \pagegoal = \vsize
9.3507 +}
9.3508 +%
9.3509 +% Called at the end of the double column material.
9.3510 +\def\balancecolumns{%
9.3511 + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
9.3512 + \dimen@ = \ht0
9.3513 + \advance\dimen@ by \topskip
9.3514 + \advance\dimen@ by-\baselineskip
9.3515 + \divide\dimen@ by 2 % target to split to
9.3516 + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
9.3517 + \splittopskip = \topskip
9.3518 + % Loop until we get a decent breakpoint.
9.3519 + {%
9.3520 + \vbadness = 10000
9.3521 + \loop
9.3522 + \global\setbox3 = \copy0
9.3523 + \global\setbox1 = \vsplit3 to \dimen@
9.3524 + \ifdim\ht3>\dimen@
9.3525 + \global\advance\dimen@ by 1pt
9.3526 + \repeat
9.3527 + }%
9.3528 + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
9.3529 + \setbox0=\vbox to\dimen@{\unvbox1}%
9.3530 + \setbox2=\vbox to\dimen@{\unvbox3}%
9.3531 + %
9.3532 + \pagesofar
9.3533 +}
9.3534 +\catcode`\@ = \other
9.3535 +
9.3536 +
9.3537 +\message{sectioning,}
9.3538 +% Chapters, sections, etc.
9.3539 +
9.3540 +\newcount\chapno
9.3541 +\newcount\secno \secno=0
9.3542 +\newcount\subsecno \subsecno=0
9.3543 +\newcount\subsubsecno \subsubsecno=0
9.3544 +
9.3545 +% This counter is funny since it counts through charcodes of letters A, B, ...
9.3546 +\newcount\appendixno \appendixno = `\@
9.3547 +% \def\appendixletter{\char\the\appendixno}
9.3548 +% We do the following for the sake of pdftex, which needs the actual
9.3549 +% letter in the expansion, not just typeset.
9.3550 +\def\appendixletter{%
9.3551 + \ifnum\appendixno=`A A%
9.3552 + \else\ifnum\appendixno=`B B%
9.3553 + \else\ifnum\appendixno=`C C%
9.3554 + \else\ifnum\appendixno=`D D%
9.3555 + \else\ifnum\appendixno=`E E%
9.3556 + \else\ifnum\appendixno=`F F%
9.3557 + \else\ifnum\appendixno=`G G%
9.3558 + \else\ifnum\appendixno=`H H%
9.3559 + \else\ifnum\appendixno=`I I%
9.3560 + \else\ifnum\appendixno=`J J%
9.3561 + \else\ifnum\appendixno=`K K%
9.3562 + \else\ifnum\appendixno=`L L%
9.3563 + \else\ifnum\appendixno=`M M%
9.3564 + \else\ifnum\appendixno=`N N%
9.3565 + \else\ifnum\appendixno=`O O%
9.3566 + \else\ifnum\appendixno=`P P%
9.3567 + \else\ifnum\appendixno=`Q Q%
9.3568 + \else\ifnum\appendixno=`R R%
9.3569 + \else\ifnum\appendixno=`S S%
9.3570 + \else\ifnum\appendixno=`T T%
9.3571 + \else\ifnum\appendixno=`U U%
9.3572 + \else\ifnum\appendixno=`V V%
9.3573 + \else\ifnum\appendixno=`W W%
9.3574 + \else\ifnum\appendixno=`X X%
9.3575 + \else\ifnum\appendixno=`Y Y%
9.3576 + \else\ifnum\appendixno=`Z Z%
9.3577 + % The \the is necessary, despite appearances, because \appendixletter is
9.3578 + % expanded while writing the .toc file. \char\appendixno is not
9.3579 + % expandable, thus it is written literally, thus all appendixes come out
9.3580 + % with the same letter (or @) in the toc without it.
9.3581 + \else\char\the\appendixno
9.3582 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
9.3583 + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
9.3584 +
9.3585 +% Each @chapter defines this as the name of the chapter.
9.3586 +% page headings and footings can use it. @section does likewise.
9.3587 +\def\thischapter{}
9.3588 +\def\thissection{}
9.3589 +
9.3590 +\newcount\absseclevel % used to calculate proper heading level
9.3591 +\newcount\secbase\secbase=0 % @raise/lowersections modify this count
9.3592 +
9.3593 +% @raisesections: treat @section as chapter, @subsection as section, etc.
9.3594 +\def\raisesections{\global\advance\secbase by -1}
9.3595 +\let\up=\raisesections % original BFox name
9.3596 +
9.3597 +% @lowersections: treat @chapter as section, @section as subsection, etc.
9.3598 +\def\lowersections{\global\advance\secbase by 1}
9.3599 +\let\down=\lowersections % original BFox name
9.3600 +
9.3601 +% Choose a numbered-heading macro
9.3602 +% #1 is heading level if unmodified by @raisesections or @lowersections
9.3603 +% #2 is text for heading
9.3604 +\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
9.3605 +\ifcase\absseclevel
9.3606 + \chapterzzz{#2}
9.3607 +\or
9.3608 + \seczzz{#2}
9.3609 +\or
9.3610 + \numberedsubseczzz{#2}
9.3611 +\or
9.3612 + \numberedsubsubseczzz{#2}
9.3613 +\else
9.3614 + \ifnum \absseclevel<0
9.3615 + \chapterzzz{#2}
9.3616 + \else
9.3617 + \numberedsubsubseczzz{#2}
9.3618 + \fi
9.3619 +\fi
9.3620 +\suppressfirstparagraphindent
9.3621 +}
9.3622 +
9.3623 +% like \numhead, but chooses appendix heading levels
9.3624 +\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
9.3625 +\ifcase\absseclevel
9.3626 + \appendixzzz{#2}
9.3627 +\or
9.3628 + \appendixsectionzzz{#2}
9.3629 +\or
9.3630 + \appendixsubseczzz{#2}
9.3631 +\or
9.3632 + \appendixsubsubseczzz{#2}
9.3633 +\else
9.3634 + \ifnum \absseclevel<0
9.3635 + \appendixzzz{#2}
9.3636 + \else
9.3637 + \appendixsubsubseczzz{#2}
9.3638 + \fi
9.3639 +\fi
9.3640 +\suppressfirstparagraphindent
9.3641 +}
9.3642 +
9.3643 +% like \numhead, but chooses numberless heading levels
9.3644 +\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
9.3645 +\ifcase\absseclevel
9.3646 + \unnumberedzzz{#2}
9.3647 +\or
9.3648 + \unnumberedseczzz{#2}
9.3649 +\or
9.3650 + \unnumberedsubseczzz{#2}
9.3651 +\or
9.3652 + \unnumberedsubsubseczzz{#2}
9.3653 +\else
9.3654 + \ifnum \absseclevel<0
9.3655 + \unnumberedzzz{#2}
9.3656 + \else
9.3657 + \unnumberedsubsubseczzz{#2}
9.3658 + \fi
9.3659 +\fi
9.3660 +\suppressfirstparagraphindent
9.3661 +}
9.3662 +
9.3663 +% @chapter, @appendix, @unnumbered.
9.3664 +\def\thischaptername{No Chapter Title}
9.3665 +\outer\def\chapter{\parsearg\chapteryyy}
9.3666 +\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
9.3667 +\def\chapterzzz #1{%
9.3668 + \secno=0 \subsecno=0 \subsubsecno=0
9.3669 + \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
9.3670 + \chapmacro {#1}{\the\chapno}%
9.3671 + \gdef\thissection{#1}%
9.3672 + \gdef\thischaptername{#1}%
9.3673 + % We don't substitute the actual chapter name into \thischapter
9.3674 + % because we don't want its macros evaluated now.
9.3675 + \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
9.3676 + \writetocentry{chap}{#1}{{\the\chapno}}
9.3677 + \donoderef
9.3678 + \global\let\section = \numberedsec
9.3679 + \global\let\subsection = \numberedsubsec
9.3680 + \global\let\subsubsection = \numberedsubsubsec
9.3681 +}
9.3682 +
9.3683 +% we use \chapno to avoid indenting back
9.3684 +\def\appendixbox#1{%
9.3685 + \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
9.3686 + \hbox to \wd0{#1\hss}}
9.3687 +
9.3688 +\outer\def\appendix{\parsearg\appendixyyy}
9.3689 +\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
9.3690 +\def\appendixzzz #1{%
9.3691 + \secno=0 \subsecno=0 \subsubsecno=0
9.3692 + \global\advance \appendixno by 1
9.3693 + \message{\putwordAppendix\space \appendixletter}%
9.3694 + \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
9.3695 + \gdef\thissection{#1}%
9.3696 + \gdef\thischaptername{#1}%
9.3697 + \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
9.3698 + \writetocentry{appendix}{#1}{{\appendixletter}}
9.3699 + \appendixnoderef
9.3700 + \global\let\section = \appendixsec
9.3701 + \global\let\subsection = \appendixsubsec
9.3702 + \global\let\subsubsection = \appendixsubsubsec
9.3703 +}
9.3704 +
9.3705 +% @centerchap is like @unnumbered, but the heading is centered.
9.3706 +\outer\def\centerchap{\parsearg\centerchapyyy}
9.3707 +\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
9.3708 +
9.3709 +% @top is like @unnumbered.
9.3710 +\outer\def\top{\parsearg\unnumberedyyy}
9.3711 +
9.3712 +\outer\def\unnumbered{\parsearg\unnumberedyyy}
9.3713 +\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
9.3714 +\def\unnumberedzzz #1{%
9.3715 + \secno=0 \subsecno=0 \subsubsecno=0
9.3716 + %
9.3717 + % This used to be simply \message{#1}, but TeX fully expands the
9.3718 + % argument to \message. Therefore, if #1 contained @-commands, TeX
9.3719 + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
9.3720 + % expanded @cite (which turns out to cause errors because \cite is meant
9.3721 + % to be executed, not expanded).
9.3722 + %
9.3723 + % Anyway, we don't want the fully-expanded definition of @cite to appear
9.3724 + % as a result of the \message, we just want `@cite' itself. We use
9.3725 + % \the<toks register> to achieve this: TeX expands \the<toks> only once,
9.3726 + % simply yielding the contents of <toks register>. (We also do this for
9.3727 + % the toc entries.)
9.3728 + \toks0 = {#1}\message{(\the\toks0)}%
9.3729 + %
9.3730 + \unnumbchapmacro {#1}%
9.3731 + \gdef\thischapter{#1}\gdef\thissection{#1}%
9.3732 + \writetocentry{unnumbchap}{#1}{{\the\chapno}}
9.3733 + \unnumbnoderef
9.3734 + \global\let\section = \unnumberedsec
9.3735 + \global\let\subsection = \unnumberedsubsec
9.3736 + \global\let\subsubsection = \unnumberedsubsubsec
9.3737 +}
9.3738 +
9.3739 +% Sections.
9.3740 +\outer\def\numberedsec{\parsearg\secyyy}
9.3741 +\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
9.3742 +\def\seczzz #1{%
9.3743 + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
9.3744 + \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
9.3745 + \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
9.3746 + \donoderef
9.3747 + \nobreak
9.3748 +}
9.3749 +
9.3750 +\outer\def\appendixsection{\parsearg\appendixsecyyy}
9.3751 +\outer\def\appendixsec{\parsearg\appendixsecyyy}
9.3752 +\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
9.3753 +\def\appendixsectionzzz #1{%
9.3754 + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
9.3755 + \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
9.3756 + \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
9.3757 + \appendixnoderef
9.3758 + \nobreak
9.3759 +}
9.3760 +
9.3761 +\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
9.3762 +\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
9.3763 +\def\unnumberedseczzz #1{%
9.3764 + \plainsecheading {#1}\gdef\thissection{#1}%
9.3765 + \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
9.3766 + \unnumbnoderef
9.3767 + \nobreak
9.3768 +}
9.3769 +
9.3770 +% Subsections.
9.3771 +\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
9.3772 +\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
9.3773 +\def\numberedsubseczzz #1{%
9.3774 + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
9.3775 + \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
9.3776 + \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
9.3777 + \donoderef
9.3778 + \nobreak
9.3779 +}
9.3780 +
9.3781 +\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
9.3782 +\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
9.3783 +\def\appendixsubseczzz #1{%
9.3784 + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
9.3785 + \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
9.3786 + \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
9.3787 + \appendixnoderef
9.3788 + \nobreak
9.3789 +}
9.3790 +
9.3791 +\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
9.3792 +\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
9.3793 +\def\unnumberedsubseczzz #1{%
9.3794 + \plainsubsecheading {#1}\gdef\thissection{#1}%
9.3795 + \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
9.3796 + \unnumbnoderef
9.3797 + \nobreak
9.3798 +}
9.3799 +
9.3800 +% Subsubsections.
9.3801 +\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
9.3802 +\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
9.3803 +\def\numberedsubsubseczzz #1{%
9.3804 + \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
9.3805 + \subsubsecheading {#1}
9.3806 + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
9.3807 + \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
9.3808 + \donoderef
9.3809 + \nobreak
9.3810 +}
9.3811 +
9.3812 +\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
9.3813 +\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
9.3814 +\def\appendixsubsubseczzz #1{%
9.3815 + \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
9.3816 + \subsubsecheading {#1}
9.3817 + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
9.3818 + \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
9.3819 + \appendixnoderef
9.3820 + \nobreak
9.3821 +}
9.3822 +
9.3823 +\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
9.3824 +\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
9.3825 +\def\unnumberedsubsubseczzz #1{%
9.3826 + \plainsubsubsecheading {#1}\gdef\thissection{#1}%
9.3827 + \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
9.3828 + \unnumbnoderef
9.3829 + \nobreak
9.3830 +}
9.3831 +
9.3832 +% These are variants which are not "outer", so they can appear in @ifinfo.
9.3833 +% Actually, they should now be obsolete; ordinary section commands should work.
9.3834 +\def\infotop{\parsearg\unnumberedzzz}
9.3835 +\def\infounnumbered{\parsearg\unnumberedzzz}
9.3836 +\def\infounnumberedsec{\parsearg\unnumberedseczzz}
9.3837 +\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
9.3838 +\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
9.3839 +
9.3840 +\def\infoappendix{\parsearg\appendixzzz}
9.3841 +\def\infoappendixsec{\parsearg\appendixseczzz}
9.3842 +\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
9.3843 +\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
9.3844 +
9.3845 +\def\infochapter{\parsearg\chapterzzz}
9.3846 +\def\infosection{\parsearg\sectionzzz}
9.3847 +\def\infosubsection{\parsearg\subsectionzzz}
9.3848 +\def\infosubsubsection{\parsearg\subsubsectionzzz}
9.3849 +
9.3850 +% These macros control what the section commands do, according
9.3851 +% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
9.3852 +% Define them by default for a numbered chapter.
9.3853 +\global\let\section = \numberedsec
9.3854 +\global\let\subsection = \numberedsubsec
9.3855 +\global\let\subsubsection = \numberedsubsubsec
9.3856 +
9.3857 +% Define @majorheading, @heading and @subheading
9.3858 +
9.3859 +% NOTE on use of \vbox for chapter headings, section headings, and such:
9.3860 +% 1) We use \vbox rather than the earlier \line to permit
9.3861 +% overlong headings to fold.
9.3862 +% 2) \hyphenpenalty is set to 10000 because hyphenation in a
9.3863 +% heading is obnoxious; this forbids it.
9.3864 +% 3) Likewise, headings look best if no \parindent is used, and
9.3865 +% if justification is not attempted. Hence \raggedright.
9.3866 +
9.3867 +
9.3868 +\def\majorheading{%
9.3869 + {\advance\chapheadingskip by 10pt \chapbreak }%
9.3870 + \parsearg\chapheadingzzz
9.3871 +}
9.3872 +
9.3873 +\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
9.3874 +\def\chapheadingzzz #1{%
9.3875 + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
9.3876 + \parindent=0pt\raggedright
9.3877 + \rm #1\hfill}}%
9.3878 + \bigskip \par\penalty 200\relax
9.3879 + \suppressfirstparagraphindent
9.3880 +}
9.3881 +
9.3882 +% @heading, @subheading, @subsubheading.
9.3883 +\def\heading{\parsearg\doheading}
9.3884 +\def\subheading{\parsearg\dosubheading}
9.3885 +\def\subsubheading{\parsearg\dosubsubheading}
9.3886 +\def\doheading#1{\plainsecheading{#1}\suppressfirstparagraphindent}
9.3887 +\def\dosubheading#1{\plainsubsecheading{#1}\suppressfirstparagraphindent}
9.3888 +\def\dosubsubheading#1{\plainsubsubsecheading{#1}\suppressfirstparagraphindent}
9.3889 +
9.3890 +% These macros generate a chapter, section, etc. heading only
9.3891 +% (including whitespace, linebreaking, etc. around it),
9.3892 +% given all the information in convenient, parsed form.
9.3893 +
9.3894 +%%% Args are the skip and penalty (usually negative)
9.3895 +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
9.3896 +
9.3897 +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
9.3898 +
9.3899 +%%% Define plain chapter starts, and page on/off switching for it
9.3900 +% Parameter controlling skip before chapter headings (if needed)
9.3901 +
9.3902 +\newskip\chapheadingskip
9.3903 +
9.3904 +\def\chapbreak{\dobreak \chapheadingskip {-4000}}
9.3905 +\def\chappager{\par\vfill\supereject}
9.3906 +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
9.3907 +
9.3908 +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
9.3909 +
9.3910 +\def\CHAPPAGoff{%
9.3911 +\global\let\contentsalignmacro = \chappager
9.3912 +\global\let\pchapsepmacro=\chapbreak
9.3913 +\global\let\pagealignmacro=\chappager}
9.3914 +
9.3915 +\def\CHAPPAGon{%
9.3916 +\global\let\contentsalignmacro = \chappager
9.3917 +\global\let\pchapsepmacro=\chappager
9.3918 +\global\let\pagealignmacro=\chappager
9.3919 +\global\def\HEADINGSon{\HEADINGSsingle}}
9.3920 +
9.3921 +\def\CHAPPAGodd{
9.3922 +\global\let\contentsalignmacro = \chapoddpage
9.3923 +\global\let\pchapsepmacro=\chapoddpage
9.3924 +\global\let\pagealignmacro=\chapoddpage
9.3925 +\global\def\HEADINGSon{\HEADINGSdouble}}
9.3926 +
9.3927 +\CHAPPAGon
9.3928 +
9.3929 +\def\CHAPFplain{
9.3930 +\global\let\chapmacro=\chfplain
9.3931 +\global\let\unnumbchapmacro=\unnchfplain
9.3932 +\global\let\centerchapmacro=\centerchfplain}
9.3933 +
9.3934 +% Plain chapter opening.
9.3935 +% #1 is the text, #2 the chapter number or empty if unnumbered.
9.3936 +\def\chfplain#1#2{%
9.3937 + \pchapsepmacro
9.3938 + {%
9.3939 + \chapfonts \rm
9.3940 + \def\chapnum{#2}%
9.3941 + \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
9.3942 + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
9.3943 + \hangindent = \wd0 \centerparametersmaybe
9.3944 + \unhbox0 #1\par}%
9.3945 + }%
9.3946 + \nobreak\bigskip % no page break after a chapter title
9.3947 + \nobreak
9.3948 +}
9.3949 +
9.3950 +% Plain opening for unnumbered.
9.3951 +\def\unnchfplain#1{\chfplain{#1}{}}
9.3952 +
9.3953 +% @centerchap -- centered and unnumbered.
9.3954 +\let\centerparametersmaybe = \relax
9.3955 +\def\centerchfplain#1{{%
9.3956 + \def\centerparametersmaybe{%
9.3957 + \advance\rightskip by 3\rightskip
9.3958 + \leftskip = \rightskip
9.3959 + \parfillskip = 0pt
9.3960 + }%
9.3961 + \chfplain{#1}{}%
9.3962 +}}
9.3963 +
9.3964 +\CHAPFplain % The default
9.3965 +
9.3966 +\def\unnchfopen #1{%
9.3967 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
9.3968 + \parindent=0pt\raggedright
9.3969 + \rm #1\hfill}}\bigskip \par\nobreak
9.3970 +}
9.3971 +
9.3972 +\def\chfopen #1#2{\chapoddpage {\chapfonts
9.3973 +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
9.3974 +\par\penalty 5000 %
9.3975 +}
9.3976 +
9.3977 +\def\centerchfopen #1{%
9.3978 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
9.3979 + \parindent=0pt
9.3980 + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
9.3981 +}
9.3982 +
9.3983 +\def\CHAPFopen{
9.3984 +\global\let\chapmacro=\chfopen
9.3985 +\global\let\unnumbchapmacro=\unnchfopen
9.3986 +\global\let\centerchapmacro=\centerchfopen}
9.3987 +
9.3988 +
9.3989 +% Section titles.
9.3990 +\newskip\secheadingskip
9.3991 +\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
9.3992 +\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
9.3993 +\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
9.3994 +
9.3995 +% Subsection titles.
9.3996 +\newskip \subsecheadingskip
9.3997 +\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
9.3998 +\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
9.3999 +\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
9.4000 +
9.4001 +% Subsubsection titles.
9.4002 +\let\subsubsecheadingskip = \subsecheadingskip
9.4003 +\let\subsubsecheadingbreak = \subsecheadingbreak
9.4004 +\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
9.4005 +\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
9.4006 +
9.4007 +
9.4008 +% Print any size section title.
9.4009 +%
9.4010 +% #1 is the section type (sec/subsec/subsubsec), #2 is the section
9.4011 +% number (maybe empty), #3 the text.
9.4012 +\def\sectionheading#1#2#3{%
9.4013 + {%
9.4014 + \expandafter\advance\csname #1headingskip\endcsname by \parskip
9.4015 + \csname #1headingbreak\endcsname
9.4016 + }%
9.4017 + {%
9.4018 + % Switch to the right set of fonts.
9.4019 + \csname #1fonts\endcsname \rm
9.4020 + %
9.4021 + % Only insert the separating space if we have a section number.
9.4022 + \def\secnum{#2}%
9.4023 + \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
9.4024 + %
9.4025 + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
9.4026 + \hangindent = \wd0 % zero if no section number
9.4027 + \unhbox0 #3}%
9.4028 + }%
9.4029 + % Add extra space after the heading -- either a line space or a
9.4030 + % paragraph space, whichever is more. (Some people like to set
9.4031 + % \parskip to large values for some reason.) Don't allow stretch, though.
9.4032 + \nobreak
9.4033 + \ifdim\parskip>\normalbaselineskip
9.4034 + \kern\parskip
9.4035 + \else
9.4036 + \kern\normalbaselineskip
9.4037 + \fi
9.4038 + \nobreak
9.4039 +}
9.4040 +
9.4041 +
9.4042 +\message{toc,}
9.4043 +% Table of contents.
9.4044 +\newwrite\tocfile
9.4045 +
9.4046 +% Write an entry to the toc file, opening it if necessary.
9.4047 +% Called from @chapter, etc. We supply {\folio} at the end of the
9.4048 +% argument, which will end up as the last argument to the \...entry macro.
9.4049 +%
9.4050 +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
9.4051 +% We open the .toc file for writing here instead of at @setfilename (or
9.4052 +% any other fixed time) so that @contents can be anywhere in the document.
9.4053 +%
9.4054 +\newif\iftocfileopened
9.4055 +\def\writetocentry#1#2#3{%
9.4056 + \iftocfileopened\else
9.4057 + \immediate\openout\tocfile = \jobname.toc
9.4058 + \global\tocfileopenedtrue
9.4059 + \fi
9.4060 + %
9.4061 + \iflinks
9.4062 + \toks0 = {#2}%
9.4063 + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
9.4064 + \temp
9.4065 + \fi
9.4066 + %
9.4067 + % Tell \shipout to create a page destination if we're doing pdf, which
9.4068 + % will be the target of the links in the table of contents. We can't
9.4069 + % just do it on every page because the title pages are numbered 1 and
9.4070 + % 2 (the page numbers aren't printed), and so are the first two pages
9.4071 + % of the document. Thus, we'd have two destinations named `1', and
9.4072 + % two named `2'.
9.4073 + \ifpdf \pdfmakepagedesttrue \fi
9.4074 +}
9.4075 +
9.4076 +\newskip\contentsrightmargin \contentsrightmargin=1in
9.4077 +\newcount\savepageno
9.4078 +\newcount\lastnegativepageno \lastnegativepageno = -1
9.4079 +
9.4080 +% Finish up the main text and prepare to read what we've written
9.4081 +% to \tocfile.
9.4082 +%
9.4083 +\def\startcontents#1{%
9.4084 + % If @setchapternewpage on, and @headings double, the contents should
9.4085 + % start on an odd page, unlike chapters. Thus, we maintain
9.4086 + % \contentsalignmacro in parallel with \pagealignmacro.
9.4087 + % From: Torbjorn Granlund <tege@matematik.su.se>
9.4088 + \contentsalignmacro
9.4089 + \immediate\closeout\tocfile
9.4090 + %
9.4091 + % Don't need to put `Contents' or `Short Contents' in the headline.
9.4092 + % It is abundantly clear what they are.
9.4093 + \unnumbchapmacro{#1}\def\thischapter{}%
9.4094 + \savepageno = \pageno
9.4095 + \begingroup % Set up to handle contents files properly.
9.4096 + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
9.4097 + % We can't do this, because then an actual ^ in a section
9.4098 + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
9.4099 + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
9.4100 + \raggedbottom % Worry more about breakpoints than the bottom.
9.4101 + \advance\hsize by -\contentsrightmargin % Don't use the full line length.
9.4102 + %
9.4103 + % Roman numerals for page numbers.
9.4104 + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
9.4105 +}
9.4106 +
9.4107 +
9.4108 +% Normal (long) toc.
9.4109 +\def\contents{%
9.4110 + \startcontents{\putwordTOC}%
9.4111 + \openin 1 \jobname.toc
9.4112 + \ifeof 1 \else
9.4113 + \closein 1
9.4114 + \input \jobname.toc
9.4115 + \fi
9.4116 + \vfill \eject
9.4117 + \contentsalignmacro % in case @setchapternewpage odd is in effect
9.4118 + \pdfmakeoutlines
9.4119 + \endgroup
9.4120 + \lastnegativepageno = \pageno
9.4121 + \global\pageno = \savepageno
9.4122 +}
9.4123 +
9.4124 +% And just the chapters.
9.4125 +\def\summarycontents{%
9.4126 + \startcontents{\putwordShortTOC}%
9.4127 + %
9.4128 + \let\chapentry = \shortchapentry
9.4129 + \let\appendixentry = \shortappendixentry
9.4130 + \let\unnumbchapentry = \shortunnumberedentry
9.4131 + % We want a true roman here for the page numbers.
9.4132 + \secfonts
9.4133 + \let\rm=\shortcontrm \let\bf=\shortcontbf
9.4134 + \let\sl=\shortcontsl \let\tt=\shortconttt
9.4135 + \rm
9.4136 + \hyphenpenalty = 10000
9.4137 + \advance\baselineskip by 1pt % Open it up a little.
9.4138 + \def\secentry ##1##2##3##4{}
9.4139 + \def\subsecentry ##1##2##3##4##5{}
9.4140 + \def\subsubsecentry ##1##2##3##4##5##6{}
9.4141 + \let\unnumbsecentry = \secentry
9.4142 + \let\unnumbsubsecentry = \subsecentry
9.4143 + \let\unnumbsubsubsecentry = \subsubsecentry
9.4144 + \openin 1 \jobname.toc
9.4145 + \ifeof 1 \else
9.4146 + \closein 1
9.4147 + \input \jobname.toc
9.4148 + \fi
9.4149 + \vfill \eject
9.4150 + \contentsalignmacro % in case @setchapternewpage odd is in effect
9.4151 + \endgroup
9.4152 + \lastnegativepageno = \pageno
9.4153 + \global\pageno = \savepageno
9.4154 +}
9.4155 +\let\shortcontents = \summarycontents
9.4156 +
9.4157 +\ifpdf
9.4158 + \pdfcatalog{/PageMode /UseOutlines}%
9.4159 +\fi
9.4160 +
9.4161 +% These macros generate individual entries in the table of contents.
9.4162 +% The first argument is the chapter or section name.
9.4163 +% The last argument is the page number.
9.4164 +% The arguments in between are the chapter number, section number, ...
9.4165 +
9.4166 +% Chapters, in the main contents.
9.4167 +\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
9.4168 +%
9.4169 +% Chapters, in the short toc.
9.4170 +% See comments in \dochapentry re vbox and related settings.
9.4171 +\def\shortchapentry#1#2#3{%
9.4172 + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
9.4173 +}
9.4174 +
9.4175 +% Appendices, in the main contents.
9.4176 +\def\appendixentry#1#2#3{%
9.4177 + \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
9.4178 +%
9.4179 +% Appendices, in the short toc.
9.4180 +\let\shortappendixentry = \shortchapentry
9.4181 +
9.4182 +% Typeset the label for a chapter or appendix for the short contents.
9.4183 +% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
9.4184 +% We could simplify the code here by writing out an \appendixentry
9.4185 +% command in the toc file for appendices, instead of using \chapentry
9.4186 +% for both, but it doesn't seem worth it.
9.4187 +%
9.4188 +\newdimen\shortappendixwidth
9.4189 +%
9.4190 +\def\shortchaplabel#1{%
9.4191 + % This space should be enough, since a single number is .5em, and the
9.4192 + % widest letter (M) is 1em, at least in the Computer Modern fonts.
9.4193 + % But use \hss just in case.
9.4194 + % (This space doesn't include the extra space that gets added after
9.4195 + % the label; that gets put in by \shortchapentry above.)
9.4196 + \dimen0 = 1em
9.4197 + \hbox to \dimen0{#1\hss}%
9.4198 +}
9.4199 +
9.4200 +% Unnumbered chapters.
9.4201 +\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
9.4202 +\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
9.4203 +
9.4204 +% Sections.
9.4205 +\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
9.4206 +\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
9.4207 +
9.4208 +% Subsections.
9.4209 +\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
9.4210 +\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
9.4211 +
9.4212 +% And subsubsections.
9.4213 +\def\subsubsecentry#1#2#3#4#5#6{%
9.4214 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
9.4215 +\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
9.4216 +
9.4217 +% This parameter controls the indentation of the various levels.
9.4218 +\newdimen\tocindent \tocindent = 3pc
9.4219 +
9.4220 +% Now for the actual typesetting. In all these, #1 is the text and #2 is the
9.4221 +% page number.
9.4222 +%
9.4223 +% If the toc has to be broken over pages, we want it to be at chapters
9.4224 +% if at all possible; hence the \penalty.
9.4225 +\def\dochapentry#1#2{%
9.4226 + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
9.4227 + \begingroup
9.4228 + \chapentryfonts
9.4229 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
9.4230 + \endgroup
9.4231 + \nobreak\vskip .25\baselineskip plus.1\baselineskip
9.4232 +}
9.4233 +
9.4234 +\def\dosecentry#1#2{\begingroup
9.4235 + \secentryfonts \leftskip=\tocindent
9.4236 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
9.4237 +\endgroup}
9.4238 +
9.4239 +\def\dosubsecentry#1#2{\begingroup
9.4240 + \subsecentryfonts \leftskip=2\tocindent
9.4241 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
9.4242 +\endgroup}
9.4243 +
9.4244 +\def\dosubsubsecentry#1#2{\begingroup
9.4245 + \subsubsecentryfonts \leftskip=3\tocindent
9.4246 + \tocentry{#1}{\dopageno\bgroup#2\egroup}%
9.4247 +\endgroup}
9.4248 +
9.4249 +% Final typesetting of a toc entry; we use the same \entry macro as for
9.4250 +% the index entries, but we want to suppress hyphenation here. (We
9.4251 +% can't do that in the \entry macro, since index entries might consist
9.4252 +% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
9.4253 +\def\tocentry#1#2{\begingroup
9.4254 + \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
9.4255 + % Do not use \turnoffactive in these arguments. Since the toc is
9.4256 + % typeset in cmr, characters such as _ would come out wrong; we
9.4257 + % have to do the usual translation tricks.
9.4258 + \entry{#1}{#2}%
9.4259 +\endgroup}
9.4260 +
9.4261 +% Space between chapter (or whatever) number and the title.
9.4262 +\def\labelspace{\hskip1em \relax}
9.4263 +
9.4264 +\def\dopageno#1{{\rm #1}}
9.4265 +\def\doshortpageno#1{{\rm #1}}
9.4266 +
9.4267 +\def\chapentryfonts{\secfonts \rm}
9.4268 +\def\secentryfonts{\textfonts}
9.4269 +\let\subsecentryfonts = \textfonts
9.4270 +\let\subsubsecentryfonts = \textfonts
9.4271 +
9.4272 +
9.4273 +\message{environments,}
9.4274 +% @foo ... @end foo.
9.4275 +
9.4276 +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
9.4277 +%
9.4278 +% Since these characters are used in examples, it should be an even number of
9.4279 +% \tt widths. Each \tt character is 1en, so two makes it 1em.
9.4280 +%
9.4281 +\def\point{$\star$}
9.4282 +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
9.4283 +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
9.4284 +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
9.4285 +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
9.4286 +
9.4287 +% The @error{} command.
9.4288 +% Adapted from the TeXbook's \boxit.
9.4289 +%
9.4290 +\newbox\errorbox
9.4291 +%
9.4292 +{\tentt \global\dimen0 = 3em}% Width of the box.
9.4293 +\dimen2 = .55pt % Thickness of rules
9.4294 +% The text. (`r' is open on the right, `e' somewhat less so on the left.)
9.4295 +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
9.4296 +%
9.4297 +\global\setbox\errorbox=\hbox to \dimen0{\hfil
9.4298 + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
9.4299 + \advance\hsize by -2\dimen2 % Rules.
9.4300 + \vbox{
9.4301 + \hrule height\dimen2
9.4302 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
9.4303 + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
9.4304 + \kern3pt\vrule width\dimen2}% Space to right.
9.4305 + \hrule height\dimen2}
9.4306 + \hfil}
9.4307 +%
9.4308 +\def\error{\leavevmode\lower.7ex\copy\errorbox}
9.4309 +
9.4310 +% @tex ... @end tex escapes into raw Tex temporarily.
9.4311 +% One exception: @ is still an escape character, so that @end tex works.
9.4312 +% But \@ or @@ will get a plain tex @ character.
9.4313 +
9.4314 +\def\tex{\begingroup
9.4315 + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
9.4316 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
9.4317 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
9.4318 + \catcode `\%=14
9.4319 + \catcode `\+=\other
9.4320 + \catcode `\"=\other
9.4321 + \catcode `\==\other
9.4322 + \catcode `\|=\other
9.4323 + \catcode `\<=\other
9.4324 + \catcode `\>=\other
9.4325 + \escapechar=`\\
9.4326 + %
9.4327 + \let\b=\ptexb
9.4328 + \let\bullet=\ptexbullet
9.4329 + \let\c=\ptexc
9.4330 + \let\,=\ptexcomma
9.4331 + \let\.=\ptexdot
9.4332 + \let\dots=\ptexdots
9.4333 + \let\equiv=\ptexequiv
9.4334 + \let\!=\ptexexclam
9.4335 + \let\i=\ptexi
9.4336 + \let\indent=\ptexindent
9.4337 + \let\{=\ptexlbrace
9.4338 + \let\+=\tabalign
9.4339 + \let\}=\ptexrbrace
9.4340 + \let\/=\ptexslash
9.4341 + \let\*=\ptexstar
9.4342 + \let\t=\ptext
9.4343 + %
9.4344 + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
9.4345 + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
9.4346 + \def\@{@}%
9.4347 +\let\Etex=\endgroup}
9.4348 +
9.4349 +% Define @lisp ... @end lisp.
9.4350 +% @lisp does a \begingroup so it can rebind things,
9.4351 +% including the definition of @end lisp (which normally is erroneous).
9.4352 +
9.4353 +% Amount to narrow the margins by for @lisp.
9.4354 +\newskip\lispnarrowing \lispnarrowing=0.4in
9.4355 +
9.4356 +% This is the definition that ^^M gets inside @lisp, @example, and other
9.4357 +% such environments. \null is better than a space, since it doesn't
9.4358 +% have any width.
9.4359 +\def\lisppar{\null\endgraf}
9.4360 +
9.4361 +% Make each space character in the input produce a normal interword
9.4362 +% space in the output. Don't allow a line break at this space, as this
9.4363 +% is used only in environments like @example, where each line of input
9.4364 +% should produce a line of output anyway.
9.4365 +%
9.4366 +{\obeyspaces %
9.4367 +\gdef\sepspaces{\obeyspaces\let =\tie}}
9.4368 +
9.4369 +% Define \obeyedspace to be our active space, whatever it is. This is
9.4370 +% for use in \parsearg.
9.4371 +{\sepspaces%
9.4372 +\global\let\obeyedspace= }
9.4373 +
9.4374 +% This space is always present above and below environments.
9.4375 +\newskip\envskipamount \envskipamount = 0pt
9.4376 +
9.4377 +% Make spacing and below environment symmetrical. We use \parskip here
9.4378 +% to help in doing that, since in @example-like environments \parskip
9.4379 +% is reset to zero; thus the \afterenvbreak inserts no space -- but the
9.4380 +% start of the next paragraph will insert \parskip.
9.4381 +%
9.4382 +\def\aboveenvbreak{{%
9.4383 + % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
9.4384 + \ifnum \lastpenalty=10000 \else
9.4385 + \advance\envskipamount by \parskip
9.4386 + \endgraf
9.4387 + \ifdim\lastskip<\envskipamount
9.4388 + \removelastskip
9.4389 + % it's not a good place to break if the last penalty was \nobreak
9.4390 + % or better ...
9.4391 + \ifnum\lastpenalty>10000 \else \penalty-50 \fi
9.4392 + \vskip\envskipamount
9.4393 + \fi
9.4394 + \fi
9.4395 +}}
9.4396 +
9.4397 +\let\afterenvbreak = \aboveenvbreak
9.4398 +
9.4399 +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
9.4400 +\let\nonarrowing=\relax
9.4401 +
9.4402 +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
9.4403 +% environment contents.
9.4404 +\font\circle=lcircle10
9.4405 +\newdimen\circthick
9.4406 +\newdimen\cartouter\newdimen\cartinner
9.4407 +\newskip\normbskip\newskip\normpskip\newskip\normlskip
9.4408 +\circthick=\fontdimen8\circle
9.4409 +%
9.4410 +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
9.4411 +\def\ctr{{\hskip 6pt\circle\char'010}}
9.4412 +\def\cbl{{\circle\char'012\hskip -6pt}}
9.4413 +\def\cbr{{\hskip 6pt\circle\char'011}}
9.4414 +\def\carttop{\hbox to \cartouter{\hskip\lskip
9.4415 + \ctl\leaders\hrule height\circthick\hfil\ctr
9.4416 + \hskip\rskip}}
9.4417 +\def\cartbot{\hbox to \cartouter{\hskip\lskip
9.4418 + \cbl\leaders\hrule height\circthick\hfil\cbr
9.4419 + \hskip\rskip}}
9.4420 +%
9.4421 +\newskip\lskip\newskip\rskip
9.4422 +
9.4423 +\def\cartouche{%
9.4424 +\par % can't be in the midst of a paragraph.
9.4425 +\begingroup
9.4426 + \lskip=\leftskip \rskip=\rightskip
9.4427 + \leftskip=0pt\rightskip=0pt %we want these *outside*.
9.4428 + \cartinner=\hsize \advance\cartinner by-\lskip
9.4429 + \advance\cartinner by-\rskip
9.4430 + \cartouter=\hsize
9.4431 + \advance\cartouter by 18.4pt % allow for 3pt kerns on either
9.4432 +% side, and for 6pt waste from
9.4433 +% each corner char, and rule thickness
9.4434 + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
9.4435 + % Flag to tell @lisp, etc., not to narrow margin.
9.4436 + \let\nonarrowing=\comment
9.4437 + \vbox\bgroup
9.4438 + \baselineskip=0pt\parskip=0pt\lineskip=0pt
9.4439 + \carttop
9.4440 + \hbox\bgroup
9.4441 + \hskip\lskip
9.4442 + \vrule\kern3pt
9.4443 + \vbox\bgroup
9.4444 + \hsize=\cartinner
9.4445 + \kern3pt
9.4446 + \begingroup
9.4447 + \baselineskip=\normbskip
9.4448 + \lineskip=\normlskip
9.4449 + \parskip=\normpskip
9.4450 + \vskip -\parskip
9.4451 +\def\Ecartouche{%
9.4452 + \endgroup
9.4453 + \kern3pt
9.4454 + \egroup
9.4455 + \kern3pt\vrule
9.4456 + \hskip\rskip
9.4457 + \egroup
9.4458 + \cartbot
9.4459 + \egroup
9.4460 +\endgroup
9.4461 +}}
9.4462 +
9.4463 +
9.4464 +% This macro is called at the beginning of all the @example variants,
9.4465 +% inside a group.
9.4466 +\def\nonfillstart{%
9.4467 + \aboveenvbreak
9.4468 + \inENV % This group ends at the end of the body
9.4469 + \hfuzz = 12pt % Don't be fussy
9.4470 + \sepspaces % Make spaces be word-separators rather than space tokens.
9.4471 + \let\par = \lisppar % don't ignore blank lines
9.4472 + \obeylines % each line of input is a line of output
9.4473 + \parskip = 0pt
9.4474 + \parindent = 0pt
9.4475 + \emergencystretch = 0pt % don't try to avoid overfull boxes
9.4476 + % @cartouche defines \nonarrowing to inhibit narrowing
9.4477 + % at next level down.
9.4478 + \ifx\nonarrowing\relax
9.4479 + \advance \leftskip by \lispnarrowing
9.4480 + \exdentamount=\lispnarrowing
9.4481 + \let\exdent=\nofillexdent
9.4482 + \let\nonarrowing=\relax
9.4483 + \fi
9.4484 +}
9.4485 +
9.4486 +% Define the \E... control sequence only if we are inside the particular
9.4487 +% environment, so the error checking in \end will work.
9.4488 +%
9.4489 +% To end an @example-like environment, we first end the paragraph (via
9.4490 +% \afterenvbreak's vertical glue), and then the group. That way we keep
9.4491 +% the zero \parskip that the environments set -- \parskip glue will be
9.4492 +% inserted at the beginning of the next paragraph in the document, after
9.4493 +% the environment.
9.4494 +%
9.4495 +\def\nonfillfinish{\afterenvbreak\endgroup}
9.4496 +
9.4497 +% @lisp: indented, narrowed, typewriter font.
9.4498 +\def\lisp{\begingroup
9.4499 + \nonfillstart
9.4500 + \let\Elisp = \nonfillfinish
9.4501 + \tt
9.4502 + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
9.4503 + \gobble % eat return
9.4504 +}
9.4505 +
9.4506 +% @example: Same as @lisp.
9.4507 +\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
9.4508 +
9.4509 +% @smallexample and @smalllisp: use smaller fonts.
9.4510 +% Originally contributed by Pavel@xerox.
9.4511 +\def\smalllisp{\begingroup
9.4512 + \def\Esmalllisp{\nonfillfinish\endgroup}%
9.4513 + \def\Esmallexample{\nonfillfinish\endgroup}%
9.4514 + \smallexamplefonts
9.4515 + \lisp
9.4516 +}
9.4517 +\let\smallexample = \smalllisp
9.4518 +
9.4519 +
9.4520 +% @display: same as @lisp except keep current font.
9.4521 +%
9.4522 +\def\display{\begingroup
9.4523 + \nonfillstart
9.4524 + \let\Edisplay = \nonfillfinish
9.4525 + \gobble
9.4526 +}
9.4527 +%
9.4528 +% @smalldisplay: @display plus smaller fonts.
9.4529 +%
9.4530 +\def\smalldisplay{\begingroup
9.4531 + \def\Esmalldisplay{\nonfillfinish\endgroup}%
9.4532 + \smallexamplefonts \rm
9.4533 + \display
9.4534 +}
9.4535 +
9.4536 +% @format: same as @display except don't narrow margins.
9.4537 +%
9.4538 +\def\format{\begingroup
9.4539 + \let\nonarrowing = t
9.4540 + \nonfillstart
9.4541 + \let\Eformat = \nonfillfinish
9.4542 + \gobble
9.4543 +}
9.4544 +%
9.4545 +% @smallformat: @format plus smaller fonts.
9.4546 +%
9.4547 +\def\smallformat{\begingroup
9.4548 + \def\Esmallformat{\nonfillfinish\endgroup}%
9.4549 + \smallexamplefonts \rm
9.4550 + \format
9.4551 +}
9.4552 +
9.4553 +% @flushleft (same as @format).
9.4554 +%
9.4555 +\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
9.4556 +
9.4557 +% @flushright.
9.4558 +%
9.4559 +\def\flushright{\begingroup
9.4560 + \let\nonarrowing = t
9.4561 + \nonfillstart
9.4562 + \let\Eflushright = \nonfillfinish
9.4563 + \advance\leftskip by 0pt plus 1fill
9.4564 + \gobble
9.4565 +}
9.4566 +
9.4567 +
9.4568 +% @quotation does normal linebreaking (hence we can't use \nonfillstart)
9.4569 +% and narrows the margins.
9.4570 +%
9.4571 +\def\quotation{%
9.4572 + \begingroup\inENV %This group ends at the end of the @quotation body
9.4573 + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
9.4574 + \parindent=0pt
9.4575 + % We have retained a nonzero parskip for the environment, since we're
9.4576 + % doing normal filling. So to avoid extra space below the environment...
9.4577 + \def\Equotation{\parskip = 0pt \nonfillfinish}%
9.4578 + %
9.4579 + % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
9.4580 + \ifx\nonarrowing\relax
9.4581 + \advance\leftskip by \lispnarrowing
9.4582 + \advance\rightskip by \lispnarrowing
9.4583 + \exdentamount = \lispnarrowing
9.4584 + \let\nonarrowing = \relax
9.4585 + \fi
9.4586 +}
9.4587 +
9.4588 +
9.4589 +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
9.4590 +% If we want to allow any <char> as delimiter,
9.4591 +% we need the curly braces so that makeinfo sees the @verb command, eg:
9.4592 +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
9.4593 +%
9.4594 +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
9.4595 +%
9.4596 +% [Knuth] p.344; only we need to do the other characters Texinfo sets
9.4597 +% active too. Otherwise, they get lost as the first character on a
9.4598 +% verbatim line.
9.4599 +\def\dospecials{%
9.4600 + \do\ \do\\\do\{\do\}\do\$\do\&%
9.4601 + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
9.4602 + \do\<\do\>\do\|\do\@\do+\do\"%
9.4603 +}
9.4604 +%
9.4605 +% [Knuth] p. 380
9.4606 +\def\uncatcodespecials{%
9.4607 + \def\do##1{\catcode`##1=12}\dospecials}
9.4608 +%
9.4609 +% [Knuth] pp. 380,381,391
9.4610 +% Disable Spanish ligatures ?` and !` of \tt font
9.4611 +\begingroup
9.4612 + \catcode`\`=\active\gdef`{\relax\lq}
9.4613 +\endgroup
9.4614 +%
9.4615 +% Setup for the @verb command.
9.4616 +%
9.4617 +% Eight spaces for a tab
9.4618 +\begingroup
9.4619 + \catcode`\^^I=\active
9.4620 + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
9.4621 +\endgroup
9.4622 +%
9.4623 +\def\setupverb{%
9.4624 + \tt % easiest (and conventionally used) font for verbatim
9.4625 + \def\par{\leavevmode\endgraf}%
9.4626 + \catcode`\`=\active
9.4627 + \tabeightspaces
9.4628 + % Respect line breaks,
9.4629 + % print special symbols as themselves, and
9.4630 + % make each space count
9.4631 + % must do in this order:
9.4632 + \obeylines \uncatcodespecials \sepspaces
9.4633 +}
9.4634 +
9.4635 +% Setup for the @verbatim environment
9.4636 +%
9.4637 +% Real tab expansion
9.4638 +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
9.4639 +%
9.4640 +\def\starttabbox{\setbox0=\hbox\bgroup}
9.4641 +\begingroup
9.4642 + \catcode`\^^I=\active
9.4643 + \gdef\tabexpand{%
9.4644 + \catcode`\^^I=\active
9.4645 + \def^^I{\leavevmode\egroup
9.4646 + \dimen0=\wd0 % the width so far, or since the previous tab
9.4647 + \divide\dimen0 by\tabw
9.4648 + \multiply\dimen0 by\tabw % compute previous multiple of \tabw
9.4649 + \advance\dimen0 by\tabw % advance to next multiple of \tabw
9.4650 + \wd0=\dimen0 \box0 \starttabbox
9.4651 + }%
9.4652 + }
9.4653 +\endgroup
9.4654 +\def\setupverbatim{%
9.4655 + % Easiest (and conventionally used) font for verbatim
9.4656 + \tt
9.4657 + \def\par{\leavevmode\egroup\box0\endgraf}%
9.4658 + \catcode`\`=\active
9.4659 + \tabexpand
9.4660 + % Respect line breaks,
9.4661 + % print special symbols as themselves, and
9.4662 + % make each space count
9.4663 + % must do in this order:
9.4664 + \obeylines \uncatcodespecials \sepspaces
9.4665 + \everypar{\starttabbox}%
9.4666 +}
9.4667 +
9.4668 +% Do the @verb magic: verbatim text is quoted by unique
9.4669 +% delimiter characters. Before first delimiter expect a
9.4670 +% right brace, after last delimiter expect closing brace:
9.4671 +%
9.4672 +% \def\doverb'{'<char>#1<char>'}'{#1}
9.4673 +%
9.4674 +% [Knuth] p. 382; only eat outer {}
9.4675 +\begingroup
9.4676 + \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
9.4677 + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
9.4678 +\endgroup
9.4679 +%
9.4680 +\def\verb{\begingroup\setupverb\doverb}
9.4681 +%
9.4682 +%
9.4683 +% Do the @verbatim magic: define the macro \doverbatim so that
9.4684 +% the (first) argument ends when '@end verbatim' is reached, ie:
9.4685 +%
9.4686 +% \def\doverbatim#1@end verbatim{#1}
9.4687 +%
9.4688 +% For Texinfo it's a lot easier than for LaTeX,
9.4689 +% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
9.4690 +% we need not redefine '\', '{' and '}'.
9.4691 +%
9.4692 +% Inspired by LaTeX's verbatim command set [latex.ltx]
9.4693 +%% Include LaTeX hack for completeness -- never know
9.4694 +%% \begingroup
9.4695 +%% \catcode`|=0 \catcode`[=1
9.4696 +%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
9.4697 +%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
9.4698 +%% #1|endgroup|def|Everbatim[]|end[verbatim]]
9.4699 +%% |endgroup
9.4700 +%
9.4701 +\begingroup
9.4702 + \catcode`\ =\active
9.4703 + \obeylines %
9.4704 + % ignore everything up to the first ^^M, that's the newline at the end
9.4705 + % of the @verbatim input line itself. Otherwise we get an extra blank
9.4706 + % line in the output.
9.4707 + \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
9.4708 +\endgroup
9.4709 +%
9.4710 +\def\verbatim{%
9.4711 + \def\Everbatim{\nonfillfinish\endgroup}%
9.4712 + \begingroup
9.4713 + \nonfillstart
9.4714 + \advance\leftskip by -\defbodyindent
9.4715 + \begingroup\setupverbatim\doverbatim
9.4716 +}
9.4717 +
9.4718 +% @verbatiminclude FILE - insert text of file in verbatim environment.
9.4719 +%
9.4720 +% Allow normal characters that we make active in the argument (a file name).
9.4721 +\def\verbatiminclude{%
9.4722 + \begingroup
9.4723 + \catcode`\\=\other
9.4724 + \catcode`~=\other
9.4725 + \catcode`^=\other
9.4726 + \catcode`_=\other
9.4727 + \catcode`|=\other
9.4728 + \catcode`<=\other
9.4729 + \catcode`>=\other
9.4730 + \catcode`+=\other
9.4731 + \parsearg\doverbatiminclude
9.4732 +}
9.4733 +\def\setupverbatiminclude{%
9.4734 + \begingroup
9.4735 + \nonfillstart
9.4736 + \advance\leftskip by -\defbodyindent
9.4737 + \begingroup\setupverbatim
9.4738 +}
9.4739 +%
9.4740 +\def\doverbatiminclude#1{%
9.4741 + % Restore active chars for included file.
9.4742 + \endgroup
9.4743 + \begingroup
9.4744 + \let\value=\expandablevalue
9.4745 + \def\thisfile{#1}%
9.4746 + \expandafter\expandafter\setupverbatiminclude\input\thisfile
9.4747 + \endgroup
9.4748 + \nonfillfinish
9.4749 + \endgroup
9.4750 +}
9.4751 +
9.4752 +% @copying ... @end copying.
9.4753 +% Save the text away for @insertcopying later. Many commands won't be
9.4754 +% allowed in this context, but that's ok.
9.4755 +%
9.4756 +% We save the uninterpreted tokens, rather than creating a box.
9.4757 +% Saving the text in a box would be much easier, but then all the
9.4758 +% typesetting commands (@smallbook, font changes, etc.) have to be done
9.4759 +% beforehand -- and a) we want @copying to be done first in the source
9.4760 +% file; b) letting users define the frontmatter in as flexible order as
9.4761 +% possible is very desirable.
9.4762 +%
9.4763 +\def\copying{\begingroup
9.4764 + % Define a command to swallow text until we reach `@end copying'.
9.4765 + % \ is the escape char in this texinfo.tex file, so it is the
9.4766 + % delimiter for the command; @ will be the escape char when we read
9.4767 + % it, but that doesn't matter.
9.4768 + \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
9.4769 + %
9.4770 + % We must preserve ^^M's in the input file; see \insertcopying below.
9.4771 + \catcode`\^^M = \active
9.4772 + \docopying
9.4773 +}
9.4774 +
9.4775 +% What we do to finish off the copying text.
9.4776 +%
9.4777 +\def\enddocopying{\endgroup\ignorespaces}
9.4778 +
9.4779 +% @insertcopying. Here we must play games with ^^M's. On the one hand,
9.4780 +% we need them to delimit commands such as `@end quotation', so they
9.4781 +% must be active. On the other hand, we certainly don't want every
9.4782 +% end-of-line to be a \par, as would happen with the normal active
9.4783 +% definition of ^^M. On the third hand, two ^^M's in a row should still
9.4784 +% generate a \par.
9.4785 +%
9.4786 +% Our approach is to make ^^M insert a space and a penalty1 normally;
9.4787 +% then it can also check if \lastpenalty=1. If it does, then manually
9.4788 +% do \par.
9.4789 +%
9.4790 +% This messes up the normal definitions of @c[omment], so we redefine
9.4791 +% it. Similarly for @ignore. (These commands are used in the gcc
9.4792 +% manual for man page generation.)
9.4793 +%
9.4794 +% Seems pretty fragile, most line-oriented commands will presumably
9.4795 +% fail, but for the limited use of getting the copying text (which
9.4796 +% should be quite simple) inserted, we can hope it's ok.
9.4797 +%
9.4798 +{\catcode`\^^M=\active %
9.4799 +\gdef\insertcopying{\begingroup %
9.4800 + \parindent = 0pt % looks wrong on title page
9.4801 + \def^^M{%
9.4802 + \ifnum \lastpenalty=1 %
9.4803 + \par %
9.4804 + \else %
9.4805 + \space \penalty 1 %
9.4806 + \fi %
9.4807 + }%
9.4808 + %
9.4809 + % Fix @c[omment] for catcode 13 ^^M's.
9.4810 + \def\c##1^^M{\ignorespaces}%
9.4811 + \let\comment = \c %
9.4812 + %
9.4813 + % Don't bother jumping through all the hoops that \doignore does, it
9.4814 + % would be very hard since the catcodes are already set.
9.4815 + \long\def\ignore##1\end ignore{\ignorespaces}%
9.4816 + %
9.4817 + \copyingtext %
9.4818 +\endgroup}%
9.4819 +}
9.4820 +
9.4821 +\message{defuns,}
9.4822 +% @defun etc.
9.4823 +
9.4824 +% Allow user to change definition object font (\df) internally
9.4825 +\def\setdeffont#1 {\csname DEF#1\endcsname}
9.4826 +
9.4827 +\newskip\defbodyindent \defbodyindent=.4in
9.4828 +\newskip\defargsindent \defargsindent=50pt
9.4829 +\newskip\deflastargmargin \deflastargmargin=18pt
9.4830 +
9.4831 +\newcount\parencount
9.4832 +
9.4833 +% We want ()&[] to print specially on the defun line.
9.4834 +%
9.4835 +\def\activeparens{%
9.4836 + \catcode`\(=\active \catcode`\)=\active
9.4837 + \catcode`\&=\active
9.4838 + \catcode`\[=\active \catcode`\]=\active
9.4839 +}
9.4840 +
9.4841 +% Make control sequences which act like normal parenthesis chars.
9.4842 +\let\lparen = ( \let\rparen = )
9.4843 +
9.4844 +{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
9.4845 +
9.4846 +% Be sure that we always have a definition for `(', etc. For example,
9.4847 +% if the fn name has parens in it, \boldbrax will not be in effect yet,
9.4848 +% so TeX would otherwise complain about undefined control sequence.
9.4849 +\global\let(=\lparen \global\let)=\rparen
9.4850 +\global\let[=\lbrack \global\let]=\rbrack
9.4851 +
9.4852 +\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
9.4853 +\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
9.4854 +% This is used to turn on special parens
9.4855 +% but make & act ordinary (given that it's active).
9.4856 +\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
9.4857 +
9.4858 +% Definitions of (, ) and & used in args for functions.
9.4859 +% This is the definition of ( outside of all parentheses.
9.4860 +\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
9.4861 + \global\advance\parencount by 1
9.4862 +}
9.4863 +%
9.4864 +% This is the definition of ( when already inside a level of parens.
9.4865 +\gdef\opnested{\char`\(\global\advance\parencount by 1 }
9.4866 +%
9.4867 +\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
9.4868 + % also in that case restore the outer-level definition of (.
9.4869 + \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
9.4870 + \global\advance \parencount by -1 }
9.4871 +% If we encounter &foo, then turn on ()-hacking afterwards
9.4872 +\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
9.4873 +%
9.4874 +\gdef\normalparens{\boldbrax\let&=\ampnr}
9.4875 +} % End of definition inside \activeparens
9.4876 +%% These parens (in \boldbrax) actually are a little bolder than the
9.4877 +%% contained text. This is especially needed for [ and ]
9.4878 +\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
9.4879 +\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
9.4880 +\let\ampnr = \&
9.4881 +\def\lbrb{{\bf\char`\[}}
9.4882 +\def\rbrb{{\bf\char`\]}}
9.4883 +
9.4884 +% Active &'s sneak into the index arguments, so make sure it's defined.
9.4885 +{
9.4886 + \catcode`& = \active
9.4887 + \global\let& = \ampnr
9.4888 +}
9.4889 +
9.4890 +% \defname, which formats the name of the @def (not the args).
9.4891 +% #1 is the function name.
9.4892 +% #2 is the type of definition, such as "Function".
9.4893 +%
9.4894 +\def\defname#1#2{%
9.4895 + % How we'll output the type name. Putting it in brackets helps
9.4896 + % distinguish it from the body text that may end up on the next line
9.4897 + % just below it.
9.4898 + \ifempty{#2}%
9.4899 + \def\defnametype{}%
9.4900 + \else
9.4901 + \def\defnametype{[\rm #2]}%
9.4902 + \fi
9.4903 + %
9.4904 + % Get the values of \leftskip and \rightskip as they were outside the @def...
9.4905 + \dimen2=\leftskip
9.4906 + \advance\dimen2 by -\defbodyindent
9.4907 + %
9.4908 + % Figure out values for the paragraph shape.
9.4909 + \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
9.4910 + \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
9.4911 + \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations
9.4912 + \parshape 2 0in \dimen0 \defargsindent \dimen1
9.4913 + %
9.4914 + % Output arg 2 ("Function" or some such) but stuck inside a box of
9.4915 + % width 0 so it does not interfere with linebreaking.
9.4916 + \noindent
9.4917 + %
9.4918 + {% Adjust \hsize to exclude the ambient margins,
9.4919 + % so that \rightline will obey them.
9.4920 + \advance \hsize by -\dimen2
9.4921 + \dimen3 = 0pt % was -1.25pc
9.4922 + \rlap{\rightline{\defnametype\kern\dimen3}}%
9.4923 + }%
9.4924 + %
9.4925 + % Allow all lines to be underfull without complaint:
9.4926 + \tolerance=10000 \hbadness=10000
9.4927 + \advance\leftskip by -\defbodyindent
9.4928 + \exdentamount=\defbodyindent
9.4929 + {\df #1}\enskip % output function name
9.4930 + % \defunargs will be called next to output the arguments, if any.
9.4931 +}
9.4932 +
9.4933 +% Common pieces to start any @def...
9.4934 +% #1 is the \E... control sequence to end the definition (which we define).
9.4935 +% #2 is the \...x control sequence (which our caller defines).
9.4936 +% #3 is the control sequence to process the header, such as \defunheader.
9.4937 +%
9.4938 +\def\parsebodycommon#1#2#3{%
9.4939 + \begingroup\inENV
9.4940 + % If there are two @def commands in a row, we'll have a \nobreak,
9.4941 + % which is there to keep the function description together with its
9.4942 + % header. But if there's nothing but headers, we want to allow a
9.4943 + % break after all. Check for penalty 10002 (inserted by
9.4944 + % \defargscommonending) instead of 10000, since the sectioning
9.4945 + % commands insert a \penalty10000, and we don't want to allow a break
9.4946 + % between a section heading and a defun.
9.4947 + \ifnum\lastpenalty=10002 \penalty0 \fi
9.4948 + \medbreak
9.4949 + %
9.4950 + % Define the \E... end token that this defining construct specifies
9.4951 + % so that it will exit this group.
9.4952 + \def#1{\endgraf\endgroup\medbreak}%
9.4953 + %
9.4954 + \parindent=0in
9.4955 + \advance\leftskip by \defbodyindent
9.4956 + \exdentamount=\defbodyindent
9.4957 +}
9.4958 +
9.4959 +% Common part of the \...x definitions.
9.4960 +%
9.4961 +\def\defxbodycommon{%
9.4962 + % As with \parsebodycommon above, allow line break if we have multiple
9.4963 + % x headers in a row. It's not a great place, though.
9.4964 + \ifnum\lastpenalty=10000 \penalty1000 \fi
9.4965 + %
9.4966 + \begingroup\obeylines
9.4967 +}
9.4968 +
9.4969 +% Process body of @defun, @deffn, @defmac, etc.
9.4970 +%
9.4971 +\def\defparsebody#1#2#3{%
9.4972 + \parsebodycommon{#1}{#2}{#3}%
9.4973 + \def#2{\defxbodycommon \activeparens \spacesplit#3}%
9.4974 + \catcode\equalChar=\active
9.4975 + \begingroup\obeylines\activeparens
9.4976 + \spacesplit#3%
9.4977 +}
9.4978 +
9.4979 +% #1, #2, #3 are the common arguments (see \parsebodycommon above).
9.4980 +% #4, delimited by the space, is the class name.
9.4981 +%
9.4982 +\def\defmethparsebody#1#2#3#4 {%
9.4983 + \parsebodycommon{#1}{#2}{#3}%
9.4984 + \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
9.4985 + \begingroup\obeylines\activeparens
9.4986 + % The \empty here prevents misinterpretation of a construct such as
9.4987 + % @deffn {whatever} {Enharmonic comma}
9.4988 + % See comments at \deftpparsebody, although in our case we don't have
9.4989 + % to remove the \empty afterwards, since it is empty.
9.4990 + \spacesplit{#3{#4}}\empty
9.4991 +}
9.4992 +
9.4993 +% Used for @deftypemethod and @deftypeivar.
9.4994 +% #1, #2, #3 are the common arguments (see \defparsebody).
9.4995 +% #4, delimited by a space, is the class name.
9.4996 +% #5 is the method's return type.
9.4997 +%
9.4998 +\def\deftypemethparsebody#1#2#3#4 #5 {%
9.4999 + \parsebodycommon{#1}{#2}{#3}%
9.5000 + \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
9.5001 + \begingroup\obeylines\activeparens
9.5002 + \spacesplit{#3{#4}{#5}}%
9.5003 +}
9.5004 +
9.5005 +% Used for @deftypeop. The change from \deftypemethparsebody is an
9.5006 +% extra argument at the beginning which is the `category', instead of it
9.5007 +% being the hardwired string `Method' or `Instance Variable'. We have
9.5008 +% to account for this both in the \...x definition and in parsing the
9.5009 +% input at hand. Thus also need a control sequence (passed as #5) for
9.5010 +% the \E... definition to assign the category name to.
9.5011 +%
9.5012 +\def\deftypeopparsebody#1#2#3#4#5 #6 {%
9.5013 + \parsebodycommon{#1}{#2}{#3}%
9.5014 + \def#2##1 ##2 ##3 {\def#4{##1}%
9.5015 + \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
9.5016 + \begingroup\obeylines\activeparens
9.5017 + \spacesplit{#3{#5}{#6}}%
9.5018 +}
9.5019 +
9.5020 +% For @defop.
9.5021 +\def\defopparsebody #1#2#3#4#5 {%
9.5022 + \parsebodycommon{#1}{#2}{#3}%
9.5023 + \def#2##1 ##2 {\def#4{##1}%
9.5024 + \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
9.5025 + \begingroup\obeylines\activeparens
9.5026 + \spacesplit{#3{#5}}%
9.5027 +}
9.5028 +
9.5029 +% These parsing functions are similar to the preceding ones
9.5030 +% except that they do not make parens into active characters.
9.5031 +% These are used for "variables" since they have no arguments.
9.5032 +%
9.5033 +\def\defvarparsebody #1#2#3{%
9.5034 + \parsebodycommon{#1}{#2}{#3}%
9.5035 + \def#2{\defxbodycommon \spacesplit#3}%
9.5036 + \catcode\equalChar=\active
9.5037 + \begingroup\obeylines
9.5038 + \spacesplit#3%
9.5039 +}
9.5040 +
9.5041 +% @defopvar.
9.5042 +\def\defopvarparsebody #1#2#3#4#5 {%
9.5043 + \parsebodycommon{#1}{#2}{#3}%
9.5044 + \def#2##1 ##2 {\def#4{##1}%
9.5045 + \defxbodycommon \spacesplit{#3{##2}}}%
9.5046 + \begingroup\obeylines
9.5047 + \spacesplit{#3{#5}}%
9.5048 +}
9.5049 +
9.5050 +\def\defvrparsebody#1#2#3#4 {%
9.5051 + \parsebodycommon{#1}{#2}{#3}%
9.5052 + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
9.5053 + \begingroup\obeylines
9.5054 + \spacesplit{#3{#4}}%
9.5055 +}
9.5056 +
9.5057 +% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
9.5058 +% type is just `struct', because we lose the braces in `{struct
9.5059 +% termios}' when \spacesplit reads its undelimited argument. Sigh.
9.5060 +% \let\deftpparsebody=\defvrparsebody
9.5061 +%
9.5062 +% So, to get around this, we put \empty in with the type name. That
9.5063 +% way, TeX won't find exactly `{...}' as an undelimited argument, and
9.5064 +% won't strip off the braces.
9.5065 +%
9.5066 +\def\deftpparsebody #1#2#3#4 {%
9.5067 + \parsebodycommon{#1}{#2}{#3}%
9.5068 + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
9.5069 + \begingroup\obeylines
9.5070 + \spacesplit{\parsetpheaderline{#3{#4}}}\empty
9.5071 +}
9.5072 +
9.5073 +% Fine, but then we have to eventually remove the \empty *and* the
9.5074 +% braces (if any). That's what this does.
9.5075 +%
9.5076 +\def\removeemptybraces\empty#1\relax{#1}
9.5077 +
9.5078 +% After \spacesplit has done its work, this is called -- #1 is the final
9.5079 +% thing to call, #2 the type name (which starts with \empty), and #3
9.5080 +% (which might be empty) the arguments.
9.5081 +%
9.5082 +\def\parsetpheaderline#1#2#3{%
9.5083 + #1{\removeemptybraces#2\relax}{#3}%
9.5084 +}%
9.5085 +
9.5086 +% Split up #2 (the rest of the input line) at the first space token.
9.5087 +% call #1 with two arguments:
9.5088 +% the first is all of #2 before the space token,
9.5089 +% the second is all of #2 after that space token.
9.5090 +% If #2 contains no space token, all of it is passed as the first arg
9.5091 +% and the second is passed as empty.
9.5092 +%
9.5093 +{\obeylines %
9.5094 + \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
9.5095 + \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
9.5096 + \ifx\relax #3%
9.5097 + #1{#2}{}%
9.5098 + \else %
9.5099 + #1{#2}{#3#4}%
9.5100 + \fi}%
9.5101 +}
9.5102 +
9.5103 +% Define @defun.
9.5104 +
9.5105 +% This is called to end the arguments processing for all the @def... commands.
9.5106 +%
9.5107 +\def\defargscommonending{%
9.5108 + \interlinepenalty = 10000
9.5109 + \advance\rightskip by 0pt plus 1fil
9.5110 + \endgraf
9.5111 + \nobreak\vskip -\parskip
9.5112 + \penalty 10002 % signal to \parsebodycommon.
9.5113 +}
9.5114 +
9.5115 +% This expands the args and terminates the paragraph they comprise.
9.5116 +%
9.5117 +\def\defunargs#1{\functionparens \sl
9.5118 +% Expand, preventing hyphenation at `-' chars.
9.5119 +% Note that groups don't affect changes in \hyphenchar.
9.5120 +% Set the font temporarily and use \font in case \setfont made \tensl a macro.
9.5121 +{\tensl\hyphenchar\font=0}%
9.5122 +#1%
9.5123 +{\tensl\hyphenchar\font=45}%
9.5124 +\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
9.5125 + \defargscommonending
9.5126 +}
9.5127 +
9.5128 +\def\deftypefunargs #1{%
9.5129 +% Expand, preventing hyphenation at `-' chars.
9.5130 +% Note that groups don't affect changes in \hyphenchar.
9.5131 +% Use \boldbraxnoamp, not \functionparens, so that & is not special.
9.5132 +\boldbraxnoamp
9.5133 +\tclose{#1}% avoid \code because of side effects on active chars
9.5134 + \defargscommonending
9.5135 +}
9.5136 +
9.5137 +% Do complete processing of one @defun or @defunx line already parsed.
9.5138 +
9.5139 +% @deffn Command forward-char nchars
9.5140 +
9.5141 +\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
9.5142 +
9.5143 +\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
9.5144 +\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
9.5145 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5146 +}
9.5147 +
9.5148 +% @defun == @deffn Function
9.5149 +
9.5150 +\def\defun{\defparsebody\Edefun\defunx\defunheader}
9.5151 +
9.5152 +\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
9.5153 +\begingroup\defname {#1}{\putwordDeffunc}%
9.5154 +\defunargs {#2}\endgroup %
9.5155 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5156 +}
9.5157 +
9.5158 +% @deftypefun int foobar (int @var{foo}, float @var{bar})
9.5159 +
9.5160 +\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
9.5161 +
9.5162 +% #1 is the data type. #2 is the name and args.
9.5163 +\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
9.5164 +% #1 is the data type, #2 the name, #3 the args.
9.5165 +\def\deftypefunheaderx #1#2 #3\relax{%
9.5166 +\doind {fn}{\code{#2}}% Make entry in function index
9.5167 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
9.5168 +\deftypefunargs {#3}\endgroup %
9.5169 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5170 +}
9.5171 +
9.5172 +% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
9.5173 +
9.5174 +\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
9.5175 +
9.5176 +% \defheaderxcond#1\relax$.$
9.5177 +% puts #1 in @code, followed by a space, but does nothing if #1 is null.
9.5178 +\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
9.5179 +
9.5180 +% #1 is the classification. #2 is the data type. #3 is the name and args.
9.5181 +\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
9.5182 +% #1 is the classification, #2 the data type, #3 the name, #4 the args.
9.5183 +\def\deftypefnheaderx #1#2#3 #4\relax{%
9.5184 +\doind {fn}{\code{#3}}% Make entry in function index
9.5185 +\begingroup
9.5186 +\normalparens % notably, turn off `&' magic, which prevents
9.5187 +% at least some C++ text from working
9.5188 +\defname {\defheaderxcond#2\relax$.$#3}{#1}%
9.5189 +\deftypefunargs {#4}\endgroup %
9.5190 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5191 +}
9.5192 +
9.5193 +% @defmac == @deffn Macro
9.5194 +
9.5195 +\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
9.5196 +
9.5197 +\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
9.5198 +\begingroup\defname {#1}{\putwordDefmac}%
9.5199 +\defunargs {#2}\endgroup %
9.5200 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5201 +}
9.5202 +
9.5203 +% @defspec == @deffn Special Form
9.5204 +
9.5205 +\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
9.5206 +
9.5207 +\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
9.5208 +\begingroup\defname {#1}{\putwordDefspec}%
9.5209 +\defunargs {#2}\endgroup %
9.5210 +\catcode\equalChar=\other % Turn off change made in \defparsebody
9.5211 +}
9.5212 +
9.5213 +% @defop CATEGORY CLASS OPERATION ARG...
9.5214 +%
9.5215 +\def\defop #1 {\def\defoptype{#1}%
9.5216 +\defopparsebody\Edefop\defopx\defopheader\defoptype}
9.5217 +%
9.5218 +\def\defopheader#1#2#3{%
9.5219 + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
9.5220 + \begingroup
9.5221 + \defname{#2}{\defoptype\ \putwordon\ #1}%
9.5222 + \defunargs{#3}%
9.5223 + \endgroup
9.5224 +}
9.5225 +
9.5226 +% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
9.5227 +%
9.5228 +\def\deftypeop #1 {\def\deftypeopcategory{#1}%
9.5229 + \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
9.5230 + \deftypeopcategory}
9.5231 +%
9.5232 +% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
9.5233 +\def\deftypeopheader#1#2#3#4{%
9.5234 + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
9.5235 + \begingroup
9.5236 + \defname{\defheaderxcond#2\relax$.$#3}
9.5237 + {\deftypeopcategory\ \putwordon\ \code{#1}}%
9.5238 + \deftypefunargs{#4}%
9.5239 + \endgroup
9.5240 +}
9.5241 +
9.5242 +% @deftypemethod CLASS TYPE METHOD ARG...
9.5243 +%
9.5244 +\def\deftypemethod{%
9.5245 + \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
9.5246 +%
9.5247 +% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
9.5248 +\def\deftypemethodheader#1#2#3#4{%
9.5249 + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
9.5250 + \begingroup
9.5251 + \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
9.5252 + \deftypefunargs{#4}%
9.5253 + \endgroup
9.5254 +}
9.5255 +
9.5256 +% @deftypeivar CLASS TYPE VARNAME
9.5257 +%
9.5258 +\def\deftypeivar{%
9.5259 + \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
9.5260 +%
9.5261 +% #1 is the class name, #2 the data type, #3 the variable name.
9.5262 +\def\deftypeivarheader#1#2#3{%
9.5263 + \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
9.5264 + \begingroup
9.5265 + \defname{\defheaderxcond#2\relax$.$#3}
9.5266 + {\putwordInstanceVariableof\ \code{#1}}%
9.5267 + \defvarargs{#3}%
9.5268 + \endgroup
9.5269 +}
9.5270 +
9.5271 +% @defmethod == @defop Method
9.5272 +%
9.5273 +\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
9.5274 +%
9.5275 +% #1 is the class name, #2 the method name, #3 the args.
9.5276 +\def\defmethodheader#1#2#3{%
9.5277 + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
9.5278 + \begingroup
9.5279 + \defname{#2}{\putwordMethodon\ \code{#1}}%
9.5280 + \defunargs{#3}%
9.5281 + \endgroup
9.5282 +}
9.5283 +
9.5284 +% @defcv {Class Option} foo-class foo-flag
9.5285 +
9.5286 +\def\defcv #1 {\def\defcvtype{#1}%
9.5287 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
9.5288 +
9.5289 +\def\defcvarheader #1#2#3{%
9.5290 + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
9.5291 + \begingroup
9.5292 + \defname{#2}{\defcvtype\ \putwordof\ #1}%
9.5293 + \defvarargs{#3}%
9.5294 + \endgroup
9.5295 +}
9.5296 +
9.5297 +% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
9.5298 +%
9.5299 +\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
9.5300 +%
9.5301 +\def\defivarheader#1#2#3{%
9.5302 + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
9.5303 + \begingroup
9.5304 + \defname{#2}{\putwordInstanceVariableof\ #1}%
9.5305 + \defvarargs{#3}%
9.5306 + \endgroup
9.5307 +}
9.5308 +
9.5309 +% @defvar
9.5310 +% First, define the processing that is wanted for arguments of @defvar.
9.5311 +% This is actually simple: just print them in roman.
9.5312 +% This must expand the args and terminate the paragraph they make up
9.5313 +\def\defvarargs #1{\normalparens #1%
9.5314 + \defargscommonending
9.5315 +}
9.5316 +
9.5317 +% @defvr Counter foo-count
9.5318 +
9.5319 +\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
9.5320 +
9.5321 +\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
9.5322 +\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
9.5323 +
9.5324 +% @defvar == @defvr Variable
9.5325 +
9.5326 +\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
9.5327 +
9.5328 +\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
9.5329 +\begingroup\defname {#1}{\putwordDefvar}%
9.5330 +\defvarargs {#2}\endgroup %
9.5331 +}
9.5332 +
9.5333 +% @defopt == @defvr {User Option}
9.5334 +
9.5335 +\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
9.5336 +
9.5337 +\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
9.5338 +\begingroup\defname {#1}{\putwordDefopt}%
9.5339 +\defvarargs {#2}\endgroup %
9.5340 +}
9.5341 +
9.5342 +% @deftypevar int foobar
9.5343 +
9.5344 +\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
9.5345 +
9.5346 +% #1 is the data type. #2 is the name, perhaps followed by text that
9.5347 +% is actually part of the data type, which should not be put into the index.
9.5348 +\def\deftypevarheader #1#2{%
9.5349 +\dovarind#2 \relax% Make entry in variables index
9.5350 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
9.5351 + \defargscommonending
9.5352 +\endgroup}
9.5353 +\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
9.5354 +
9.5355 +% @deftypevr {Global Flag} int enable
9.5356 +
9.5357 +\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
9.5358 +
9.5359 +\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
9.5360 +\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
9.5361 + \defargscommonending
9.5362 +\endgroup}
9.5363 +
9.5364 +% Now define @deftp
9.5365 +% Args are printed in bold, a slight difference from @defvar.
9.5366 +
9.5367 +\def\deftpargs #1{\bf \defvarargs{#1}}
9.5368 +
9.5369 +% @deftp Class window height width ...
9.5370 +
9.5371 +\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
9.5372 +
9.5373 +\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
9.5374 +\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
9.5375 +
9.5376 +% These definitions are used if you use @defunx (etc.)
9.5377 +% anywhere other than immediately after a @defun or @defunx.
9.5378 +%
9.5379 +\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
9.5380 +\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
9.5381 +\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
9.5382 +\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
9.5383 +\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
9.5384 +\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
9.5385 +\def\defopx#1 {\errmessage{@defopx in invalid context}}
9.5386 +\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
9.5387 +\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
9.5388 +\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
9.5389 +\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
9.5390 +\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
9.5391 +\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
9.5392 +\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
9.5393 +\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
9.5394 +\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
9.5395 +\def\defunx#1 {\errmessage{@defunx in invalid context}}
9.5396 +\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
9.5397 +\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
9.5398 +
9.5399 +
9.5400 +\message{macros,}
9.5401 +% @macro.
9.5402 +
9.5403 +% To do this right we need a feature of e-TeX, \scantokens,
9.5404 +% which we arrange to emulate with a temporary file in ordinary TeX.
9.5405 +\ifx\eTeXversion\undefined
9.5406 + \newwrite\macscribble
9.5407 + \def\scanmacro#1{%
9.5408 + \begingroup \newlinechar`\^^M
9.5409 + % Undo catcode changes of \startcontents and \doprintindex
9.5410 + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
9.5411 + % Append \endinput to make sure that TeX does not see the ending newline.
9.5412 + \toks0={#1\endinput}%
9.5413 + \immediate\openout\macscribble=\jobname.tmp
9.5414 + \immediate\write\macscribble{\the\toks0}%
9.5415 + \immediate\closeout\macscribble
9.5416 + \let\xeatspaces\eatspaces
9.5417 + \input \jobname.tmp
9.5418 + \endgroup
9.5419 +}
9.5420 +\else
9.5421 +\def\scanmacro#1{%
9.5422 +\begingroup \newlinechar`\^^M
9.5423 +% Undo catcode changes of \startcontents and \doprintindex
9.5424 +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@
9.5425 +\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
9.5426 +\fi
9.5427 +
9.5428 +\newcount\paramno % Count of parameters
9.5429 +\newtoks\macname % Macro name
9.5430 +\newif\ifrecursive % Is it recursive?
9.5431 +\def\macrolist{} % List of all defined macros in the form
9.5432 + % \do\macro1\do\macro2...
9.5433 +
9.5434 +% Utility routines.
9.5435 +% Thisdoes \let #1 = #2, except with \csnames.
9.5436 +\def\cslet#1#2{%
9.5437 +\expandafter\expandafter
9.5438 +\expandafter\let
9.5439 +\expandafter\expandafter
9.5440 +\csname#1\endcsname
9.5441 +\csname#2\endcsname}
9.5442 +
9.5443 +% Trim leading and trailing spaces off a string.
9.5444 +% Concepts from aro-bend problem 15 (see CTAN).
9.5445 +{\catcode`\@=11
9.5446 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
9.5447 +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
9.5448 +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
9.5449 +\def\unbrace#1{#1}
9.5450 +\unbrace{\gdef\trim@@@ #1 } #2@{#1}
9.5451 +}
9.5452 +
9.5453 +% Trim a single trailing ^^M off a string.
9.5454 +{\catcode`\^^M=\other \catcode`\Q=3%
9.5455 +\gdef\eatcr #1{\eatcra #1Q^^MQ}%
9.5456 +\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
9.5457 +\gdef\eatcrb#1Q#2Q{#1}%
9.5458 +}
9.5459 +
9.5460 +% Macro bodies are absorbed as an argument in a context where
9.5461 +% all characters are catcode 10, 11 or 12, except \ which is active
9.5462 +% (as in normal texinfo). It is necessary to change the definition of \.
9.5463 +
9.5464 +% It's necessary to have hard CRs when the macro is executed. This is
9.5465 +% done by making ^^M (\endlinechar) catcode 12 when reading the macro
9.5466 +% body, and then making it the \newlinechar in \scanmacro.
9.5467 +
9.5468 +\def\macrobodyctxt{%
9.5469 + \catcode`\~=\other
9.5470 + \catcode`\^=\other
9.5471 + \catcode`\_=\other
9.5472 + \catcode`\|=\other
9.5473 + \catcode`\<=\other
9.5474 + \catcode`\>=\other
9.5475 + \catcode`\+=\other
9.5476 + \catcode`\{=\other
9.5477 + \catcode`\}=\other
9.5478 + \catcode`\@=\other
9.5479 + \catcode`\^^M=\other
9.5480 + \usembodybackslash}
9.5481 +
9.5482 +\def\macroargctxt{%
9.5483 + \catcode`\~=\other
9.5484 + \catcode`\^=\other
9.5485 + \catcode`\_=\other
9.5486 + \catcode`\|=\other
9.5487 + \catcode`\<=\other
9.5488 + \catcode`\>=\other
9.5489 + \catcode`\+=\other
9.5490 + \catcode`\@=\other
9.5491 + \catcode`\\=\other}
9.5492 +
9.5493 +% \mbodybackslash is the definition of \ in @macro bodies.
9.5494 +% It maps \foo\ => \csname macarg.foo\endcsname => #N
9.5495 +% where N is the macro parameter number.
9.5496 +% We define \csname macarg.\endcsname to be \realbackslash, so
9.5497 +% \\ in macro replacement text gets you a backslash.
9.5498 +
9.5499 +{\catcode`@=0 @catcode`@\=@active
9.5500 + @gdef@usembodybackslash{@let\=@mbodybackslash}
9.5501 + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
9.5502 +}
9.5503 +\expandafter\def\csname macarg.\endcsname{\realbackslash}
9.5504 +
9.5505 +\def\macro{\recursivefalse\parsearg\macroxxx}
9.5506 +\def\rmacro{\recursivetrue\parsearg\macroxxx}
9.5507 +
9.5508 +\def\macroxxx#1{%
9.5509 + \getargs{#1}% now \macname is the macname and \argl the arglist
9.5510 + \ifx\argl\empty % no arguments
9.5511 + \paramno=0%
9.5512 + \else
9.5513 + \expandafter\parsemargdef \argl;%
9.5514 + \fi
9.5515 + \if1\csname ismacro.\the\macname\endcsname
9.5516 + \message{Warning: redefining \the\macname}%
9.5517 + \else
9.5518 + \expandafter\ifx\csname \the\macname\endcsname \relax
9.5519 + \else \errmessage{Macro name \the\macname\space already defined}\fi
9.5520 + \global\cslet{macsave.\the\macname}{\the\macname}%
9.5521 + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
9.5522 + % Add the macroname to \macrolist
9.5523 + \toks0 = \expandafter{\macrolist\do}%
9.5524 + \xdef\macrolist{\the\toks0
9.5525 + \expandafter\noexpand\csname\the\macname\endcsname}%
9.5526 + \fi
9.5527 + \begingroup \macrobodyctxt
9.5528 + \ifrecursive \expandafter\parsermacbody
9.5529 + \else \expandafter\parsemacbody
9.5530 + \fi}
9.5531 +
9.5532 +\def\unmacro{\parsearg\dounmacro}
9.5533 +\def\dounmacro#1{%
9.5534 + \if1\csname ismacro.#1\endcsname
9.5535 + \global\cslet{#1}{macsave.#1}%
9.5536 + \global\expandafter\let \csname ismacro.#1\endcsname=0%
9.5537 + % Remove the macro name from \macrolist:
9.5538 + \begingroup
9.5539 + \expandafter\let\csname#1\endcsname \relax
9.5540 + \let\do\unmacrodo
9.5541 + \xdef\macrolist{\macrolist}%
9.5542 + \endgroup
9.5543 + \else
9.5544 + \errmessage{Macro #1 not defined}%
9.5545 + \fi
9.5546 +}
9.5547 +
9.5548 +% Called by \do from \dounmacro on each macro. The idea is to omit any
9.5549 +% macro definitions that have been changed to \relax.
9.5550 +%
9.5551 +\def\unmacrodo#1{%
9.5552 + \ifx#1\relax
9.5553 + % remove this
9.5554 + \else
9.5555 + \noexpand\do \noexpand #1%
9.5556 + \fi
9.5557 +}
9.5558 +
9.5559 +% This makes use of the obscure feature that if the last token of a
9.5560 +% <parameter list> is #, then the preceding argument is delimited by
9.5561 +% an opening brace, and that opening brace is not consumed.
9.5562 +\def\getargs#1{\getargsxxx#1{}}
9.5563 +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
9.5564 +\def\getmacname #1 #2\relax{\macname={#1}}
9.5565 +\def\getmacargs#1{\def\argl{#1}}
9.5566 +
9.5567 +% Parse the optional {params} list. Set up \paramno and \paramlist
9.5568 +% so \defmacro knows what to do. Define \macarg.blah for each blah
9.5569 +% in the params list, to be ##N where N is the position in that list.
9.5570 +% That gets used by \mbodybackslash (above).
9.5571 +
9.5572 +% We need to get `macro parameter char #' into several definitions.
9.5573 +% The technique used is stolen from LaTeX: let \hash be something
9.5574 +% unexpandable, insert that wherever you need a #, and then redefine
9.5575 +% it to # just before using the token list produced.
9.5576 +%
9.5577 +% The same technique is used to protect \eatspaces till just before
9.5578 +% the macro is used.
9.5579 +
9.5580 +\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
9.5581 + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
9.5582 +\def\parsemargdefxxx#1,{%
9.5583 + \if#1;\let\next=\relax
9.5584 + \else \let\next=\parsemargdefxxx
9.5585 + \advance\paramno by 1%
9.5586 + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
9.5587 + {\xeatspaces{\hash\the\paramno}}%
9.5588 + \edef\paramlist{\paramlist\hash\the\paramno,}%
9.5589 + \fi\next}
9.5590 +
9.5591 +% These two commands read recursive and nonrecursive macro bodies.
9.5592 +% (They're different since rec and nonrec macros end differently.)
9.5593 +
9.5594 +\long\def\parsemacbody#1@end macro%
9.5595 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
9.5596 +\long\def\parsermacbody#1@end rmacro%
9.5597 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
9.5598 +
9.5599 +% This defines the macro itself. There are six cases: recursive and
9.5600 +% nonrecursive macros of zero, one, and many arguments.
9.5601 +% Much magic with \expandafter here.
9.5602 +% \xdef is used so that macro definitions will survive the file
9.5603 +% they're defined in; @include reads the file inside a group.
9.5604 +\def\defmacro{%
9.5605 + \let\hash=##% convert placeholders to macro parameter chars
9.5606 + \ifrecursive
9.5607 + \ifcase\paramno
9.5608 + % 0
9.5609 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5610 + \noexpand\scanmacro{\temp}}%
9.5611 + \or % 1
9.5612 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5613 + \bgroup\noexpand\macroargctxt
9.5614 + \noexpand\braceorline
9.5615 + \expandafter\noexpand\csname\the\macname xxx\endcsname}%
9.5616 + \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
9.5617 + \egroup\noexpand\scanmacro{\temp}}%
9.5618 + \else % many
9.5619 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5620 + \bgroup\noexpand\macroargctxt
9.5621 + \noexpand\csname\the\macname xx\endcsname}%
9.5622 + \expandafter\xdef\csname\the\macname xx\endcsname##1{%
9.5623 + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
9.5624 + \expandafter\expandafter
9.5625 + \expandafter\xdef
9.5626 + \expandafter\expandafter
9.5627 + \csname\the\macname xxx\endcsname
9.5628 + \paramlist{\egroup\noexpand\scanmacro{\temp}}%
9.5629 + \fi
9.5630 + \else
9.5631 + \ifcase\paramno
9.5632 + % 0
9.5633 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5634 + \noexpand\norecurse{\the\macname}%
9.5635 + \noexpand\scanmacro{\temp}\egroup}%
9.5636 + \or % 1
9.5637 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5638 + \bgroup\noexpand\macroargctxt
9.5639 + \noexpand\braceorline
9.5640 + \expandafter\noexpand\csname\the\macname xxx\endcsname}%
9.5641 + \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
9.5642 + \egroup
9.5643 + \noexpand\norecurse{\the\macname}%
9.5644 + \noexpand\scanmacro{\temp}\egroup}%
9.5645 + \else % many
9.5646 + \expandafter\xdef\csname\the\macname\endcsname{%
9.5647 + \bgroup\noexpand\macroargctxt
9.5648 + \expandafter\noexpand\csname\the\macname xx\endcsname}%
9.5649 + \expandafter\xdef\csname\the\macname xx\endcsname##1{%
9.5650 + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
9.5651 + \expandafter\expandafter
9.5652 + \expandafter\xdef
9.5653 + \expandafter\expandafter
9.5654 + \csname\the\macname xxx\endcsname
9.5655 + \paramlist{%
9.5656 + \egroup
9.5657 + \noexpand\norecurse{\the\macname}%
9.5658 + \noexpand\scanmacro{\temp}\egroup}%
9.5659 + \fi
9.5660 + \fi}
9.5661 +
9.5662 +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
9.5663 +
9.5664 +% \braceorline decides whether the next nonwhitespace character is a
9.5665 +% {. If so it reads up to the closing }, if not, it reads the whole
9.5666 +% line. Whatever was read is then fed to the next control sequence
9.5667 +% as an argument (by \parsebrace or \parsearg)
9.5668 +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
9.5669 +\def\braceorlinexxx{%
9.5670 + \ifx\nchar\bgroup\else
9.5671 + \expandafter\parsearg
9.5672 + \fi \next}
9.5673 +
9.5674 +% We mant to disable all macros during \shipout so that they are not
9.5675 +% expanded by \write.
9.5676 +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
9.5677 + \edef\next{\macrolist}\expandafter\endgroup\next}
9.5678 +
9.5679 +
9.5680 +% @alias.
9.5681 +% We need some trickery to remove the optional spaces around the equal
9.5682 +% sign. Just make them active and then expand them all to nothing.
9.5683 +\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
9.5684 +\def\aliasxxx #1{\aliasyyy#1\relax}
9.5685 +\def\aliasyyy #1=#2\relax{\ignoreactivespaces
9.5686 +\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
9.5687 + \expandafter\noexpand\csname#2\endcsname}%
9.5688 +\expandafter\endgroup\next}
9.5689 +
9.5690 +
9.5691 +\message{cross references,}
9.5692 +% @xref etc.
9.5693 +
9.5694 +\newwrite\auxfile
9.5695 +
9.5696 +\newif\ifhavexrefs % True if xref values are known.
9.5697 +\newif\ifwarnedxrefs % True if we warned once that they aren't known.
9.5698 +
9.5699 +% @inforef is relatively simple.
9.5700 +\def\inforef #1{\inforefzzz #1,,,,**}
9.5701 +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
9.5702 + node \samp{\ignorespaces#1{}}}
9.5703 +
9.5704 +% @node's job is to define \lastnode.
9.5705 +\def\node{\ENVcheck\parsearg\nodezzz}
9.5706 +\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
9.5707 +\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
9.5708 +\let\nwnode=\node
9.5709 +\let\lastnode=\relax
9.5710 +
9.5711 +% The sectioning commands (@chapter, etc.) call these.
9.5712 +\def\donoderef{%
9.5713 + \ifx\lastnode\relax\else
9.5714 + \expandafter\expandafter\expandafter\setref{\lastnode}%
9.5715 + {Ysectionnumberandtype}%
9.5716 + \global\let\lastnode=\relax
9.5717 + \fi
9.5718 +}
9.5719 +\def\unnumbnoderef{%
9.5720 + \ifx\lastnode\relax\else
9.5721 + \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
9.5722 + \global\let\lastnode=\relax
9.5723 + \fi
9.5724 +}
9.5725 +\def\appendixnoderef{%
9.5726 + \ifx\lastnode\relax\else
9.5727 + \expandafter\expandafter\expandafter\setref{\lastnode}%
9.5728 + {Yappendixletterandtype}%
9.5729 + \global\let\lastnode=\relax
9.5730 + \fi
9.5731 +}
9.5732 +
9.5733 +
9.5734 +% @anchor{NAME} -- define xref target at arbitrary point.
9.5735 +%
9.5736 +\newcount\savesfregister
9.5737 +\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
9.5738 +\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
9.5739 +\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
9.5740 +
9.5741 +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
9.5742 +% anchor), namely NAME-title (the corresponding @chapter/etc. name),
9.5743 +% NAME-pg (the page number), and NAME-snt (section number and type).
9.5744 +% Called from \foonoderef.
9.5745 +%
9.5746 +% We have to set \indexdummies so commands such as @code in a section
9.5747 +% title aren't expanded. It would be nicer not to expand the titles in
9.5748 +% the first place, but there's so many layers that that is hard to do.
9.5749 +%
9.5750 +% Likewise, use \turnoffactive so that punctuation chars such as underscore
9.5751 +% and backslash work in node names.
9.5752 +%
9.5753 +\def\setref#1#2{{%
9.5754 + \atdummies
9.5755 + \pdfmkdest{#1}%
9.5756 + %
9.5757 + \turnoffactive
9.5758 + \dosetq{#1-title}{Ytitle}%
9.5759 + \dosetq{#1-pg}{Ypagenumber}%
9.5760 + \dosetq{#1-snt}{#2}%
9.5761 +}}
9.5762 +
9.5763 +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
9.5764 +% the node name, #2 the name of the Info cross-reference, #3 the printed
9.5765 +% node name, #4 the name of the Info file, #5 the name of the printed
9.5766 +% manual. All but the node name can be omitted.
9.5767 +%
9.5768 +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
9.5769 +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
9.5770 +\def\ref#1{\xrefX[#1,,,,,,,]}
9.5771 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
9.5772 + \unsepspaces
9.5773 + \def\printedmanual{\ignorespaces #5}%
9.5774 + \def\printednodename{\ignorespaces #3}%
9.5775 + \setbox1=\hbox{\printedmanual}%
9.5776 + \setbox0=\hbox{\printednodename}%
9.5777 + \ifdim \wd0 = 0pt
9.5778 + % No printed node name was explicitly given.
9.5779 + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
9.5780 + % Use the node name inside the square brackets.
9.5781 + \def\printednodename{\ignorespaces #1}%
9.5782 + \else
9.5783 + % Use the actual chapter/section title appear inside
9.5784 + % the square brackets. Use the real section title if we have it.
9.5785 + \ifdim \wd1 > 0pt
9.5786 + % It is in another manual, so we don't have it.
9.5787 + \def\printednodename{\ignorespaces #1}%
9.5788 + \else
9.5789 + \ifhavexrefs
9.5790 + % We know the real title if we have the xref values.
9.5791 + \def\printednodename{\refx{#1-title}{}}%
9.5792 + \else
9.5793 + % Otherwise just copy the Info node name.
9.5794 + \def\printednodename{\ignorespaces #1}%
9.5795 + \fi%
9.5796 + \fi
9.5797 + \fi
9.5798 + \fi
9.5799 + %
9.5800 + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
9.5801 + % insert empty discretionaries after hyphens, which means that it will
9.5802 + % not find a line break at a hyphen in a node names. Since some manuals
9.5803 + % are best written with fairly long node names, containing hyphens, this
9.5804 + % is a loss. Therefore, we give the text of the node name again, so it
9.5805 + % is as if TeX is seeing it for the first time.
9.5806 + \ifpdf
9.5807 + \leavevmode
9.5808 + \getfilename{#4}%
9.5809 + {\turnoffactive \otherbackslash
9.5810 + \ifnum\filenamelength>0
9.5811 + \startlink attr{/Border [0 0 0]}%
9.5812 + goto file{\the\filename.pdf} name{#1}%
9.5813 + \else
9.5814 + \startlink attr{/Border [0 0 0]}%
9.5815 + goto name{#1}%
9.5816 + \fi
9.5817 + }%
9.5818 + \linkcolor
9.5819 + \fi
9.5820 + %
9.5821 + \ifdim \wd1 > 0pt
9.5822 + \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
9.5823 + \else
9.5824 + % _ (for example) has to be the character _ for the purposes of the
9.5825 + % control sequence corresponding to the node, but it has to expand
9.5826 + % into the usual \leavevmode...\vrule stuff for purposes of
9.5827 + % printing. So we \turnoffactive for the \refx-snt, back on for the
9.5828 + % printing, back off for the \refx-pg.
9.5829 + {\turnoffactive \otherbackslash
9.5830 + % Only output a following space if the -snt ref is nonempty; for
9.5831 + % @unnumbered and @anchor, it won't be.
9.5832 + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
9.5833 + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
9.5834 + }%
9.5835 + % output the `[mynode]' via a macro.
9.5836 + \xrefprintnodename\printednodename
9.5837 + %
9.5838 + % But we always want a comma and a space:
9.5839 + ,\space
9.5840 + %
9.5841 + % output the `page 3'.
9.5842 + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
9.5843 + \fi
9.5844 + \endlink
9.5845 +\endgroup}
9.5846 +
9.5847 +% This macro is called from \xrefX for the `[nodename]' part of xref
9.5848 +% output. It's a separate macro only so it can be changed more easily,
9.5849 +% since not square brackets don't work in some documents. Particularly
9.5850 +% one that Bob is working on :).
9.5851 +%
9.5852 +\def\xrefprintnodename#1{[#1]}
9.5853 +
9.5854 +% \dosetq is called from \setref to do the actual \write (\iflinks).
9.5855 +%
9.5856 +\def\dosetq#1#2{%
9.5857 + {\let\folio=0%
9.5858 + \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
9.5859 + \iflinks \next \fi
9.5860 + }%
9.5861 +}
9.5862 +
9.5863 +% \internalsetq{foo}{page} expands into
9.5864 +% CHARACTERS @xrdef{foo}{...expansion of \page...}
9.5865 +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
9.5866 +
9.5867 +% Things to be expanded by \internalsetq.
9.5868 +%
9.5869 +\def\Ypagenumber{\folio}
9.5870 +\def\Ytitle{\thissection}
9.5871 +\def\Ynothing{}
9.5872 +\def\Ysectionnumberandtype{%
9.5873 + \ifnum\secno=0
9.5874 + \putwordChapter@tie \the\chapno
9.5875 + \else \ifnum\subsecno=0
9.5876 + \putwordSection@tie \the\chapno.\the\secno
9.5877 + \else \ifnum\subsubsecno=0
9.5878 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9.5879 + \else
9.5880 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9.5881 + \fi\fi\fi
9.5882 +}
9.5883 +
9.5884 +\def\Yappendixletterandtype{%
9.5885 + \ifnum\secno=0
9.5886 + \putwordAppendix@tie @char\the\appendixno{}%
9.5887 + \else \ifnum\subsecno=0
9.5888 + \putwordSection@tie @char\the\appendixno.\the\secno
9.5889 + \else \ifnum\subsubsecno=0
9.5890 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9.5891 + \else
9.5892 + \putwordSection@tie
9.5893 + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9.5894 + \fi\fi\fi
9.5895 +}
9.5896 +
9.5897 +% Use TeX 3.0's \inputlineno to get the line number, for better error
9.5898 +% messages, but if we're using an old version of TeX, don't do anything.
9.5899 +%
9.5900 +\ifx\inputlineno\thisisundefined
9.5901 + \let\linenumber = \empty % Pre-3.0.
9.5902 +\else
9.5903 + \def\linenumber{\the\inputlineno:\space}
9.5904 +\fi
9.5905 +
9.5906 +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
9.5907 +% If its value is nonempty, SUFFIX is output afterward.
9.5908 +%
9.5909 +\def\refx#1#2{%
9.5910 + {%
9.5911 + \indexnofonts
9.5912 + \otherbackslash
9.5913 + \expandafter\global\expandafter\let\expandafter\thisrefX
9.5914 + \csname X#1\endcsname
9.5915 + }%
9.5916 + \ifx\thisrefX\relax
9.5917 + % If not defined, say something at least.
9.5918 + \angleleft un\-de\-fined\angleright
9.5919 + \iflinks
9.5920 + \ifhavexrefs
9.5921 + \message{\linenumber Undefined cross reference `#1'.}%
9.5922 + \else
9.5923 + \ifwarnedxrefs\else
9.5924 + \global\warnedxrefstrue
9.5925 + \message{Cross reference values unknown; you must run TeX again.}%
9.5926 + \fi
9.5927 + \fi
9.5928 + \fi
9.5929 + \else
9.5930 + % It's defined, so just use it.
9.5931 + \thisrefX
9.5932 + \fi
9.5933 + #2% Output the suffix in any case.
9.5934 +}
9.5935 +
9.5936 +% This is the macro invoked by entries in the aux file.
9.5937 +%
9.5938 +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
9.5939 +
9.5940 +% Read the last existing aux file, if any. No error if none exists.
9.5941 +\def\readauxfile{\begingroup
9.5942 + \catcode`\^^@=\other
9.5943 + \catcode`\^^A=\other
9.5944 + \catcode`\^^B=\other
9.5945 + \catcode`\^^C=\other
9.5946 + \catcode`\^^D=\other
9.5947 + \catcode`\^^E=\other
9.5948 + \catcode`\^^F=\other
9.5949 + \catcode`\^^G=\other
9.5950 + \catcode`\^^H=\other
9.5951 + \catcode`\^^K=\other
9.5952 + \catcode`\^^L=\other
9.5953 + \catcode`\^^N=\other
9.5954 + \catcode`\^^P=\other
9.5955 + \catcode`\^^Q=\other
9.5956 + \catcode`\^^R=\other
9.5957 + \catcode`\^^S=\other
9.5958 + \catcode`\^^T=\other
9.5959 + \catcode`\^^U=\other
9.5960 + \catcode`\^^V=\other
9.5961 + \catcode`\^^W=\other
9.5962 + \catcode`\^^X=\other
9.5963 + \catcode`\^^Z=\other
9.5964 + \catcode`\^^[=\other
9.5965 + \catcode`\^^\=\other
9.5966 + \catcode`\^^]=\other
9.5967 + \catcode`\^^^=\other
9.5968 + \catcode`\^^_=\other
9.5969 + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
9.5970 + % in xref tags, i.e., node names. But since ^^e4 notation isn't
9.5971 + % supported in the main text, it doesn't seem desirable. Furthermore,
9.5972 + % that is not enough: for node names that actually contain a ^
9.5973 + % character, we would end up writing a line like this: 'xrdef {'hat
9.5974 + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
9.5975 + % argument, and \hat is not an expandable control sequence. It could
9.5976 + % all be worked out, but why? Either we support ^^ or we don't.
9.5977 + %
9.5978 + % The other change necessary for this was to define \auxhat:
9.5979 + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
9.5980 + % and then to call \auxhat in \setq.
9.5981 + %
9.5982 + \catcode`\^=\other
9.5983 + %
9.5984 + % Special characters. Should be turned off anyway, but...
9.5985 + \catcode`\~=\other
9.5986 + \catcode`\[=\other
9.5987 + \catcode`\]=\other
9.5988 + \catcode`\"=\other
9.5989 + \catcode`\_=\other
9.5990 + \catcode`\|=\other
9.5991 + \catcode`\<=\other
9.5992 + \catcode`\>=\other
9.5993 + \catcode`\$=\other
9.5994 + \catcode`\#=\other
9.5995 + \catcode`\&=\other
9.5996 + \catcode`\%=\other
9.5997 + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9.5998 + %
9.5999 + % Make the characters 128-255 be printing characters
9.6000 + {%
9.6001 + \count 1=128
9.6002 + \def\loop{%
9.6003 + \catcode\count 1=\other
9.6004 + \advance\count 1 by 1
9.6005 + \ifnum \count 1<256 \loop \fi
9.6006 + }%
9.6007 + }%
9.6008 + %
9.6009 + % Turn off \ as an escape so we do not lose on
9.6010 + % entries which were dumped with control sequences in their names.
9.6011 + % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
9.6012 + % Reference to such entries still does not work the way one would wish,
9.6013 + % but at least they do not bomb out when the aux file is read in.
9.6014 + \catcode`\\=\other
9.6015 + %
9.6016 + % @ is our escape character in .aux files.
9.6017 + \catcode`\{=1
9.6018 + \catcode`\}=2
9.6019 + \catcode`\@=0
9.6020 + %
9.6021 + \openin 1 \jobname.aux
9.6022 + \ifeof 1 \else
9.6023 + \closein 1
9.6024 + \input \jobname.aux
9.6025 + \global\havexrefstrue
9.6026 + \fi
9.6027 + % Open the new aux file. TeX will close it automatically at exit.
9.6028 + \openout\auxfile=\jobname.aux
9.6029 +\endgroup}
9.6030 +
9.6031 +
9.6032 +% Footnotes.
9.6033 +
9.6034 +\newcount \footnoteno
9.6035 +
9.6036 +% The trailing space in the following definition for supereject is
9.6037 +% vital for proper filling; pages come out unaligned when you do a
9.6038 +% pagealignmacro call if that space before the closing brace is
9.6039 +% removed. (Generally, numeric constants should always be followed by a
9.6040 +% space to prevent strange expansion errors.)
9.6041 +\def\supereject{\par\penalty -20000\footnoteno =0 }
9.6042 +
9.6043 +% @footnotestyle is meaningful for info output only.
9.6044 +\let\footnotestyle=\comment
9.6045 +
9.6046 +\let\ptexfootnote=\footnote
9.6047 +
9.6048 +{\catcode `\@=11
9.6049 +%
9.6050 +% Auto-number footnotes. Otherwise like plain.
9.6051 +\gdef\footnote{%
9.6052 + \let\indent=\ptexindent
9.6053 + \global\advance\footnoteno by \@ne
9.6054 + \edef\thisfootno{$^{\the\footnoteno}$}%
9.6055 + %
9.6056 + % In case the footnote comes at the end of a sentence, preserve the
9.6057 + % extra spacing after we do the footnote number.
9.6058 + \let\@sf\empty
9.6059 + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9.6060 + %
9.6061 + % Remove inadvertent blank space before typesetting the footnote number.
9.6062 + \unskip
9.6063 + \thisfootno\@sf
9.6064 + \dofootnote
9.6065 +}%
9.6066 +
9.6067 +% Don't bother with the trickery in plain.tex to not require the
9.6068 +% footnote text as a parameter. Our footnotes don't need to be so general.
9.6069 +%
9.6070 +% Oh yes, they do; otherwise, @ifset and anything else that uses
9.6071 +% \parseargline fail inside footnotes because the tokens are fixed when
9.6072 +% the footnote is read. --karl, 16nov96.
9.6073 +%
9.6074 +% The start of the footnote looks usually like this:
9.6075 +\gdef\startfootins{\insert\footins\bgroup}
9.6076 +%
9.6077 +% ... but this macro is redefined inside @multitable.
9.6078 +%
9.6079 +\gdef\dofootnote{%
9.6080 + \startfootins
9.6081 + % We want to typeset this text as a normal paragraph, even if the
9.6082 + % footnote reference occurs in (for example) a display environment.
9.6083 + % So reset some parameters.
9.6084 + \hsize=\pagewidth
9.6085 + \interlinepenalty\interfootnotelinepenalty
9.6086 + \splittopskip\ht\strutbox % top baseline for broken footnotes
9.6087 + \splitmaxdepth\dp\strutbox
9.6088 + \floatingpenalty\@MM
9.6089 + \leftskip\z@skip
9.6090 + \rightskip\z@skip
9.6091 + \spaceskip\z@skip
9.6092 + \xspaceskip\z@skip
9.6093 + \parindent\defaultparindent
9.6094 + %
9.6095 + \smallfonts \rm
9.6096 + %
9.6097 + % Because we use hanging indentation in footnotes, a @noindent appears
9.6098 + % to exdent this text, so make it be a no-op. makeinfo does not use
9.6099 + % hanging indentation so @noindent can still be needed within footnote
9.6100 + % text after an @example or the like (not that this is good style).
9.6101 + \let\noindent = \relax
9.6102 + %
9.6103 + % Hang the footnote text off the number. Use \everypar in case the
9.6104 + % footnote extends for more than one paragraph.
9.6105 + \everypar = {\hang}%
9.6106 + \textindent{\thisfootno}%
9.6107 + %
9.6108 + % Don't crash into the line above the footnote text. Since this
9.6109 + % expands into a box, it must come within the paragraph, lest it
9.6110 + % provide a place where TeX can split the footnote.
9.6111 + \footstrut
9.6112 + \futurelet\next\fo@t
9.6113 +}
9.6114 +}%end \catcode `\@=11
9.6115 +
9.6116 +% @| inserts a changebar to the left of the current line. It should
9.6117 +% surround any changed text. This approach does *not* work if the
9.6118 +% change spans more than two lines of output. To handle that, we would
9.6119 +% have adopt a much more difficult approach (putting marks into the main
9.6120 +% vertical list for the beginning and end of each change).
9.6121 +%
9.6122 +\def\|{%
9.6123 + % \vadjust can only be used in horizontal mode.
9.6124 + \leavevmode
9.6125 + %
9.6126 + % Append this vertical mode material after the current line in the output.
9.6127 + \vadjust{%
9.6128 + % We want to insert a rule with the height and depth of the current
9.6129 + % leading; that is exactly what \strutbox is supposed to record.
9.6130 + \vskip-\baselineskip
9.6131 + %
9.6132 + % \vadjust-items are inserted at the left edge of the type. So
9.6133 + % the \llap here moves out into the left-hand margin.
9.6134 + \llap{%
9.6135 + %
9.6136 + % For a thicker or thinner bar, change the `1pt'.
9.6137 + \vrule height\baselineskip width1pt
9.6138 + %
9.6139 + % This is the space between the bar and the text.
9.6140 + \hskip 12pt
9.6141 + }%
9.6142 + }%
9.6143 +}
9.6144 +
9.6145 +% For a final copy, take out the rectangles
9.6146 +% that mark overfull boxes (in case you have decided
9.6147 +% that the text looks ok even though it passes the margin).
9.6148 +%
9.6149 +\def\finalout{\overfullrule=0pt}
9.6150 +
9.6151 +% @image. We use the macros from epsf.tex to support this.
9.6152 +% If epsf.tex is not installed and @image is used, we complain.
9.6153 +%
9.6154 +% Check for and read epsf.tex up front. If we read it only at @image
9.6155 +% time, we might be inside a group, and then its definitions would get
9.6156 +% undone and the next image would fail.
9.6157 +\openin 1 = epsf.tex
9.6158 +\ifeof 1 \else
9.6159 + \closein 1
9.6160 + % Do not bother showing banner with epsf.tex v2.7k (available in
9.6161 + % doc/epsf.tex and on ctan).
9.6162 + \def\epsfannounce{\toks0 = }%
9.6163 + \input epsf.tex
9.6164 +\fi
9.6165 +%
9.6166 +% We will only complain once about lack of epsf.tex.
9.6167 +\newif\ifwarnednoepsf
9.6168 +\newhelp\noepsfhelp{epsf.tex must be installed for images to
9.6169 + work. It is also included in the Texinfo distribution, or you can get
9.6170 + it from ftp://tug.org/tex/epsf.tex.}
9.6171 +%
9.6172 +\def\image#1{%
9.6173 + \ifx\epsfbox\undefined
9.6174 + \ifwarnednoepsf \else
9.6175 + \errhelp = \noepsfhelp
9.6176 + \errmessage{epsf.tex not found, images will be ignored}%
9.6177 + \global\warnednoepsftrue
9.6178 + \fi
9.6179 + \else
9.6180 + \imagexxx #1,,,,,\finish
9.6181 + \fi
9.6182 +}
9.6183 +%
9.6184 +% Arguments to @image:
9.6185 +% #1 is (mandatory) image filename; we tack on .eps extension.
9.6186 +% #2 is (optional) width, #3 is (optional) height.
9.6187 +% #4 is (ignored optional) html alt text.
9.6188 +% #5 is (ignored optional) extension.
9.6189 +% #6 is just the usual extra ignored arg for parsing this stuff.
9.6190 +\newif\ifimagevmode
9.6191 +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9.6192 + \catcode`\^^M = 5 % in case we're inside an example
9.6193 + \normalturnoffactive % allow _ et al. in names
9.6194 + % If the image is by itself, center it.
9.6195 + \ifvmode
9.6196 + \imagevmodetrue
9.6197 + \nobreak\bigskip
9.6198 + % Usually we'll have text after the image which will insert
9.6199 + % \parskip glue, so insert it here too to equalize the space
9.6200 + % above and below.
9.6201 + \nobreak\vskip\parskip
9.6202 + \nobreak
9.6203 + \line\bgroup\hss
9.6204 + \fi
9.6205 + %
9.6206 + % Output the image.
9.6207 + \ifpdf
9.6208 + \dopdfimage{#1}{#2}{#3}%
9.6209 + \else
9.6210 + % \epsfbox itself resets \epsf?size at each figure.
9.6211 + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9.6212 + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9.6213 + \epsfbox{#1.eps}%
9.6214 + \fi
9.6215 + %
9.6216 + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
9.6217 +\endgroup}
9.6218 +
9.6219 +
9.6220 +\message{localization,}
9.6221 +% and i18n.
9.6222 +
9.6223 +% @documentlanguage is usually given very early, just after
9.6224 +% @setfilename. If done too late, it may not override everything
9.6225 +% properly. Single argument is the language abbreviation.
9.6226 +% It would be nice if we could set up a hyphenation file here.
9.6227 +%
9.6228 +\def\documentlanguage{\parsearg\dodocumentlanguage}
9.6229 +\def\dodocumentlanguage#1{%
9.6230 + \tex % read txi-??.tex file in plain TeX.
9.6231 + % Read the file if it exists.
9.6232 + \openin 1 txi-#1.tex
9.6233 + \ifeof1
9.6234 + \errhelp = \nolanghelp
9.6235 + \errmessage{Cannot read language file txi-#1.tex}%
9.6236 + \let\temp = \relax
9.6237 + \else
9.6238 + \def\temp{\input txi-#1.tex }%
9.6239 + \fi
9.6240 + \temp
9.6241 + \endgroup
9.6242 +}
9.6243 +\newhelp\nolanghelp{The given language definition file cannot be found or
9.6244 +is empty. Maybe you need to install it? In the current directory
9.6245 +should work if nowhere else does.}
9.6246 +
9.6247 +
9.6248 +% @documentencoding should change something in TeX eventually, most
9.6249 +% likely, but for now just recognize it.
9.6250 +\let\documentencoding = \comment
9.6251 +
9.6252 +
9.6253 +% Page size parameters.
9.6254 +%
9.6255 +\newdimen\defaultparindent \defaultparindent = 15pt
9.6256 +
9.6257 +\chapheadingskip = 15pt plus 4pt minus 2pt
9.6258 +\secheadingskip = 12pt plus 3pt minus 2pt
9.6259 +\subsecheadingskip = 9pt plus 2pt minus 2pt
9.6260 +
9.6261 +% Prevent underfull vbox error messages.
9.6262 +\vbadness = 10000
9.6263 +
9.6264 +% Don't be so finicky about underfull hboxes, either.
9.6265 +\hbadness = 2000
9.6266 +
9.6267 +% Following George Bush, just get rid of widows and orphans.
9.6268 +\widowpenalty=10000
9.6269 +\clubpenalty=10000
9.6270 +
9.6271 +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
9.6272 +% using an old version of TeX, don't do anything. We want the amount of
9.6273 +% stretch added to depend on the line length, hence the dependence on
9.6274 +% \hsize. We call this whenever the paper size is set.
9.6275 +%
9.6276 +\def\setemergencystretch{%
9.6277 + \ifx\emergencystretch\thisisundefined
9.6278 + % Allow us to assign to \emergencystretch anyway.
9.6279 + \def\emergencystretch{\dimen0}%
9.6280 + \else
9.6281 + \emergencystretch = .15\hsize
9.6282 + \fi
9.6283 +}
9.6284 +
9.6285 +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
9.6286 +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
9.6287 +% physical page width.
9.6288 +%
9.6289 +% We also call \setleading{\textleading}, so the caller should define
9.6290 +% \textleading. The caller should also set \parskip.
9.6291 +%
9.6292 +\def\internalpagesizes#1#2#3#4#5#6#7#8{%
9.6293 + \voffset = #3\relax
9.6294 + \topskip = #6\relax
9.6295 + \splittopskip = \topskip
9.6296 + %
9.6297 + \vsize = #1\relax
9.6298 + \advance\vsize by \topskip
9.6299 + \outervsize = \vsize
9.6300 + \advance\outervsize by 2\topandbottommargin
9.6301 + \pageheight = \vsize
9.6302 + %
9.6303 + \hsize = #2\relax
9.6304 + \outerhsize = \hsize
9.6305 + \advance\outerhsize by 0.5in
9.6306 + \pagewidth = \hsize
9.6307 + %
9.6308 + \normaloffset = #4\relax
9.6309 + \bindingoffset = #5\relax
9.6310 + %
9.6311 + \ifpdf
9.6312 + \pdfpageheight #7\relax
9.6313 + \pdfpagewidth #8\relax
9.6314 + \fi
9.6315 + %
9.6316 + \setleading{\textleading}
9.6317 + %
9.6318 + \parindent = \defaultparindent
9.6319 + \setemergencystretch
9.6320 +}
9.6321 +
9.6322 +% @letterpaper (the default).
9.6323 +\def\letterpaper{{\globaldefs = 1
9.6324 + \parskip = 3pt plus 2pt minus 1pt
9.6325 + \textleading = 13.2pt
9.6326 + %
9.6327 + % If page is nothing but text, make it come out even.
9.6328 + \internalpagesizes{46\baselineskip}{6in}%
9.6329 + {\voffset}{.25in}%
9.6330 + {\bindingoffset}{36pt}%
9.6331 + {11in}{8.5in}%
9.6332 +}}
9.6333 +
9.6334 +% Use @smallbook to reset parameters for 7x9.5 (or so) format.
9.6335 +\def\smallbook{{\globaldefs = 1
9.6336 + \parskip = 2pt plus 1pt
9.6337 + \textleading = 12pt
9.6338 + %
9.6339 + \internalpagesizes{7.5in}{5in}%
9.6340 + {\voffset}{.25in}%
9.6341 + {\bindingoffset}{16pt}%
9.6342 + {9.25in}{7in}%
9.6343 + %
9.6344 + \lispnarrowing = 0.3in
9.6345 + \tolerance = 700
9.6346 + \hfuzz = 1pt
9.6347 + \contentsrightmargin = 0pt
9.6348 + \defbodyindent = .5cm
9.6349 +}}
9.6350 +
9.6351 +% Use @afourpaper to print on European A4 paper.
9.6352 +\def\afourpaper{{\globaldefs = 1
9.6353 + \parskip = 3pt plus 2pt minus 1pt
9.6354 + \textleading = 13.2pt
9.6355 + %
9.6356 + % Double-side printing via postscript on Laserjet 4050
9.6357 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
9.6358 + % To change the settings for a different printer or situation, adjust
9.6359 + % \normaloffset until the front-side and back-side texts align. Then
9.6360 + % do the same for \bindingoffset. You can set these for testing in
9.6361 + % your texinfo source file like this:
9.6362 + % @tex
9.6363 + % \global\normaloffset = -6mm
9.6364 + % \global\bindingoffset = 10mm
9.6365 + % @end tex
9.6366 + \internalpagesizes{51\baselineskip}{160mm}
9.6367 + {\voffset}{\hoffset}%
9.6368 + {\bindingoffset}{44pt}%
9.6369 + {297mm}{210mm}%
9.6370 + %
9.6371 + \tolerance = 700
9.6372 + \hfuzz = 1pt
9.6373 + \contentsrightmargin = 0pt
9.6374 + \defbodyindent = 5mm
9.6375 +}}
9.6376 +
9.6377 +% Use @afivepaper to print on European A5 paper.
9.6378 +% From romildo@urano.iceb.ufop.br, 2 July 2000.
9.6379 +% He also recommends making @example and @lisp be small.
9.6380 +\def\afivepaper{{\globaldefs = 1
9.6381 + \parskip = 2pt plus 1pt minus 0.1pt
9.6382 + \textleading = 12.5pt
9.6383 + %
9.6384 + \internalpagesizes{160mm}{120mm}%
9.6385 + {\voffset}{\hoffset}%
9.6386 + {\bindingoffset}{8pt}%
9.6387 + {210mm}{148mm}%
9.6388 + %
9.6389 + \lispnarrowing = 0.2in
9.6390 + \tolerance = 800
9.6391 + \hfuzz = 1.2pt
9.6392 + \contentsrightmargin = 0pt
9.6393 + \defbodyindent = 2mm
9.6394 + \tableindent = 12mm
9.6395 +}}
9.6396 +
9.6397 +% A specific text layout, 24x15cm overall, intended for A4 paper.
9.6398 +\def\afourlatex{{\globaldefs = 1
9.6399 + \afourpaper
9.6400 + \internalpagesizes{237mm}{150mm}%
9.6401 + {\voffset}{4.6mm}%
9.6402 + {\bindingoffset}{7mm}%
9.6403 + {297mm}{210mm}%
9.6404 + %
9.6405 + % Must explicitly reset to 0 because we call \afourpaper.
9.6406 + \globaldefs = 0
9.6407 +}}
9.6408 +
9.6409 +% Use @afourwide to print on A4 paper in landscape format.
9.6410 +\def\afourwide{{\globaldefs = 1
9.6411 + \afourpaper
9.6412 + \internalpagesizes{241mm}{165mm}%
9.6413 + {\voffset}{-2.95mm}%
9.6414 + {\bindingoffset}{7mm}%
9.6415 + {297mm}{210mm}%
9.6416 + \globaldefs = 0
9.6417 +}}
9.6418 +
9.6419 +% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
9.6420 +% Perhaps we should allow setting the margins, \topskip, \parskip,
9.6421 +% and/or leading, also. Or perhaps we should compute them somehow.
9.6422 +%
9.6423 +\def\pagesizes{\parsearg\pagesizesxxx}
9.6424 +\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
9.6425 +\def\pagesizesyyy#1,#2,#3\finish{{%
9.6426 + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
9.6427 + \globaldefs = 1
9.6428 + %
9.6429 + \parskip = 3pt plus 2pt minus 1pt
9.6430 + \setleading{\textleading}%
9.6431 + %
9.6432 + \dimen0 = #1
9.6433 + \advance\dimen0 by \voffset
9.6434 + %
9.6435 + \dimen2 = \hsize
9.6436 + \advance\dimen2 by \normaloffset
9.6437 + %
9.6438 + \internalpagesizes{#1}{\hsize}%
9.6439 + {\voffset}{\normaloffset}%
9.6440 + {\bindingoffset}{44pt}%
9.6441 + {\dimen0}{\dimen2}%
9.6442 +}}
9.6443 +
9.6444 +% Set default to letter.
9.6445 +%
9.6446 +\letterpaper
9.6447 +
9.6448 +
9.6449 +\message{and turning on texinfo input format.}
9.6450 +
9.6451 +% Define macros to output various characters with catcode for normal text.
9.6452 +\catcode`\"=\other
9.6453 +\catcode`\~=\other
9.6454 +\catcode`\^=\other
9.6455 +\catcode`\_=\other
9.6456 +\catcode`\|=\other
9.6457 +\catcode`\<=\other
9.6458 +\catcode`\>=\other
9.6459 +\catcode`\+=\other
9.6460 +\catcode`\$=\other
9.6461 +\def\normaldoublequote{"}
9.6462 +\def\normaltilde{~}
9.6463 +\def\normalcaret{^}
9.6464 +\def\normalunderscore{_}
9.6465 +\def\normalverticalbar{|}
9.6466 +\def\normalless{<}
9.6467 +\def\normalgreater{>}
9.6468 +\def\normalplus{+}
9.6469 +\def\normaldollar{$}%$ font-lock fix
9.6470 +
9.6471 +% This macro is used to make a character print one way in ttfont
9.6472 +% where it can probably just be output, and another way in other fonts,
9.6473 +% where something hairier probably needs to be done.
9.6474 +%
9.6475 +% #1 is what to print if we are indeed using \tt; #2 is what to print
9.6476 +% otherwise. Since all the Computer Modern typewriter fonts have zero
9.6477 +% interword stretch (and shrink), and it is reasonable to expect all
9.6478 +% typewriter fonts to have this, we can check that font parameter.
9.6479 +%
9.6480 +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
9.6481 +
9.6482 +% Same as above, but check for italic font. Actually this also catches
9.6483 +% non-italic slanted fonts since it is impossible to distinguish them from
9.6484 +% italic fonts. But since this is only used by $ and it uses \sl anyway
9.6485 +% this is not a problem.
9.6486 +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
9.6487 +
9.6488 +% Turn off all special characters except @
9.6489 +% (and those which the user can use as if they were ordinary).
9.6490 +% Most of these we simply print from the \tt font, but for some, we can
9.6491 +% use math or other variants that look better in normal text.
9.6492 +
9.6493 +\catcode`\"=\active
9.6494 +\def\activedoublequote{{\tt\char34}}
9.6495 +\let"=\activedoublequote
9.6496 +\catcode`\~=\active
9.6497 +\def~{{\tt\char126}}
9.6498 +\chardef\hat=`\^
9.6499 +\catcode`\^=\active
9.6500 +\def^{{\tt \hat}}
9.6501 +
9.6502 +\catcode`\_=\active
9.6503 +\def_{\ifusingtt\normalunderscore\_}
9.6504 +% Subroutine for the previous macro.
9.6505 +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
9.6506 +
9.6507 +\catcode`\|=\active
9.6508 +\def|{{\tt\char124}}
9.6509 +\chardef \less=`\<
9.6510 +\catcode`\<=\active
9.6511 +\def<{{\tt \less}}
9.6512 +\chardef \gtr=`\>
9.6513 +\catcode`\>=\active
9.6514 +\def>{{\tt \gtr}}
9.6515 +\catcode`\+=\active
9.6516 +\def+{{\tt \char 43}}
9.6517 +\catcode`\$=\active
9.6518 +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
9.6519 +
9.6520 +% Set up an active definition for =, but don't enable it most of the time.
9.6521 +{\catcode`\==\active
9.6522 +\global\def={{\tt \char 61}}}
9.6523 +
9.6524 +\catcode`+=\active
9.6525 +\catcode`\_=\active
9.6526 +
9.6527 +% If a .fmt file is being used, characters that might appear in a file
9.6528 +% name cannot be active until we have parsed the command line.
9.6529 +% So turn them off again, and have \everyjob (or @setfilename) turn them on.
9.6530 +% \otherifyactive is called near the end of this file.
9.6531 +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
9.6532 +
9.6533 +\catcode`\@=0
9.6534 +
9.6535 +% \rawbackslashxx outputs one backslash character in current font,
9.6536 +% as in \char`\\.
9.6537 +\global\chardef\rawbackslashxx=`\\
9.6538 +
9.6539 +% \rawbackslash defines an active \ to do \rawbackslashxx.
9.6540 +% \otherbackslash defines an active \ to be a literal `\' character with
9.6541 +% catcode other.
9.6542 +{\catcode`\\=\active
9.6543 + @gdef@rawbackslash{@let\=@rawbackslashxx}
9.6544 + @gdef@otherbackslash{@let\=@realbackslash}
9.6545 +}
9.6546 +
9.6547 +% \realbackslash is an actual character `\' with catcode other.
9.6548 +{\catcode`\\=\other @gdef@realbackslash{\}}
9.6549 +
9.6550 +% \normalbackslash outputs one backslash in fixed width font.
9.6551 +\def\normalbackslash{{\tt\rawbackslashxx}}
9.6552 +
9.6553 +\catcode`\\=\active
9.6554 +
9.6555 +% Used sometimes to turn off (effectively) the active characters
9.6556 +% even after parsing them.
9.6557 +@def@turnoffactive{%
9.6558 + @let"=@normaldoublequote
9.6559 + @let\=@realbackslash
9.6560 + @let~=@normaltilde
9.6561 + @let^=@normalcaret
9.6562 + @let_=@normalunderscore
9.6563 + @let|=@normalverticalbar
9.6564 + @let<=@normalless
9.6565 + @let>=@normalgreater
9.6566 + @let+=@normalplus
9.6567 + @let$=@normaldollar %$ font-lock fix
9.6568 +}
9.6569 +
9.6570 +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
9.6571 +% the literal character `\'. (Thus, \ is not expandable when this is in
9.6572 +% effect.)
9.6573 +%
9.6574 +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
9.6575 +
9.6576 +% Make _ and + \other characters, temporarily.
9.6577 +% This is canceled by @fixbackslash.
9.6578 +@otherifyactive
9.6579 +
9.6580 +% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
9.6581 +% That is what \eatinput is for; after that, the `\' should revert to printing
9.6582 +% a backslash.
9.6583 +%
9.6584 +@gdef@eatinput input texinfo{@fixbackslash}
9.6585 +@global@let\ = @eatinput
9.6586 +
9.6587 +% On the other hand, perhaps the file did not have a `\input texinfo'. Then
9.6588 +% the first `\{ in the file would cause an error. This macro tries to fix
9.6589 +% that, assuming it is called before the first `\' could plausibly occur.
9.6590 +% Also back turn on active characters that might appear in the input
9.6591 +% file name, in case not using a pre-dumped format.
9.6592 +%
9.6593 +@gdef@fixbackslash{%
9.6594 + @ifx\@eatinput @let\ = @normalbackslash @fi
9.6595 + @catcode`+=@active
9.6596 + @catcode`@_=@active
9.6597 +}
9.6598 +
9.6599 +% Say @foo, not \foo, in error messages.
9.6600 +@escapechar = `@@
9.6601 +
9.6602 +% These look ok in all fonts, so just make them not special.
9.6603 +@catcode`@& = @other
9.6604 +@catcode`@# = @other
9.6605 +@catcode`@% = @other
9.6606 +
9.6607 +@c Set initial fonts.
9.6608 +@textfonts
9.6609 +@rm
9.6610 +
9.6611 +
9.6612 +@c Local variables:
9.6613 +@c eval: (add-hook 'write-file-hooks 'time-stamp)
9.6614 +@c page-delimiter: "^\\\\message"
9.6615 +@c time-stamp-start: "def\\\\texinfoversion{"
9.6616 +@c time-stamp-format: "%:y-%02m-%02d.%02H"
9.6617 +@c time-stamp-end: "}"
9.6618 +@c End:
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/src/work/alpar/attic/texi/version.texi Thu Apr 29 08:42:05 2004 +0000
10.3 @@ -0,0 +1,2 @@
10.4 +@set VERSION 0.0.2
10.5 +@set UPDATED 2004