• R/O
  • HTTP
  • SSH
  • HTTPS

jm: 提交

翻訳ドキュメント管理用


Commit MetaInfo

修訂a9bcd919e6bc47c79aff832c5ac15c7215d951ee (tree)
時間2023-07-02 11:05:09
作者cyoichi <cyoichi@user...>
Commitercyoichi

Log Message

info: Remove the build-aux directory.

We don't make any pdf files here, so these files became unnecessary.

deleted: build-aux/po4a-texi.mk
deleted: build-aux/texi2pod.pl
deleted: build-aux/texinfo-ja.tex
deleted: build-aux/texinfo-modified.tex
deleted: build-aux/texinfo.tex
deleted: build-aux/txi-ja.tex

Change Summary

  • delete: info/build-aux/po4a-texi.mk
  • delete: info/build-aux/texi2pod.pl
  • delete: info/build-aux/texinfo-ja.tex
  • delete: info/build-aux/texinfo-modified.tex
  • delete: info/build-aux/texinfo.tex
  • delete: info/build-aux/txi-ja.tex

差異

--- a/info/build-aux/po4a-texi.mk
+++ /dev/null
@@ -1,98 +0,0 @@
1-texi_sources = $(texi_source_main) $(texi_source_others)
2-
3-original_source_main = ${addprefix original/texi/,$(texi_source_main)}
4-original_source_others = ${addprefix original/texi/,$(texi_source_others)}
5-original_sources = $(original_source_main) $(original_source_others)
6-
7-ifdef PACKAGE_SUBNAME
8- po_source = po4a/texi/$(PACKAGE_SUBNAME).po
9- target_htmldir = draft/html/$(PACKAGE_SUBNAME)
10- target_info = draft/info/$(PACKAGE_SUBNAME).info
11- target_plaintext = draft/text/$(PACKAGE_SUBNAME).txt
12- target_pdf = draft/pdf/$(PACKAGE_SUBNAME).pdf
13- target_pod = draft/pod/$(PACKAGE_SUBNAME).pod
14-else
15- po_source = po4a/texi/ja.po
16- target_htmldir = draft/html
17- target_info = draft/info/$(PACKAGE_NAME).info
18- target_plaintext = draft/text/$(PACKAGE_NAME).txt
19- target_pdf = draft/pdf/$(PACKAGE_NAME).pdf
20- target_pod = draft/pod/$(PACKAGE_NAME).pod
21-endif
22-
23-target_source_main = ${addprefix draft/texi/,$(texi_source_main)}
24-target_source_others = ${addprefix draft/texi/,$(texi_source_others)}
25-target_sources = $(target_source_main) $(target_source_others)
26-
27-target_html = $(target_htmldir)/index.html
28-target_man = draft/man/man1/$(PACKAGE_NAME).1
29-
30-POTFILE=po4a/texi/$(PACKAGE_NAME)-texi.pot
31-ifdef PACKAGE_SUBNAME
32- POFILE=po4a/texi/$(PACKAGE_SUBNAME).po
33-else
34- POFILE=po4a/texi/ja.po
35-endif
36-
37-.DEFAULT_GOAL := all
38-all: extra_texi info #html text pdf
39-
40-info: $(target_info)
41-$(target_info): $(target_sources)
42- makeinfo -o $@ $(target_source_main)
43-#$(target_source_main): $(target_source_others)
44-
45-original-info: $(original_sources)
46- mkdir -p tmp/info
47- makeinfo -o tmp/info/$(PACKAGE_NAME).info $<
48-
49-html: $(target_html)
50-$(target_html): $(target_sources)
51- makeinfo --html -o $(target_htmldir) $(target_source_main)
52-
53-text: $(target_plaintext)
54-$(target_plaintext): $(target_sources)
55- makeinfo --plaintext -o $@ $(target_source_main)
56-
57-pdf: $(target_pdf)
58-$(target_pdf): texi
59- mkdir -p draft/pdf
60- cd draft/pdf && \
61- TEXINPUTS=../../../build-aux: PDFTEX=xetex texi2pdf ../../$(target_source_main)
62-
63-$(target_sources): $(original_sources) $(po_source) $(PO4ACFG)
64- po4a $(PO4AFLAGS) -v --previous $(PO4ACFG)
65- @sed -i -e "s|$(PWD)/||g" $(POTFILE)
66- @sed -i -e "s|$(PWD)/||g" $(POFILE)
67- @sed -i -e "s/\(\\input texinfo\) /\1\-ja /" $(target_source_main)
68- @touch $(target_sources)
69-$(po_source):
70- po4a $(PO4AFLAGS) -v --previous $(PO4ACFG)
71- @sed -i -e "s|$(PWD)/||g" $(POTFILE)
72- @sed -i -e "s|$(PWD)/||g" $(POFILE)
73- @sed -i -e "s/\(\\input texinfo\) /\1\-ja /" $(target_source_main)
74- @touch $(target_sources)
75-#M#texibuild:
76-
77-extra_texi::
78-
79-pod: $(target_pod)
80-$(target_pod): $(target_source_main)
81- @mkdir -p $(@D)
82- $(eval VERSION=$(shell grep '^@set VERSION' draft/texi/version.texi | sed -e "s/\@set VERSION //"))
83- @../build-aux/texi2pod.pl -D VERSION="$(VERSION)" $(target_source_main) $@
84-
85-man: $(target_man)
86-$(target_man): $(target_pod)
87- @mkdir -p $(@D)
88- pod2man --center="$(FULL_PACKAGE_NAME)" --release="$(FULL_PACKAGE_NAME) $(PACKAGE_VERSION)" --utf8 $? > $@ || \
89- pod2man --center="$(FULL_PACKAGE_NAME)" --release="$(FULL_PACKAGE_NAME) $(PACKAGE_VERSION)" $? > $@
90-
91-stat:
92- @echo -n $(po_source)": "
93- @msgfmt --statistics -o /dev/null $(po_source)
94-
95-clean:
96- rm -f draft/pdf/$(PACKAGE_MAIN).{aux,cp,cps,fn,fns,log,tmp,toc}
97-
98-.PHONY: all info html text dvi pdf texi texibuild extra_texi pod man stat clean
--- a/info/build-aux/texi2pod.pl
+++ /dev/null
@@ -1,453 +0,0 @@
1-#! /usr/bin/env perl
2-
3-# Copyright (C) 1999-2001, 2003, 2007, 2009-2011, 2015, 2018-2021 Free
4-# Software Foundation, Inc.
5-
6-# This file is part of GCC.
7-
8-# GCC is free software; you can redistribute it and/or modify
9-# it under the terms of the GNU General Public License as published by
10-# the Free Software Foundation; either version 3, or (at your option)
11-# any later version.
12-
13-# GCC is distributed in the hope that it will be useful,
14-# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-# GNU General Public License for more details.
17-
18-# You should have received a copy of the GNU General Public License
19-# along with GCC. If not, see <http://www.gnu.org/licenses/>.
20-
21-# This does trivial (and I mean _trivial_) conversion of Texinfo
22-# markup to Perl POD format. It's intended to be used to extract
23-# something suitable for a manpage from a Texinfo document.
24-
25-use warnings;
26-BEGIN { eval { require warnings; } and warnings->import; }
27-
28-$output = 0;
29-$skipping = 0;
30-%sects = ();
31-$section = "";
32-@icstack = ();
33-@endwstack = ();
34-@skstack = ();
35-@instack = ();
36-$shift = "";
37-%defs = ();
38-$fnno = 1;
39-$inf = "";
40-$ibase = "";
41-
42-while ($_ = shift) {
43- if (/^-D(.*)$/) {
44- if ($1 ne "") {
45- $flag = $1;
46- } else {
47- $flag = shift;
48- }
49- $value = "";
50- ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
51- die "no flag specified for -D\n"
52- unless $flag ne "";
53- die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
54- unless $flag =~ /^[a-zA-Z0-9_-]+$/;
55- $defs{$flag} = $value;
56- } elsif (/^-/) {
57- usage();
58- } else {
59- $in = $_, next unless defined $in;
60- $out = $_, next unless defined $out;
61- usage();
62- }
63-}
64-
65-if (defined $in) {
66- $inf = gensym();
67- open($inf, "<$in") or die "opening \"$in\": $!\n";
68- $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
69-} else {
70- $inf = \*STDIN;
71-}
72-
73-if (defined $out) {
74- open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
75-}
76-
77-while(defined $inf) {
78-while(<$inf>) {
79- # Certain commands are discarded without further processing.
80- /^\@(?:
81- [a-z]+index # @*index: useful only in complete manual
82- |need # @need: useful only in printed manual
83- |(?:end\s+)?group # @group .. @end group: ditto
84- |page # @page: ditto
85- |node # @node: useful only in .info file
86- |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents
87- )\b/x and next;
88-
89- chomp;
90-
91- # Look for filename and title markers.
92- /^\@setfilename\s+([^.]+)/ and $fn = $1, next;
93- /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
94-
95- # Identify a man title but keep only the one we are interested in.
96- /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
97- if (exists $defs{$1}) {
98- $fn = $1;
99- $tl = postprocess($2);
100- }
101- next;
102- };
103-
104- # Look for blocks surrounded by @c man begin SECTION ... @c man end.
105- # This really oughta be @ifman ... @end ifman and the like, but such
106- # would require rev'ing all other Texinfo translators.
107- /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
108- $output = 1 if exists $defs{$2};
109- $sect = $1;
110- next;
111- };
112- /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
113- /^\@c\s+man\s+end/ and do {
114- $sects{$sect} = "" unless exists $sects{$sect};
115- $sects{$sect} .= postprocess($section);
116- $section = "";
117- $output = 0;
118- next;
119- };
120-
121- # handle variables
122- /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
123- $defs{$1} = $2;
124- next;
125- };
126- /^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
127- delete $defs{$1};
128- next;
129- };
130-
131- next unless $output;
132-
133- # Discard comments. (Can't do it above, because then we'd never see
134- # @c man lines.)
135- /^\@c\b/ and next;
136-
137- # End-block handler goes up here because it needs to operate even
138- # if we are skipping.
139- /^\@end\s+([a-z]+)/ and do {
140- # Ignore @end foo, where foo is not an operation which may
141- # cause us to skip, if we are presently skipping.
142- my $ended = $1;
143- next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copying)$/;
144-
145- die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
146- die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
147-
148- $endw = pop @endwstack;
149-
150- if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
151- $skipping = pop @skstack;
152- next;
153- } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
154- $shift = "";
155- $_ = ""; # need a paragraph break
156- } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
157- $_ = "\n=back\n";
158- $ic = pop @icstack;
159- } else {
160- die "unknown command \@end $ended at line $.\n";
161- }
162- };
163-
164- # We must handle commands which can cause skipping even while we
165- # are skipping, otherwise we will not process nested conditionals
166- # correctly.
167- /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
168- push @endwstack, $endw;
169- push @skstack, $skipping;
170- $endw = "ifset";
171- $skipping = 1 unless exists $defs{$1};
172- next;
173- };
174-
175- /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
176- push @endwstack, $endw;
177- push @skstack, $skipping;
178- $endw = "ifclear";
179- $skipping = 1 if exists $defs{$1};
180- next;
181- };
182-
183- /^\@(ignore|menu|iftex|copying)\b/ and do {
184- push @endwstack, $endw;
185- push @skstack, $skipping;
186- $endw = $1;
187- $skipping = 1;
188- next;
189- };
190-
191- next if $skipping;
192-
193- # Character entities. First the ones that can be replaced by raw text
194- # or discarded outright:
195- s/\@copyright\{\}/(c)/g;
196- s/\@dots\{\}/.../g;
197- s/\@enddots\{\}/..../g;
198- s/\@([.!? ])/$1/g;
199- s/\@[:-]//g;
200- s/\@bullet(?:\{\})?/*/g;
201- s/\@TeX\{\}/TeX/g;
202- s/\@pounds\{\}/\#/g;
203- s/\@minus(?:\{\})?/-/g;
204- s/\\,/,/g;
205-
206- # Now the ones that have to be replaced by special escapes
207- # (which will be turned back into text by unmunge())
208- s/&/&amp;/g;
209- s/\@\@/&at;/g;
210- s/\@\{/&lbrace;/g;
211- s/\@\}/&rbrace;/g;
212-
213- # Inside a verbatim block, handle @var specially.
214- if ($shift ne "") {
215- s/\@var\{([^\}]*)\}/<$1>/g;
216- }
217-
218- # POD doesn't interpret E<> inside a verbatim block.
219- if ($shift eq "") {
220- s/</&lt;/g;
221- s/>/&gt;/g;
222- } else {
223- s/</&LT;/g;
224- s/>/&GT;/g;
225- }
226-
227- # Single line command handlers.
228-
229- /^\@include\s+(.+)$/ and do {
230- push @instack, $inf;
231- $inf = gensym();
232- $file = postprocess($1);
233-
234- # Try cwd and $ibase.
235- open($inf, "<" . $file)
236- or open($inf, "<" . $ibase . "/" . $file)
237- or die "cannot open $file or $ibase/$file: $!\n";
238- next;
239- };
240-
241- /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
242- and $_ = "\n=head2 $1\n";
243- /^\@subsection\s+(.+)$/
244- and $_ = "\n=head3 $1\n";
245-
246- # Block command handlers:
247- /^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
248- push @endwstack, $endw;
249- push @icstack, $ic;
250- if (defined $1) {
251- $ic = $1;
252- } else {
253- $ic = '@bullet';
254- }
255- $_ = "\n=over 4\n";
256- $endw = "itemize";
257- };
258-
259- /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
260- push @endwstack, $endw;
261- push @icstack, $ic;
262- if (defined $1) {
263- $ic = $1 . ".";
264- } else {
265- $ic = "1.";
266- }
267- $_ = "\n=over 4\n";
268- $endw = "enumerate";
269- };
270-
271- /^\@([fv]?table)\s+(\@[a-z]+)/ and do {
272- push @endwstack, $endw;
273- push @icstack, $ic;
274- $endw = $1;
275- $ic = $2;
276- $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/;
277- $ic =~ s/\@(?:code|kbd)/C/;
278- $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
279- $ic =~ s/\@(?:file)/F/;
280- $_ = "\n=over 4\n";
281- };
282-
283- /^\@((?:small)?example|display)/ and do {
284- push @endwstack, $endw;
285- $endw = $1;
286- $shift = "\t";
287- $_ = ""; # need a paragraph break
288- };
289-
290- /^\@itemx?\s*(.+)?$/ and do {
291- if (defined $1) {
292- my $thing = $1;
293- if ($ic =~ /\@asis/) {
294- $_ = "\n=item C<$thing>\n";
295- } else {
296- # Entity escapes prevent munging by the <> processing below.
297- $_ = "\n=item $ic\&LT;$thing\&GT;\n";
298- }
299- } else {
300- $_ = "\n=item $ic\n";
301- $ic =~ y/A-Ya-y/B-Zb-z/;
302- $ic =~ s/(\d+)/$1 + 1/eg;
303- }
304- };
305-
306- $section .= $shift.$_."\n";
307-}
308-# End of current file.
309-close($inf);
310-$inf = pop @instack;
311-}
312-
313-die "No filename or title\n" unless defined $fn && defined $tl;
314-
315-$sects{NAME} = "$fn \- $tl\n";
316-$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
317-
318-print "=encoding utf-8\n\n";
319-
320-for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXITSTATUS
321- FILES BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
322- if(exists $sects{$sect}) {
323- $head = $sect;
324- $head =~ s/SEEALSO/SEE ALSO/;
325- $head =~ s/EXITSTATUS/EXIT STATUS/;
326- print "=head1 $head\n\n";
327- print scalar unmunge ($sects{$sect});
328- print "\n";
329- }
330-}
331-
332-sub usage
333-{
334- die "usage: $0 [-D toggle...] [infile [outfile]]\n";
335-}
336-
337-sub postprocess
338-{
339- local $_ = $_[0];
340-
341- # @value{foo} is replaced by whatever 'foo' is defined as.
342- while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
343- if (! exists $defs{$2}) {
344- print STDERR "Option $2 not defined\n";
345- s/\Q$1\E//;
346- } else {
347- $value = $defs{$2};
348- s/\Q$1\E/$value/;
349- }
350- }
351-
352- # Formatting commands.
353- # Temporary escape for @r.
354- s/\@r\{([^\}]*)\}/R<$1>/g;
355- s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
356- s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
357- s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
358- s/\@sc\{([^\}]*)\}/\U$1/g;
359- s/\@file\{([^\}]*)\}/F<$1>/g;
360- s/\@w\{([^\}]*)\}/S<$1>/g;
361- s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
362-
363- # keep references of the form @ref{...}, print them bold
364- s/\@(?:ref)\{([^\}]*)\}/B<$1>/g;
365-
366- # Change double single quotes to double quotes.
367- s/''/"/g;
368- s/``/"/g;
369-
370- # Cross references are thrown away, as are @noindent and @refill.
371- # (@noindent is impossible in .pod, and @refill is unnecessary.)
372- # @* is also impossible in .pod; we discard it and any newline that
373- # follows it. Similarly, our macro @gol must be discarded.
374-
375- s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
376- s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
377- s/;\s+\@pxref\{(?:[^\}]*)\}//g;
378- s/\@noindent\s*//g;
379- s/\@refill//g;
380- s/\@gol//g;
381- s/\@\*\s*\n?//g;
382-
383- # @uref can take one, two, or three arguments, with different
384- # semantics each time. @url and @email are just like @uref with
385- # one argument, for our purposes.
386- s/\@(?:uref|url|email)\{([^\},]*)\}/&lt;B<$1>&gt;/g;
387- s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
388- s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
389-
390- # Un-escape <> at this point.
391- s/&LT;/</g;
392- s/&GT;/>/g;
393-
394- # Now un-nest all B<>, I<>, R<>. Theoretically we could have
395- # indefinitely deep nesting; in practice, one level suffices.
396- 1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1</g;
397-
398- # Replace R<...> with bare ...; eliminate empty markup, B<>;
399- # shift white space at the ends of [BI]<...> expressions outside
400- # the expression.
401- s/R<([^<>]*)>/$1/g;
402- s/[BI]<>//g;
403- s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g;
404- s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g;
405-
406- # Extract footnotes. This has to be done after all other
407- # processing because otherwise the regexp will choke on formatting
408- # inside @footnote.
409- while (/\@footnote/g) {
410- s/\@footnote\{([^\}]+)\}/[$fnno]/;
411- add_footnote($1, $fnno);
412- $fnno++;
413- }
414-
415- return $_;
416-}
417-
418-sub unmunge
419-{
420- # Replace escaped symbols with their equivalents.
421- local $_ = $_[0];
422-
423- s/&lt;/E<lt>/g;
424- s/&gt;/E<gt>/g;
425- s/&lbrace;/\{/g;
426- s/&rbrace;/\}/g;
427- s/&at;/\@/g;
428- s/&amp;/&/g;
429- return $_;
430-}
431-
432-sub add_footnote
433-{
434- unless (exists $sects{FOOTNOTES}) {
435- $sects{FOOTNOTES} = "\n=over 4\n\n";
436- }
437-
438- $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
439- $sects{FOOTNOTES} .= $_[0];
440- $sects{FOOTNOTES} .= "\n\n";
441-}
442-
443-# stolen from Symbol.pm
444-{
445- my $genseq = 0;
446- sub gensym
447- {
448- my $name = "GEN" . $genseq++;
449- my $ref = \*{$name};
450- delete $::{$name};
451- return $ref;
452- }
453-}
--- a/info/build-aux/texinfo-ja.tex
+++ /dev/null
@@ -1,84 +0,0 @@
1-% texinfo-ja.tex -- Japanese texinfo.tex loader
2-% Some CJK packages are necessary to load before texinfo.tex.
3-%
4-% Copyright 2016, 2017 Free Software Foundation, Inc.
5-%
6-% This program is free software; you can redistribute it and/or modify
7-% it under the terms of the GNU General Public License as published by
8-% the Free Software Foundation; either version 3 of the license, or (at
9-% your option) any later version.
10-%
11-% This program is distributed in the hope that it will be useful,
12-% but WITHOUT ANY WARRANTY; without even the implied warranty of
13-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-% GNU General Public License for more details.
15-%
16-% You should have received a copy of the GNU General Public License
17-% along with this program. If not, see <http://www.gnu.org/licenses/>.
18-%
19-% Written by Masamichi Hosoda, 6 May 2016, <trueroad@trueroad.jp>
20-
21-%
22-% For LuaTeX
23-%
24-\ifx\luatexversion\thisisundefined
25-\else
26- % LuaTeX 0.95+ is required.
27- \ifnum\luatexversion<95
28- \errmessage{LuaTeX 0.95+ is required}
29- \fi
30- % LuaTeX-ja: Typeset Japanese with Lua(La)TeX
31- % http://www.ctan.org/tex-archive/macros/luatex/generic/luatexja
32- \openin 1 luatexja.sty \ifeof 1
33- \errmessage{LuaTeX-ja is not found.
34- It is required for Japanese Texinfo files with LuaTeX.
35- http://www.ctan.org/tex-archive/macros/luatex/generic/luatexja
36- It might be contained in texlive-lang-japanese package}
37- \else
38- \input luatexja.sty
39- \def\txijapackage{LaTeX-ja}
40- \fi
41-\fi
42-
43-%
44-% For XeTeX
45-%
46-\ifx\XeTeXrevision\thisisundefined
47-\else
48- % XeTeX 0.9998+ is required.
49- \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.9998}<0
50- \errmessage{XeTeX 0.9998+ is required}
51- \fi
52- % zhspacing: Spacing for mixed CJK-English documents in XeTeX
53- % http://www.ctan.org/tex-archive/macros/xetex/generic/zhspacing
54- %
55- % This package is originally for Chinese,
56- % but can also used in Japanese.
57- %
58- \openin 1 zhspacing.sty \ifeof 1
59- \errmessage{zhspacing is not found.
60- It is required for Japanese Texinfo files with XeTeX.
61- http://www.ctan.org/tex-archive/macros/xetex/generic/zhspacing
62- It might be contained in texlive-lang-chinese.
63- (This package is for Chinese, but can also used in Japanese)}
64- \else
65- \def\zhfont{dummy} % Cancel the request of SimSun font
66- \def\zhpunctfont{dummy} % Cancel the request of SimSun font
67- \input zhspacing.sty
68- \zhspacing
69- \def\txijapackage{zhspacing}
70- \fi
71-\fi
72-
73-%
74-% For others
75-%
76-\ifx\luatexversion\thisisundefined
77- \ifx\XeTeXrevision\thisisundefined
78- \errmessage{The TeX engine is not LuaTeX / XeTeX.
79- LuaTeX / XeTeX is required for Japanese Texinfo files}
80- \fi
81-\fi
82-
83-% Original texinfo.tex, but the modified version!
84-\input texinfo-modified.tex
--- a/info/build-aux/texinfo-modified.tex
+++ /dev/null
@@ -1,11619 +0,0 @@
1-% texinfo.tex -- TeX macros to handle Texinfo files.
2-%
3-% Load plain if necessary, i.e., if running under initex.
4-\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5-%
6-\def\texinfoversion{2021-04-25.21}
7-%
8-% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
9-%
10-% This texinfo.tex file is free software: you can redistribute it and/or
11-% modify it under the terms of the GNU General Public License as
12-% published by the Free Software Foundation, either version 3 of the
13-% License, or (at your option) any later version.
14-%
15-% This texinfo.tex file is distributed in the hope that it will be
16-% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17-% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18-% General Public License for more details.
19-%
20-% You should have received a copy of the GNU General Public License
21-% along with this program. If not, see <https://www.gnu.org/licenses/>.
22-%
23-% As a special exception, when this file is read by TeX when processing
24-% a Texinfo source document, you may use the result without
25-% restriction. This Exception is an additional permission under section 7
26-% of the GNU General Public License, version 3 ("GPLv3").
27-%
28-% Please try the latest version of texinfo.tex before submitting bug
29-% reports; you can get the latest version from:
30-% https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31-% https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32-% https://www.gnu.org/software/texinfo/ (the Texinfo home page)
33-% The texinfo.tex in any given distribution could well be out
34-% of date, so if that's what you're using, please check.
35-%
36-% Send bug reports to bug-texinfo@gnu.org. Please include a
37-% complete document in each bug report with which we can reproduce the
38-% problem. Patches are, of course, greatly appreciated.
39-%
40-% To process a Texinfo manual with TeX, it's most reliable to use the
41-% texi2dvi shell script that comes with the distribution. For a simple
42-% manual foo.texi, however, you can get away with this:
43-% tex foo.texi
44-% texindex foo.??
45-% tex foo.texi
46-% tex foo.texi
47-% dvips foo.dvi -o # or whatever; this makes foo.ps.
48-% The extra TeX runs get the cross-reference information correct.
49-% Sometimes one run after texindex suffices, and sometimes you need more
50-% than two; texi2dvi does it as many times as necessary.
51-%
52-% It is possible to adapt texinfo.tex for other languages, to some
53-% extent. You can get the existing language-specific files from the
54-% full Texinfo distribution.
55-%
56-% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
57-
58-
59-\message{Loading texinfo [version \texinfoversion]:}
60-
61-% If in a .fmt file, print the version number
62-% and turn on active characters that we couldn't do earlier because
63-% they might have appeared in the input file name.
64-\everyjob{\message{[Texinfo version \texinfoversion]}%
65- \catcode`+=\active \catcode`\_=\active}
66-
67-% LaTeX's \typeout. This ensures that the messages it is used for
68-% are identical in format to the corresponding ones from latex/pdflatex.
69-\def\typeout{\immediate\write17}%
70-
71-\chardef\other=12
72-
73-% We never want plain's \outer definition of \+ in Texinfo.
74-% For @tex, we can use \tabalign.
75-\let\+ = \relax
76-
77-% Save some plain tex macros whose names we will redefine.
78-\let\ptexb=\b
79-\let\ptexbullet=\bullet
80-\let\ptexc=\c
81-\let\ptexcomma=\,
82-\let\ptexdot=\.
83-\let\ptexdots=\dots
84-\let\ptexend=\end
85-\let\ptexequiv=\equiv
86-\let\ptexexclam=\!
87-\let\ptexfootnote=\footnote
88-\let\ptexgtr=>
89-\let\ptexhat=^
90-\let\ptexi=\i
91-\let\ptexindent=\indent
92-\let\ptexinsert=\insert
93-\let\ptexlbrace=\{
94-\let\ptexless=<
95-\let\ptexnewwrite\newwrite
96-\let\ptexnoindent=\noindent
97-\let\ptexplus=+
98-\let\ptexraggedright=\raggedright
99-\let\ptexrbrace=\}
100-\let\ptexslash=\/
101-\let\ptexsp=\sp
102-\let\ptexstar=\*
103-\let\ptexsup=\sup
104-\let\ptext=\t
105-\let\ptextop=\top
106-{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
107-
108-% If this character appears in an error message or help string, it
109-% starts a new line in the output.
110-\newlinechar = `^^J
111-
112-% Use TeX 3.0's \inputlineno to get the line number, for better error
113-% messages, but if we're using an old version of TeX, don't do anything.
114-%
115-\ifx\inputlineno\thisisundefined
116- \let\linenumber = \empty % Pre-3.0.
117-\else
118- \def\linenumber{l.\the\inputlineno:\space}
119-\fi
120-
121-% Set up fixed words for English if not already set.
122-\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
123-\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
124-\ifx\putworderror\undefined \gdef\putworderror{error}\fi
125-\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
126-\ifx\putwordin\undefined \gdef\putwordin{in}\fi
127-\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
128-\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
129-\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
130-\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
131-\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
132-\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
133-\ifx\putwordof\undefined \gdef\putwordof{of}\fi
134-\ifx\putwordon\undefined \gdef\putwordon{on}\fi
135-\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
136-\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
137-\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
138-\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
139-\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
140-\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
141-\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
142-%
143-\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
144-\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
145-\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
146-\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
147-\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
148-\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
149-\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
150-\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
151-\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
152-\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
153-\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
154-\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
155-%
156-\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
157-\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
158-\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
159-\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
160-\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
161-
162-% Give the space character the catcode for a space.
163-\def\spaceisspace{\catcode`\ =10\relax}
164-
165-% Likewise for ^^M, the end of line character.
166-\def\endlineisspace{\catcode13=10\relax}
167-
168-\chardef\dashChar = `\-
169-\chardef\slashChar = `\/
170-\chardef\underChar = `\_
171-
172-% Ignore a token.
173-%
174-\def\gobble#1{}
175-
176-% The following is used inside several \edef's.
177-\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
178-
179-% Hyphenation fixes.
180-\hyphenation{
181- Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
182- ap-pen-dix bit-map bit-maps
183- data-base data-bases eshell fall-ing half-way long-est man-u-script
184- man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
185- par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
186- spell-ing spell-ings
187- stand-alone strong-est time-stamp time-stamps which-ever white-space
188- wide-spread wrap-around
189-}
190-
191-% Sometimes it is convenient to have everything in the transcript file
192-% and nothing on the terminal. We don't just call \tracingall here,
193-% since that produces some useless output on the terminal. We also make
194-% some effort to order the tracing commands to reduce output in the log
195-% file; cf. trace.sty in LaTeX.
196-%
197-\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
198-\def\loggingall{%
199- \tracingstats2
200- \tracingpages1
201- \tracinglostchars2 % 2 gives us more in etex
202- \tracingparagraphs1
203- \tracingoutput1
204- \tracingmacros2
205- \tracingrestores1
206- \showboxbreadth\maxdimen \showboxdepth\maxdimen
207- \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
208- \tracingscantokens1
209- \tracingifs1
210- \tracinggroups1
211- \tracingnesting2
212- \tracingassigns1
213- \fi
214- \tracingcommands3 % 3 gives us more in etex
215- \errorcontextlines16
216-}%
217-
218-% @errormsg{MSG}. Do the index-like expansions on MSG, but if things
219-% aren't perfect, it's not the end of the world, being an error message,
220-% after all.
221-%
222-\def\errormsg{\begingroup \indexnofonts \doerrormsg}
223-\def\doerrormsg#1{\errmessage{#1}}
224-
225-% add check for \lastpenalty to plain's definitions. If the last thing
226-% we did was a \nobreak, we don't want to insert more space.
227-%
228-\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
229- \removelastskip\penalty-50\smallskip\fi\fi}
230-\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
231- \removelastskip\penalty-100\medskip\fi\fi}
232-\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
233- \removelastskip\penalty-200\bigskip\fi\fi}
234-
235-% Output routine
236-%
237-
238-% For a final copy, take out the rectangles
239-% that mark overfull boxes (in case you have decided
240-% that the text looks ok even though it passes the margin).
241-%
242-\def\finalout{\overfullrule=0pt }
243-
244-\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
245-\newdimen\topandbottommargin \topandbottommargin=.75in
246-
247-% Output a mark which sets \thischapter, \thissection and \thiscolor.
248-% We dump everything together because we only have one kind of mark.
249-% This works because we only use \botmark / \topmark, not \firstmark.
250-%
251-% A mark contains a subexpression of the \ifcase ... \fi construct.
252-% \get*marks macros below extract the needed part using \ifcase.
253-%
254-% Another complication is to let the user choose whether \thischapter
255-% (\thissection) refers to the chapter (section) in effect at the top
256-% of a page, or that at the bottom of a page.
257-
258-% \domark is called twice inside \chapmacro, to add one
259-% mark before the section break, and one after.
260-% In the second call \prevchapterdefs is the same as \currentchapterdefs,
261-% and \prevsectiondefs is the same as \currentsectiondefs.
262-% Then if the page is not broken at the mark, some of the previous
263-% section appears on the page, and we can get the name of this section
264-% from \firstmark for @everyheadingmarks top.
265-% @everyheadingmarks bottom uses \botmark.
266-%
267-% See page 260 of The TeXbook.
268-\def\domark{%
269- \toks0=\expandafter{\currentchapterdefs}%
270- \toks2=\expandafter{\currentsectiondefs}%
271- \toks4=\expandafter{\prevchapterdefs}%
272- \toks6=\expandafter{\prevsectiondefs}%
273- \toks8=\expandafter{\currentcolordefs}%
274- \mark{%
275- \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
276- \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
277- \noexpand\else \the\toks8 % 2: color marks
278- }%
279-}
280-
281-% \gettopheadingmarks, \getbottomheadingmarks,
282-% \getcolormarks - extract needed part of mark.
283-%
284-% \topmark doesn't work for the very first chapter (after the title
285-% page or the contents), so we use \firstmark there -- this gets us
286-% the mark with the chapter defs, unless the user sneaks in, e.g.,
287-% @setcolor (or @url, or @link, etc.) between @contents and the very
288-% first @chapter.
289-\def\gettopheadingmarks{%
290- \ifcase0\the\savedtopmark\fi
291- \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
292-}
293-\def\getbottomheadingmarks{\ifcase1\botmark\fi}
294-\def\getcolormarks{\ifcase2\the\savedtopmark\fi}
295-
296-% Avoid "undefined control sequence" errors.
297-\def\currentchapterdefs{}
298-\def\currentsectiondefs{}
299-\def\currentsection{}
300-\def\prevchapterdefs{}
301-\def\prevsectiondefs{}
302-\def\currentcolordefs{}
303-
304-% Margin to add to right of even pages, to left of odd pages.
305-\newdimen\bindingoffset
306-\newdimen\normaloffset
307-\newdimen\txipagewidth \newdimen\txipageheight
308-
309-% Main output routine.
310-%
311-\chardef\PAGE = 255
312-\newtoks\defaultoutput
313-\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
314-\output=\expandafter{\the\defaultoutput}
315-
316-\newbox\headlinebox
317-\newbox\footlinebox
318-
319-% When outputting the double column layout for indices, an output routine
320-% is run several times, which hides the original value of \topmark. This
321-% can lead to a page heading being output and duplicating the chapter heading
322-% of the index. Hence, save the contents of \topmark at the beginning of
323-% the output routine. The saved contents are valid until we actually
324-% \shipout a page.
325-%
326-% (We used to run a short output routine to actually set \topmark and
327-% \firstmark to the right values, but if this was called with an empty page
328-% containing whatsits for writing index entries, the whatsits would be thrown
329-% away and the index auxiliary file would remain empty.)
330-%
331-\newtoks\savedtopmark
332-\newif\iftopmarksaved
333-\topmarksavedtrue
334-\def\savetopmark{%
335- \iftopmarksaved\else
336- \global\savedtopmark=\expandafter{\topmark}%
337- \global\topmarksavedtrue
338- \fi
339-}
340-
341-% \onepageout takes a vbox as an argument.
342-% \shipout a vbox for a single page, adding an optional header, footer
343-% and footnote. This also causes index entries for this page to be written
344-% to the auxiliary files.
345-%
346-\def\onepageout#1{%
347- \hoffset=\normaloffset
348- %
349- \ifodd\pageno \advance\hoffset by \bindingoffset
350- \else \advance\hoffset by -\bindingoffset\fi
351- %
352- \checkchapterpage
353- %
354- % Retrieve the information for the headings from the marks in the page,
355- % and call Plain TeX's \makeheadline and \makefootline, which use the
356- % values in \headline and \footline.
357- %
358- % Common context changes for both heading and footing.
359- % Do this outside of the \shipout so @code etc. will be expanded in
360- % the headline as they should be, not taken literally (outputting ''code).
361- \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
362- %
363- \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
364- \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
365- \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
366- \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
367- %
368- {%
369- % Set context for writing to auxiliary files like index files.
370- % Have to do this stuff outside the \shipout because we want it to
371- % take effect in \write's, yet the group defined by the \vbox ends
372- % before the \shipout runs.
373- %
374- \atdummies % don't expand commands in the output.
375- \turnoffactive
376- \shipout\vbox{%
377- % Do this early so pdf references go to the beginning of the page.
378- \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
379- %
380- \unvbox\headlinebox
381- \pagebody{#1}%
382- \ifdim\ht\footlinebox > 0pt
383- % Only leave this space if the footline is nonempty.
384- % (We lessened \vsize for it in \oddfootingyyy.)
385- % The \baselineskip=24pt in plain's \makefootline has no effect.
386- \vskip 24pt
387- \unvbox\footlinebox
388- \fi
389- %
390- }%
391- }%
392- \global\topmarksavedfalse
393- \advancepageno
394- \ifnum\outputpenalty>-20000 \else\dosupereject\fi
395-}
396-
397-\newinsert\margin \dimen\margin=\maxdimen
398-
399-% Main part of page, including any footnotes
400-\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
401-{\catcode`\@ =11
402-\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
403-% marginal hacks, juha@viisa.uucp (Juha Takala)
404-\ifvoid\margin\else % marginal info is present
405- \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
406-\dimen@=\dp#1\relax \unvbox#1\relax
407-\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
408-\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
409-}
410-
411-% Check if we are on the first page of a chapter. Used for printing headings.
412-\newif\ifchapterpage
413-\def\checkchapterpage{%
414- % Get the chapter that was current at the end of the last page
415- \ifcase1\the\savedtopmark\fi
416- \let\prevchaptername\thischaptername
417- %
418- \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
419- \let\curchaptername\thischaptername
420- %
421- \ifx\curchaptername\prevchaptername
422- \chapterpagefalse
423- \else
424- \chapterpagetrue
425- \fi
426-}
427-
428-% Argument parsing
429-
430-% Parse an argument, then pass it to #1. The argument is the rest of
431-% the input line (except we remove a trailing comment). #1 should be a
432-% macro which expects an ordinary undelimited TeX argument.
433-% For example, \def\foo{\parsearg\fooxxx}.
434-%
435-\def\parsearg{\parseargusing{}}
436-\def\parseargusing#1#2{%
437- \def\argtorun{#2}%
438- \begingroup
439- \obeylines
440- \spaceisspace
441- #1%
442- \parseargline\empty% Insert the \empty token, see \finishparsearg below.
443-}
444-
445-{\obeylines %
446- \gdef\parseargline#1^^M{%
447- \endgroup % End of the group started in \parsearg.
448- \argremovecomment #1\comment\ArgTerm%
449- }%
450-}
451-
452-% First remove any @comment, then any @c comment. Pass the result on to
453-% \argcheckspaces.
454-\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
455-\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
456-
457-% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
458-%
459-% \argremovec might leave us with trailing space, e.g.,
460-% @end itemize @c foo
461-% This space token undergoes the same procedure and is eventually removed
462-% by \finishparsearg.
463-%
464-\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
465-\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
466-\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
467- \def\temp{#3}%
468- \ifx\temp\empty
469- % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
470- \let\temp\finishparsearg
471- \else
472- \let\temp\argcheckspaces
473- \fi
474- % Put the space token in:
475- \temp#1 #3\ArgTerm
476-}
477-
478-% If a _delimited_ argument is enclosed in braces, they get stripped; so
479-% to get _exactly_ the rest of the line, we had to prevent such situation.
480-% We prepended an \empty token at the very beginning and we expand it now,
481-% just before passing the control to \argtorun.
482-% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
483-% either the null string, or it ends with \^^M---thus there is no danger
484-% that a pair of braces would be stripped.
485-%
486-% But first, we have to remove the trailing space token.
487-%
488-\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
489-
490-
491-% \parseargdef - define a command taking an argument on the line
492-%
493-% \parseargdef\foo{...}
494-% is roughly equivalent to
495-% \def\foo{\parsearg\Xfoo}
496-% \def\Xfoo#1{...}
497-\def\parseargdef#1{%
498- \expandafter \doparseargdef \csname\string#1\endcsname #1%
499-}
500-\def\doparseargdef#1#2{%
501- \def#2{\parsearg#1}%
502- \def#1##1%
503-}
504-
505-% Several utility definitions with active space:
506-{
507- \obeyspaces
508- \gdef\obeyedspace{ }
509-
510- % Make each space character in the input produce a normal interword
511- % space in the output. Don't allow a line break at this space, as this
512- % is used only in environments like @example, where each line of input
513- % should produce a line of output anyway.
514- %
515- \gdef\sepspaces{\obeyspaces\let =\tie}
516-
517- % If an index command is used in an @example environment, any spaces
518- % therein should become regular spaces in the raw index file, not the
519- % expansion of \tie (\leavevmode \penalty \@M \ ).
520- \gdef\unsepspaces{\let =\space}
521-}
522-
523-
524-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
525-
526-% Define the framework for environments in texinfo.tex. It's used like this:
527-%
528-% \envdef\foo{...}
529-% \def\Efoo{...}
530-%
531-% It's the responsibility of \envdef to insert \begingroup before the
532-% actual body; @end closes the group after calling \Efoo. \envdef also
533-% defines \thisenv, so the current environment is known; @end checks
534-% whether the environment name matches. The \checkenv macro can also be
535-% used to check whether the current environment is the one expected.
536-%
537-% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
538-% are not treated as environments; they don't open a group. (The
539-% implementation of @end takes care not to call \endgroup in this
540-% special case.)
541-
542-
543-% At run-time, environments start with this:
544-\def\startenvironment#1{\begingroup\def\thisenv{#1}}
545-% initialize
546-\let\thisenv\empty
547-
548-% ... but they get defined via ``\envdef\foo{...}'':
549-\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
550-\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
551-
552-% Check whether we're in the right environment:
553-\def\checkenv#1{%
554- \def\temp{#1}%
555- \ifx\thisenv\temp
556- \else
557- \badenverr
558- \fi
559-}
560-
561-% Environment mismatch, #1 expected:
562-\def\badenverr{%
563- \errhelp = \EMsimple
564- \errmessage{This command can appear only \inenvironment\temp,
565- not \inenvironment\thisenv}%
566-}
567-\def\inenvironment#1{%
568- \ifx#1\empty
569- outside of any environment%
570- \else
571- in environment \expandafter\string#1%
572- \fi
573-}
574-
575-
576-% @end foo calls \checkenv and executes the definition of \Efoo.
577-\parseargdef\end{%
578- \if 1\csname iscond.#1\endcsname
579- \else
580- % The general wording of \badenverr may not be ideal.
581- \expandafter\checkenv\csname#1\endcsname
582- \csname E#1\endcsname
583- \endgroup
584- \fi
585-}
586-
587-\newhelp\EMsimple{Press RETURN to continue.}
588-
589-
590-% Be sure we're in horizontal mode when doing a tie, since we make space
591-% equivalent to this in @example-like environments. Otherwise, a space
592-% at the beginning of a line will start with \penalty -- and
593-% since \penalty is valid in vertical mode, we'd end up putting the
594-% penalty on the vertical list instead of in the new paragraph.
595-{\catcode`@ = 11
596- % Avoid using \@M directly, because that causes trouble
597- % if the definition is written into an index file.
598- \global\let\tiepenalty = \@M
599- \gdef\tie{\leavevmode\penalty\tiepenalty\ }
600-}
601-
602-% @: forces normal size whitespace following.
603-\def\:{\spacefactor=1000 }
604-
605-% @* forces a line break.
606-\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
607-
608-% @/ allows a line break.
609-\let\/=\allowbreak
610-
611-% @. is an end-of-sentence period.
612-\def\.{.\spacefactor=\endofsentencespacefactor\space}
613-
614-% @! is an end-of-sentence bang.
615-\def\!{!\spacefactor=\endofsentencespacefactor\space}
616-
617-% @? is an end-of-sentence query.
618-\def\?{?\spacefactor=\endofsentencespacefactor\space}
619-
620-% @frenchspacing on|off says whether to put extra space after punctuation.
621-%
622-\def\onword{on}
623-\def\offword{off}
624-%
625-\parseargdef\frenchspacing{%
626- \def\temp{#1}%
627- \ifx\temp\onword \plainfrenchspacing
628- \else\ifx\temp\offword \plainnonfrenchspacing
629- \else
630- \errhelp = \EMsimple
631- \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
632- \fi\fi
633-}
634-
635-% @w prevents a word break. Without the \leavevmode, @w at the
636-% beginning of a paragraph, when TeX is still in vertical mode, would
637-% produce a whole line of output instead of starting the paragraph.
638-\def\w#1{\leavevmode\hbox{#1}}
639-
640-% @group ... @end group forces ... to be all on one page, by enclosing
641-% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
642-% to keep its height that of a normal line. According to the rules for
643-% \topskip (p.114 of the TeXbook), the glue inserted is
644-% max (\topskip - \ht (first item), 0). If that height is large,
645-% therefore, no glue is inserted, and the space between the headline and
646-% the text is small, which looks bad.
647-%
648-% Another complication is that the group might be very large. This can
649-% cause the glue on the previous page to be unduly stretched, because it
650-% does not have much material. In this case, it's better to add an
651-% explicit \vfill so that the extra space is at the bottom. The
652-% threshold for doing this is if the group is more than \vfilllimit
653-% percent of a page (\vfilllimit can be changed inside of @tex).
654-%
655-\newbox\groupbox
656-\def\vfilllimit{0.7}
657-%
658-\envdef\group{%
659- \ifnum\catcode`\^^M=\active \else
660- \errhelp = \groupinvalidhelp
661- \errmessage{@group invalid in context where filling is enabled}%
662- \fi
663- \startsavinginserts
664- %
665- \setbox\groupbox = \vtop\bgroup
666- % Do @comment since we are called inside an environment such as
667- % @example, where each end-of-line in the input causes an
668- % end-of-line in the output. We don't want the end-of-line after
669- % the `@group' to put extra space in the output. Since @group
670- % should appear on a line by itself (according to the Texinfo
671- % manual), we don't worry about eating any user text.
672- \comment
673-}
674-%
675-% The \vtop produces a box with normal height and large depth; thus, TeX puts
676-% \baselineskip glue before it, and (when the next line of text is done)
677-% \lineskip glue after it. Thus, space below is not quite equal to space
678-% above. But it's pretty close.
679-\def\Egroup{%
680- % To get correct interline space between the last line of the group
681- % and the first line afterwards, we have to propagate \prevdepth.
682- \endgraf % Not \par, as it may have been set to \lisppar.
683- \global\dimen1 = \prevdepth
684- \egroup % End the \vtop.
685- \addgroupbox
686- \prevdepth = \dimen1
687- \checkinserts
688-}
689-
690-\def\addgroupbox{
691- % \dimen0 is the vertical size of the group's box.
692- \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
693- % \dimen2 is how much space is left on the page (more or less).
694- \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
695- % if the group doesn't fit on the current page, and it's a big big
696- % group, force a page break.
697- \ifdim \dimen0 > \dimen2
698- \ifdim \pagetotal < \vfilllimit\txipageheight
699- \page
700- \fi
701- \fi
702- \box\groupbox
703-}
704-
705-%
706-% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
707-% message, so this ends up printing `@group can only ...'.
708-%
709-\newhelp\groupinvalidhelp{%
710-group can only be used in environments such as @example,^^J%
711-where each line of input produces a line of output.}
712-
713-% @need space-in-mils
714-% forces a page break if there is not space-in-mils remaining.
715-
716-\newdimen\mil \mil=0.001in
717-
718-\parseargdef\need{%
719- % Ensure vertical mode, so we don't make a big box in the middle of a
720- % paragraph.
721- \par
722- %
723- % If the @need value is less than one line space, it's useless.
724- \dimen0 = #1\mil
725- \dimen2 = \ht\strutbox
726- \advance\dimen2 by \dp\strutbox
727- \ifdim\dimen0 > \dimen2
728- %
729- % Do a \strut just to make the height of this box be normal, so the
730- % normal leading is inserted relative to the preceding line.
731- % And a page break here is fine.
732- \vtop to #1\mil{\strut\vfil}%
733- %
734- % TeX does not even consider page breaks if a penalty added to the
735- % main vertical list is 10000 or more. But in order to see if the
736- % empty box we just added fits on the page, we must make it consider
737- % page breaks. On the other hand, we don't want to actually break the
738- % page after the empty box. So we use a penalty of 9999.
739- %
740- % There is an extremely small chance that TeX will actually break the
741- % page at this \penalty, if there are no other feasible breakpoints in
742- % sight. (If the user is using lots of big @group commands, which
743- % almost-but-not-quite fill up a page, TeX will have a hard time doing
744- % good page breaking, for example.) However, I could not construct an
745- % example where a page broke at this \penalty; if it happens in a real
746- % document, then we can reconsider our strategy.
747- \penalty9999
748- %
749- % Back up by the size of the box, whether we did a page break or not.
750- \kern -#1\mil
751- %
752- % Do not allow a page break right after this kern.
753- \nobreak
754- \fi
755-}
756-
757-% @br forces paragraph break (and is undocumented).
758-
759-\let\br = \par
760-
761-% @page forces the start of a new page.
762-%
763-\def\page{\par\vfill\supereject}
764-
765-% @exdent text....
766-% outputs text on separate line in roman font, starting at standard page margin
767-
768-% This records the amount of indent in the innermost environment.
769-% That's how much \exdent should take out.
770-\newskip\exdentamount
771-
772-% This defn is used inside fill environments such as @defun.
773-\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
774-
775-% This defn is used inside nofill environments such as @example.
776-\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
777- \leftline{\hskip\leftskip{\rm#1}}}}
778-
779-% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
780-% paragraph. For more general purposes, use the \margin insertion
781-% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
782-%
783-\newskip\inmarginspacing \inmarginspacing=1cm
784-\def\strutdepth{\dp\strutbox}
785-%
786-\def\doinmargin#1#2{\strut\vadjust{%
787- \nobreak
788- \kern-\strutdepth
789- \vtop to \strutdepth{%
790- \baselineskip=\strutdepth
791- \vss
792- % if you have multiple lines of stuff to put here, you'll need to
793- % make the vbox yourself of the appropriate size.
794- \ifx#1l%
795- \llap{\ignorespaces #2\hskip\inmarginspacing}%
796- \else
797- \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
798- \fi
799- \null
800- }%
801-}}
802-\def\inleftmargin{\doinmargin l}
803-\def\inrightmargin{\doinmargin r}
804-%
805-% @inmargin{TEXT [, RIGHT-TEXT]}
806-% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
807-% else use TEXT for both).
808-%
809-\def\inmargin#1{\parseinmargin #1,,\finish}
810-\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
811- \setbox0 = \hbox{\ignorespaces #2}%
812- \ifdim\wd0 > 0pt
813- \def\lefttext{#1}% have both texts
814- \def\righttext{#2}%
815- \else
816- \def\lefttext{#1}% have only one text
817- \def\righttext{#1}%
818- \fi
819- %
820- \ifodd\pageno
821- \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
822- \else
823- \def\temp{\inleftmargin\lefttext}%
824- \fi
825- \temp
826-}
827-
828-% @include FILE -- \input text of FILE.
829-%
830-\def\include{\parseargusing\filenamecatcodes\includezzz}
831-\def\includezzz#1{%
832- \pushthisfilestack
833- \def\thisfile{#1}%
834- {%
835- \makevalueexpandable % we want to expand any @value in FILE.
836- \turnoffactive % and allow special characters in the expansion
837- \indexnofonts % Allow `@@' and other weird things in file names.
838- \wlog{texinfo.tex: doing @include of #1^^J}%
839- \edef\temp{\noexpand\input #1 }%
840- %
841- % This trickery is to read FILE outside of a group, in case it makes
842- % definitions, etc.
843- \expandafter
844- }\temp
845- \popthisfilestack
846-}
847-\def\filenamecatcodes{%
848- \catcode`\\=\other
849- \catcode`~=\other
850- \catcode`^=\other
851- \catcode`_=\other
852- \catcode`|=\other
853- \catcode`<=\other
854- \catcode`>=\other
855- \catcode`+=\other
856- \catcode`-=\other
857- \catcode`\`=\other
858- \catcode`\'=\other
859-}
860-
861-\def\pushthisfilestack{%
862- \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
863-}
864-\def\pushthisfilestackX{%
865- \expandafter\pushthisfilestackY\thisfile\StackTerm
866-}
867-\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
868- \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
869-}
870-
871-\def\popthisfilestack{\errthisfilestackempty}
872-\def\errthisfilestackempty{\errmessage{Internal error:
873- the stack of filenames is empty.}}
874-%
875-\def\thisfile{}
876-
877-% @center line
878-% outputs that line, centered.
879-%
880-\parseargdef\center{%
881- \ifhmode
882- \let\centersub\centerH
883- \else
884- \let\centersub\centerV
885- \fi
886- \centersub{\hfil \ignorespaces#1\unskip \hfil}%
887- \let\centersub\relax % don't let the definition persist, just in case
888-}
889-\def\centerH#1{{%
890- \hfil\break
891- \advance\hsize by -\leftskip
892- \advance\hsize by -\rightskip
893- \line{#1}%
894- \break
895-}}
896-%
897-\newcount\centerpenalty
898-\def\centerV#1{%
899- % The idea here is the same as in \startdefun, \cartouche, etc.: if
900- % @center is the first thing after a section heading, we need to wipe
901- % out the negative parskip inserted by \sectionheading, but still
902- % prevent a page break here.
903- \centerpenalty = \lastpenalty
904- \ifnum\centerpenalty>10000 \vskip\parskip \fi
905- \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
906- \line{\kern\leftskip #1\kern\rightskip}%
907-}
908-
909-% @sp n outputs n lines of vertical space
910-%
911-\parseargdef\sp{\vskip #1\baselineskip}
912-
913-% @comment ...line which is ignored...
914-% @c is the same as @comment
915-% @ignore ... @end ignore is another way to write a comment
916-
917-
918-\def\c{\begingroup \catcode`\^^M=\active%
919-\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
920-\cxxx}
921-{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
922-%
923-\let\comment\c
924-
925-% @paragraphindent NCHARS
926-% We'll use ems for NCHARS, close enough.
927-% NCHARS can also be the word `asis' or `none'.
928-% We cannot feasibly implement @paragraphindent asis, though.
929-%
930-\def\asisword{asis} % no translation, these are keywords
931-\def\noneword{none}
932-%
933-\parseargdef\paragraphindent{%
934- \def\temp{#1}%
935- \ifx\temp\asisword
936- \else
937- \ifx\temp\noneword
938- \defaultparindent = 0pt
939- \else
940- \defaultparindent = #1em
941- \fi
942- \fi
943- \parindent = \defaultparindent
944-}
945-
946-% @exampleindent NCHARS
947-% We'll use ems for NCHARS like @paragraphindent.
948-% It seems @exampleindent asis isn't necessary, but
949-% I preserve it to make it similar to @paragraphindent.
950-\parseargdef\exampleindent{%
951- \def\temp{#1}%
952- \ifx\temp\asisword
953- \else
954- \ifx\temp\noneword
955- \lispnarrowing = 0pt
956- \else
957- \lispnarrowing = #1em
958- \fi
959- \fi
960-}
961-
962-% @firstparagraphindent WORD
963-% If WORD is `none', then suppress indentation of the first paragraph
964-% after a section heading. If WORD is `insert', then do indent at such
965-% paragraphs.
966-%
967-% The paragraph indentation is suppressed or not by calling
968-% \suppressfirstparagraphindent, which the sectioning commands do.
969-% We switch the definition of this back and forth according to WORD.
970-% By default, we suppress indentation.
971-%
972-\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
973-\def\insertword{insert}
974-%
975-\parseargdef\firstparagraphindent{%
976- \def\temp{#1}%
977- \ifx\temp\noneword
978- \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
979- \else\ifx\temp\insertword
980- \let\suppressfirstparagraphindent = \relax
981- \else
982- \errhelp = \EMsimple
983- \errmessage{Unknown @firstparagraphindent option `\temp'}%
984- \fi\fi
985-}
986-
987-% Here is how we actually suppress indentation. Redefine \everypar to
988-% \kern backwards by \parindent, and then reset itself to empty.
989-%
990-% We also make \indent itself not actually do anything until the next
991-% paragraph.
992-%
993-\gdef\dosuppressfirstparagraphindent{%
994- \gdef\indent {\restorefirstparagraphindent \indent}%
995- \gdef\noindent{\restorefirstparagraphindent \noindent}%
996- \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
997-}
998-%
999-\gdef\restorefirstparagraphindent{%
1000- \global\let\indent = \ptexindent
1001- \global\let\noindent = \ptexnoindent
1002- \global\everypar = {}%
1003-}
1004-
1005-% leave vertical mode without cancelling any first paragraph indent
1006-\gdef\imageindent{%
1007- \toks0=\everypar
1008- \everypar={}%
1009- \ptexnoindent
1010- \global\everypar=\toks0
1011-}
1012-
1013-
1014-% @refill is a no-op.
1015-\let\refill=\relax
1016-
1017-% @setfilename INFO-FILENAME - ignored
1018-\let\setfilename=\comment
1019-
1020-% @bye.
1021-\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
1022-
1023-
1024-\message{pdf,}
1025-% adobe `portable' document format
1026-\newcount\tempnum
1027-\newcount\lnkcount
1028-\newtoks\filename
1029-\newcount\filenamelength
1030-\newcount\pgn
1031-\newtoks\toksA
1032-\newtoks\toksB
1033-\newtoks\toksC
1034-\newtoks\toksD
1035-\newbox\boxA
1036-\newbox\boxB
1037-\newcount\countA
1038-\newif\ifpdf
1039-\newif\ifpdfmakepagedest
1040-
1041-%
1042-% For LuaTeX
1043-%
1044-
1045-\newif\iftxiuseunicodedestname
1046-\txiuseunicodedestnamefalse % For pdfTeX etc.
1047-
1048-\ifx\luatexversion\thisisundefined
1049-\else
1050- % Use Unicode destination names
1051- \txiuseunicodedestnametrue
1052- % Escape PDF strings with converting UTF-16 from UTF-8
1053- \begingroup
1054- \catcode`\%=12
1055- \directlua{
1056- function UTF16oct(str)
1057- tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1058- for c in string.utfvalues(str) do
1059- if c < 0x10000 then
1060- tex.sprint(
1061- string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1062- string.char(0x5c) .. string.char(0x25) .. '03o',
1063- math.floor(c / 256), math.floor(c % 256)))
1064- else
1065- c = c - 0x10000
1066- local c_hi = c / 1024 + 0xd800
1067- local c_lo = c % 1024 + 0xdc00
1068- tex.sprint(
1069- string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1070- string.char(0x5c) .. string.char(0x25) .. '03o' ..
1071- string.char(0x5c) .. string.char(0x25) .. '03o' ..
1072- string.char(0x5c) .. string.char(0x25) .. '03o',
1073- math.floor(c_hi / 256), math.floor(c_hi % 256),
1074- math.floor(c_lo / 256), math.floor(c_lo % 256)))
1075- end
1076- end
1077- end
1078- }
1079- \endgroup
1080- \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1081- % Escape PDF strings without converting
1082- \begingroup
1083- \directlua{
1084- function PDFescstr(str)
1085- for c in string.bytes(str) do
1086- if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1087- tex.sprint(-2,
1088- string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1089- c))
1090- else
1091- tex.sprint(-2, string.char(c))
1092- end
1093- end
1094- end
1095- }
1096- % The -2 in the arguments here gives all the input to TeX catcode 12
1097- % (other) or 10 (space), preventing undefined control sequence errors. See
1098- % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1099- %
1100- \endgroup
1101- \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1102- \ifnum\luatexversion>84
1103- % For LuaTeX >= 0.85
1104- \def\pdfdest{\pdfextension dest}
1105- \let\pdfoutput\outputmode
1106- \def\pdfliteral{\pdfextension literal}
1107- \def\pdfcatalog{\pdfextension catalog}
1108- \def\pdftexversion{\numexpr\pdffeedback version\relax}
1109- \let\pdfximage\saveimageresource
1110- \let\pdfrefximage\useimageresource
1111- \let\pdflastximage\lastsavedimageresourceindex
1112- \def\pdfendlink{\pdfextension endlink\relax}
1113- \def\pdfoutline{\pdfextension outline}
1114- \def\pdfstartlink{\pdfextension startlink}
1115- \def\pdffontattr{\pdfextension fontattr}
1116- \def\pdfobj{\pdfextension obj}
1117- \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1118- \let\pdfpagewidth\pagewidth
1119- \let\pdfpageheight\pageheight
1120- \edef\pdfhorigin{\pdfvariable horigin}
1121- \edef\pdfvorigin{\pdfvariable vorigin}
1122- \fi
1123-\fi
1124-
1125-% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1126-% can be set). So we test for \relax and 0 as well as being undefined.
1127-\ifx\pdfoutput\thisisundefined
1128-\else
1129- \ifx\pdfoutput\relax
1130- \else
1131- \ifcase\pdfoutput
1132- \else
1133- \pdftrue
1134- \fi
1135- \fi
1136-\fi
1137-
1138-\newif\ifpdforxetex
1139-\pdforxetexfalse
1140-\ifpdf
1141- \pdforxetextrue
1142-\fi
1143-\ifx\XeTeXrevision\thisisundefined\else
1144- \pdforxetextrue
1145-\fi
1146-
1147-
1148-% Output page labels information.
1149-% See PDF reference v.1.7 p.594, section 8.3.1.
1150-\ifpdf
1151-\def\pagelabels{%
1152- \def\title{0 << /P (T-) /S /D >>}%
1153- \edef\roman{\the\romancount << /S /r >>}%
1154- \edef\arabic{\the\arabiccount << /S /D >>}%
1155- %
1156- % Page label ranges must be increasing. Remove any duplicates.
1157- % (There is a slight chance of this being wrong if e.g. there is
1158- % a @contents but no @titlepage, etc.)
1159- %
1160- \ifnum\romancount=0 \def\roman{}\fi
1161- \ifnum\arabiccount=0 \def\title{}%
1162- \else
1163- \ifnum\romancount=\arabiccount \def\roman{}\fi
1164- \fi
1165- %
1166- \ifnum\romancount<\arabiccount
1167- \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1168- \else
1169- \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1170- \fi
1171-}
1172-\else
1173- \let\pagelabels\relax
1174-\fi
1175-
1176-\newcount\pagecount \pagecount=0
1177-\newcount\romancount \romancount=0
1178-\newcount\arabiccount \arabiccount=0
1179-\ifpdf
1180- \let\ptxadvancepageno\advancepageno
1181- \def\advancepageno{%
1182- \ptxadvancepageno\global\advance\pagecount by 1
1183- }
1184-\fi
1185-
1186-
1187-% PDF uses PostScript string constants for the names of xref targets,
1188-% for display in the outlines, and in other places. Thus, we have to
1189-% double any backslashes. Otherwise, a name like "\node" will be
1190-% interpreted as a newline (\n), followed by o, d, e. Not good.
1191-%
1192-% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1193-% related messages. The final outcome is that it is up to the TeX user
1194-% to double the backslashes and otherwise make the string valid, so
1195-% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1196-% do this reliably, so we use it.
1197-
1198-% #1 is a control sequence in which to do the replacements,
1199-% which we \xdef.
1200-\def\txiescapepdf#1{%
1201- \ifx\pdfescapestring\thisisundefined
1202- % No primitive available; should we give a warning or log?
1203- % Many times it won't matter.
1204- \xdef#1{#1}%
1205- \else
1206- % The expandable \pdfescapestring primitive escapes parentheses,
1207- % backslashes, and other special chars.
1208- \xdef#1{\pdfescapestring{#1}}%
1209- \fi
1210-}
1211-\def\txiescapepdfutfsixteen#1{%
1212- \ifx\pdfescapestrutfsixteen\thisisundefined
1213- % No UTF-16 converting macro available.
1214- \txiescapepdf{#1}%
1215- \else
1216- \xdef#1{\pdfescapestrutfsixteen{#1}}%
1217- \fi
1218-}
1219-
1220-\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1221-with PDF output, and none of those formats could be found. (.eps cannot
1222-be supported due to the design of the PDF format; use regular TeX (DVI
1223-output) for that.)}
1224-
1225-\ifpdf
1226- %
1227- % Color manipulation macros using ideas from pdfcolor.tex,
1228- % except using rgb instead of cmyk; the latter is said to render as a
1229- % very dark gray on-screen and a very dark halftone in print, instead
1230- % of actual black. The dark red here is dark enough to print on paper as
1231- % nearly black, but still distinguishable for online viewing. We use
1232- % black by default, though.
1233- \def\rgbDarkRed{0.50 0.09 0.12}
1234- \def\rgbBlack{0 0 0}
1235- %
1236- % rg sets the color for filling (usual text, etc.);
1237- % RG sets the color for stroking (thin rules, e.g., normal _'s).
1238- \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1239- %
1240- % Set color, and create a mark which defines \thiscolor accordingly,
1241- % so that \makeheadline knows which color to restore.
1242- \def\setcolor#1{%
1243- \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1244- \domark
1245- \pdfsetcolor{#1}%
1246- }
1247- %
1248- \def\maincolor{\rgbBlack}
1249- \pdfsetcolor{\maincolor}
1250- \edef\thiscolor{\maincolor}
1251- \def\currentcolordefs{}
1252- %
1253- \def\makefootline{%
1254- \baselineskip24pt
1255- \line{\pdfsetcolor{\maincolor}\the\footline}%
1256- }
1257- %
1258- \def\makeheadline{%
1259- \vbox to 0pt{%
1260- \vskip-22.5pt
1261- \line{%
1262- \vbox to8.5pt{}%
1263- % Extract \thiscolor definition from the marks.
1264- \getcolormarks
1265- % Typeset the headline with \maincolor, then restore the color.
1266- \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1267- }%
1268- \vss
1269- }%
1270- \nointerlineskip
1271- }
1272- %
1273- %
1274- \pdfcatalog{/PageMode /UseOutlines}
1275- %
1276- % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1277- \def\dopdfimage#1#2#3{%
1278- \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1279- \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1280- %
1281- % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1282- % others). Let's try in that order, PDF first since if
1283- % someone has a scalable image, presumably better to use that than a
1284- % bitmap.
1285- \let\pdfimgext=\empty
1286- \begingroup
1287- \openin 1 #1.pdf \ifeof 1
1288- \openin 1 #1.PDF \ifeof 1
1289- \openin 1 #1.png \ifeof 1
1290- \openin 1 #1.jpg \ifeof 1
1291- \openin 1 #1.jpeg \ifeof 1
1292- \openin 1 #1.JPG \ifeof 1
1293- \errhelp = \nopdfimagehelp
1294- \errmessage{Could not find image file #1 for pdf}%
1295- \else \gdef\pdfimgext{JPG}%
1296- \fi
1297- \else \gdef\pdfimgext{jpeg}%
1298- \fi
1299- \else \gdef\pdfimgext{jpg}%
1300- \fi
1301- \else \gdef\pdfimgext{png}%
1302- \fi
1303- \else \gdef\pdfimgext{PDF}%
1304- \fi
1305- \else \gdef\pdfimgext{pdf}%
1306- \fi
1307- \closein 1
1308- \endgroup
1309- %
1310- % without \immediate, ancient pdftex seg faults when the same image is
1311- % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1312- \ifnum\pdftexversion < 14
1313- \immediate\pdfimage
1314- \else
1315- \immediate\pdfximage
1316- \fi
1317- \ifdim \wd0 >0pt width \pdfimagewidth \fi
1318- \ifdim \wd2 >0pt height \pdfimageheight \fi
1319- \ifnum\pdftexversion<13
1320- #1.\pdfimgext
1321- \else
1322- {#1.\pdfimgext}%
1323- \fi
1324- \ifnum\pdftexversion < 14 \else
1325- \pdfrefximage \pdflastximage
1326- \fi}
1327- %
1328- \def\setpdfdestname#1{{%
1329- % We have to set dummies so commands such as @code, and characters
1330- % such as \, aren't expanded when present in a section title.
1331- \indexnofonts
1332- \makevalueexpandable
1333- \turnoffactive
1334- \iftxiuseunicodedestname
1335- \ifx \declaredencoding \latone
1336- % Pass through Latin-1 characters.
1337- % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1338- \else
1339- \ifx \declaredencoding \utfeight
1340- % Pass through Unicode characters.
1341- \else
1342- % Use ASCII approximations in destination names.
1343- \passthroughcharsfalse
1344- \fi
1345- \fi
1346- \else
1347- % Use ASCII approximations in destination names.
1348- \passthroughcharsfalse
1349- \fi
1350- \def\pdfdestname{#1}%
1351- \txiescapepdf\pdfdestname
1352- }}
1353- %
1354- \def\setpdfoutlinetext#1{{%
1355- \indexnofonts
1356- \makevalueexpandable
1357- \turnoffactive
1358- \ifx \declaredencoding \latone
1359- % The PDF format can use an extended form of Latin-1 in bookmark
1360- % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1361- % the "PDFDocEncoding".
1362- \passthroughcharstrue
1363- % Pass through Latin-1 characters.
1364- % LuaTeX: Convert to Unicode
1365- % pdfTeX: Use Latin-1 as PDFDocEncoding
1366- \def\pdfoutlinetext{#1}%
1367- \else
1368- \ifx \declaredencoding \utfeight
1369- \ifx\luatexversion\thisisundefined
1370- % For pdfTeX with UTF-8.
1371- % TODO: the PDF format can use UTF-16 in bookmark strings,
1372- % but the code for this isn't done yet.
1373- % Use ASCII approximations.
1374- \passthroughcharsfalse
1375- \def\pdfoutlinetext{#1}%
1376- \else
1377- % For LuaTeX with UTF-8.
1378- % Pass through Unicode characters for title texts.
1379- \passthroughcharstrue
1380- \def\pdfoutlinetext{#1}%
1381- \fi
1382- \else
1383- % For non-Latin-1 or non-UTF-8 encodings.
1384- % Use ASCII approximations.
1385- \passthroughcharsfalse
1386- \def\pdfoutlinetext{#1}%
1387- \fi
1388- \fi
1389- % LuaTeX: Convert to UTF-16
1390- % pdfTeX: Use Latin-1 as PDFDocEncoding
1391- \txiescapepdfutfsixteen\pdfoutlinetext
1392- }}
1393- %
1394- \def\pdfmkdest#1{%
1395- \setpdfdestname{#1}%
1396- \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1397- }
1398- %
1399- % used to mark target names; must be expandable.
1400- \def\pdfmkpgn#1{#1}
1401- %
1402- % by default, use black for everything.
1403- \def\urlcolor{\rgbBlack}
1404- \def\linkcolor{\rgbBlack}
1405- \def\endlink{\setcolor{\maincolor}\pdfendlink}
1406- %
1407- % Adding outlines to PDF; macros for calculating structure of outlines
1408- % come from Petr Olsak
1409- \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1410- \else \csname#1\endcsname \fi}
1411- \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1412- \advance\tempnum by 1
1413- \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1414- %
1415- % #1 is the section text, which is what will be displayed in the
1416- % outline by the pdf viewer. #2 is the pdf expression for the number
1417- % of subentries (or empty, for subsubsections). #3 is the node text,
1418- % which might be empty if this toc entry had no corresponding node.
1419- % #4 is the page number
1420- %
1421- \def\dopdfoutline#1#2#3#4{%
1422- % Generate a link to the node text if that exists; else, use the
1423- % page number. We could generate a destination for the section
1424- % text in the case where a section has no node, but it doesn't
1425- % seem worth the trouble, since most documents are normally structured.
1426- \setpdfoutlinetext{#1}
1427- \setpdfdestname{#3}
1428- \ifx\pdfdestname\empty
1429- \def\pdfdestname{#4}%
1430- \fi
1431- %
1432- \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1433- }
1434- %
1435- \def\pdfmakeoutlines{%
1436- \begingroup
1437- % Read toc silently, to get counts of subentries for \pdfoutline.
1438- \def\partentry##1##2##3##4{}% ignore parts in the outlines
1439- \def\numchapentry##1##2##3##4{%
1440- \def\thischapnum{##2}%
1441- \def\thissecnum{0}%
1442- \def\thissubsecnum{0}%
1443- }%
1444- \def\numsecentry##1##2##3##4{%
1445- \advancenumber{chap\thischapnum}%
1446- \def\thissecnum{##2}%
1447- \def\thissubsecnum{0}%
1448- }%
1449- \def\numsubsecentry##1##2##3##4{%
1450- \advancenumber{sec\thissecnum}%
1451- \def\thissubsecnum{##2}%
1452- }%
1453- \def\numsubsubsecentry##1##2##3##4{%
1454- \advancenumber{subsec\thissubsecnum}%
1455- }%
1456- \def\thischapnum{0}%
1457- \def\thissecnum{0}%
1458- \def\thissubsecnum{0}%
1459- %
1460- % use \def rather than \let here because we redefine \chapentry et
1461- % al. a second time, below.
1462- \def\appentry{\numchapentry}%
1463- \def\appsecentry{\numsecentry}%
1464- \def\appsubsecentry{\numsubsecentry}%
1465- \def\appsubsubsecentry{\numsubsubsecentry}%
1466- \def\unnchapentry{\numchapentry}%
1467- \def\unnsecentry{\numsecentry}%
1468- \def\unnsubsecentry{\numsubsecentry}%
1469- \def\unnsubsubsecentry{\numsubsubsecentry}%
1470- \readdatafile{toc}%
1471- %
1472- % Read toc second time, this time actually producing the outlines.
1473- % The `-' means take the \expnumber as the absolute number of
1474- % subentries, which we calculated on our first read of the .toc above.
1475- %
1476- % We use the node names as the destinations.
1477- %
1478- % Currently we prefix the section name with the section number
1479- % for chapter and appendix headings only in order to avoid too much
1480- % horizontal space being required in the PDF viewer.
1481- \def\numchapentry##1##2##3##4{%
1482- \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1483- \def\unnchapentry##1##2##3##4{%
1484- \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1485- \def\numsecentry##1##2##3##4{%
1486- \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1487- \def\numsubsecentry##1##2##3##4{%
1488- \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1489- \def\numsubsubsecentry##1##2##3##4{% count is always zero
1490- \dopdfoutline{##1}{}{##3}{##4}}%
1491- %
1492- % PDF outlines are displayed using system fonts, instead of
1493- % document fonts. Therefore we cannot use special characters,
1494- % since the encoding is unknown. For example, the eogonek from
1495- % Latin 2 (0xea) gets translated to a | character. Info from
1496- % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1497- %
1498- % TODO this right, we have to translate 8-bit characters to
1499- % their "best" equivalent, based on the @documentencoding. Too
1500- % much work for too little return. Just use the ASCII equivalents
1501- % we use for the index sort strings.
1502- %
1503- \indexnofonts
1504- \setupdatafile
1505- % We can have normal brace characters in the PDF outlines, unlike
1506- % Texinfo index files. So set that up.
1507- \def\{{\lbracecharliteral}%
1508- \def\}{\rbracecharliteral}%
1509- \catcode`\\=\active \otherbackslash
1510- \input \tocreadfilename
1511- \endgroup
1512- }
1513- {\catcode`[=1 \catcode`]=2
1514- \catcode`{=\other \catcode`}=\other
1515- \gdef\lbracecharliteral[{]%
1516- \gdef\rbracecharliteral[}]%
1517- ]
1518- %
1519- \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1520- \ifx\PP\D\let\nextsp\relax
1521- \else\let\nextsp\skipspaces
1522- \addtokens{\filename}{\PP}%
1523- \advance\filenamelength by 1
1524- \fi
1525- \nextsp}
1526- \def\getfilename#1{%
1527- \filenamelength=0
1528- % If we don't expand the argument now, \skipspaces will get
1529- % snagged on things like "@value{foo}".
1530- \edef\temp{#1}%
1531- \expandafter\skipspaces\temp|\relax
1532- }
1533- \ifnum\pdftexversion < 14
1534- \let \startlink \pdfannotlink
1535- \else
1536- \let \startlink \pdfstartlink
1537- \fi
1538- % make a live url in pdf output.
1539- \def\pdfurl#1{%
1540- \begingroup
1541- % it seems we really need yet another set of dummies; have not
1542- % tried to figure out what each command should do in the context
1543- % of @url. for now, just make @/ a no-op, that's the only one
1544- % people have actually reported a problem with.
1545- %
1546- \normalturnoffactive
1547- \def\@{@}%
1548- \let\/=\empty
1549- \makevalueexpandable
1550- % do we want to go so far as to use \indexnofonts instead of just
1551- % special-casing \var here?
1552- \def\var##1{##1}%
1553- %
1554- \leavevmode\setcolor{\urlcolor}%
1555- \startlink attr{/Border [0 0 0]}%
1556- user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1557- \endgroup}
1558- % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1559- % be a simple number, or a list of numbers in the case of an index
1560- % entry.
1561- \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1562- \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1563- \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1564- \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1565- \def\maketoks{%
1566- \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1567- \ifx\first0\adn0
1568- \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1569- \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1570- \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1571- \else
1572- \ifnum0=\countA\else\makelink\fi
1573- \ifx\first.\let\next=\done\else
1574- \let\next=\maketoks
1575- \addtokens{\toksB}{\the\toksD}
1576- \ifx\first,\addtokens{\toksB}{\space}\fi
1577- \fi
1578- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1579- \next}
1580- \def\makelink{\addtokens{\toksB}%
1581- {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1582- \def\pdflink#1{%
1583- \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1584- \setcolor{\linkcolor}#1\endlink}
1585- \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1586-\else
1587- % non-pdf mode
1588- \let\pdfmkdest = \gobble
1589- \let\pdfurl = \gobble
1590- \let\endlink = \relax
1591- \let\setcolor = \gobble
1592- \let\pdfsetcolor = \gobble
1593- \let\pdfmakeoutlines = \relax
1594-\fi % \ifx\pdfoutput
1595-
1596-%
1597-% For XeTeX
1598-%
1599-\ifx\XeTeXrevision\thisisundefined
1600-\else
1601- %
1602- % XeTeX version check
1603- %
1604- \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1605- % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1606- % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1607- % For avoiding PDF destination name replacement, we use this special
1608- % instead of xdvipdfmx's command line option `-C 0x0010'.
1609- \special{dvipdfmx:config C 0x0010}
1610- % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1611- % It can handle Unicode destination names for PDF.
1612- \txiuseunicodedestnametrue
1613- \else
1614- % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1615- % `dvipdfmx:config' special.
1616- % So for avoiding PDF destination name replacement,
1617- % xdvipdfmx's command line option `-C 0x0010' is necessary.
1618- %
1619- % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1620- % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1621- % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1622- \txiuseunicodedestnamefalse
1623- \fi
1624- %
1625- % Color support
1626- %
1627- \def\rgbDarkRed{0.50 0.09 0.12}
1628- \def\rgbBlack{0 0 0}
1629- %
1630- \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1631- %
1632- % Set color, and create a mark which defines \thiscolor accordingly,
1633- % so that \makeheadline knows which color to restore.
1634- \def\setcolor#1{%
1635- \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1636- \domark
1637- \pdfsetcolor{#1}%
1638- }
1639- %
1640- \def\maincolor{\rgbBlack}
1641- \pdfsetcolor{\maincolor}
1642- \edef\thiscolor{\maincolor}
1643- \def\currentcolordefs{}
1644- %
1645- \def\makefootline{%
1646- \baselineskip24pt
1647- \line{\pdfsetcolor{\maincolor}\the\footline}%
1648- }
1649- %
1650- \def\makeheadline{%
1651- \vbox to 0pt{%
1652- \vskip-22.5pt
1653- \line{%
1654- \vbox to8.5pt{}%
1655- % Extract \thiscolor definition from the marks.
1656- \getcolormarks
1657- % Typeset the headline with \maincolor, then restore the color.
1658- \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1659- }%
1660- \vss
1661- }%
1662- \nointerlineskip
1663- }
1664- %
1665- % PDF outline support
1666- %
1667- % Emulate pdfTeX primitive
1668- \def\pdfdest name#1 xyz{%
1669- \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1670- }
1671- %
1672- \def\setpdfdestname#1{{%
1673- % We have to set dummies so commands such as @code, and characters
1674- % such as \, aren't expanded when present in a section title.
1675- \indexnofonts
1676- \makevalueexpandable
1677- \turnoffactive
1678- \iftxiuseunicodedestname
1679- % Pass through Unicode characters.
1680- \else
1681- % Use ASCII approximations in destination names.
1682- \passthroughcharsfalse
1683- \fi
1684- \def\pdfdestname{#1}%
1685- \txiescapepdf\pdfdestname
1686- }}
1687- %
1688- \def\setpdfoutlinetext#1{{%
1689- \turnoffactive
1690- % Always use Unicode characters in title texts.
1691- \def\pdfoutlinetext{#1}%
1692- % For XeTeX, xdvipdfmx converts to UTF-16.
1693- % So we do not convert.
1694- \txiescapepdf\pdfoutlinetext
1695- }}
1696- %
1697- \def\pdfmkdest#1{%
1698- \setpdfdestname{#1}%
1699- \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1700- }
1701- %
1702- % by default, use black for everything.
1703- \def\urlcolor{\rgbBlack}
1704- \def\linkcolor{\rgbBlack}
1705- \def\endlink{\setcolor{\maincolor}\pdfendlink}
1706- %
1707- \def\dopdfoutline#1#2#3#4{%
1708- \setpdfoutlinetext{#1}
1709- \setpdfdestname{#3}
1710- \ifx\pdfdestname\empty
1711- \def\pdfdestname{#4}%
1712- \fi
1713- %
1714- \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1715- << /S /GoTo /D (\pdfdestname) >> >> }%
1716- }
1717- %
1718- \def\pdfmakeoutlines{%
1719- \begingroup
1720- %
1721- % For XeTeX, counts of subentries are not necessary.
1722- % Therefore, we read toc only once.
1723- %
1724- % We use node names as destinations.
1725- %
1726- % Currently we prefix the section name with the section number
1727- % for chapter and appendix headings only in order to avoid too much
1728- % horizontal space being required in the PDF viewer.
1729- \def\partentry##1##2##3##4{}% ignore parts in the outlines
1730- \def\numchapentry##1##2##3##4{%
1731- \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1732- \def\numsecentry##1##2##3##4{%
1733- \dopdfoutline{##1}{2}{##3}{##4}}%
1734- \def\numsubsecentry##1##2##3##4{%
1735- \dopdfoutline{##1}{3}{##3}{##4}}%
1736- \def\numsubsubsecentry##1##2##3##4{%
1737- \dopdfoutline{##1}{4}{##3}{##4}}%
1738- %
1739- \let\appentry\numchapentry%
1740- \let\appsecentry\numsecentry%
1741- \let\appsubsecentry\numsubsecentry%
1742- \let\appsubsubsecentry\numsubsubsecentry%
1743- \def\unnchapentry##1##2##3##4{%
1744- \dopdfoutline{##1}{1}{##3}{##4}}%
1745- \let\unnsecentry\numsecentry%
1746- \let\unnsubsecentry\numsubsecentry%
1747- \let\unnsubsubsecentry\numsubsubsecentry%
1748- %
1749- % For XeTeX, xdvipdfmx converts strings to UTF-16.
1750- % Therefore, the encoding and the language may not be considered.
1751- %
1752- \indexnofonts
1753- \setupdatafile
1754- % We can have normal brace characters in the PDF outlines, unlike
1755- % Texinfo index files. So set that up.
1756- \def\{{\lbracecharliteral}%
1757- \def\}{\rbracecharliteral}%
1758- \catcode`\\=\active \otherbackslash
1759- \input \tocreadfilename
1760- \endgroup
1761- }
1762- {\catcode`[=1 \catcode`]=2
1763- \catcode`{=\other \catcode`}=\other
1764- \gdef\lbracecharliteral[{]%
1765- \gdef\rbracecharliteral[}]%
1766- ]
1767-
1768- \special{pdf:docview << /PageMode /UseOutlines >> }
1769- % ``\special{pdf:tounicode ...}'' is not necessary
1770- % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1771- % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1772- % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1773- % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1774-%
1775- \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1776- \ifx\PP\D\let\nextsp\relax
1777- \else\let\nextsp\skipspaces
1778- \addtokens{\filename}{\PP}%
1779- \advance\filenamelength by 1
1780- \fi
1781- \nextsp}
1782- \def\getfilename#1{%
1783- \filenamelength=0
1784- % If we don't expand the argument now, \skipspaces will get
1785- % snagged on things like "@value{foo}".
1786- \edef\temp{#1}%
1787- \expandafter\skipspaces\temp|\relax
1788- }
1789- % make a live url in pdf output.
1790- \def\pdfurl#1{%
1791- \begingroup
1792- % it seems we really need yet another set of dummies; have not
1793- % tried to figure out what each command should do in the context
1794- % of @url. for now, just make @/ a no-op, that's the only one
1795- % people have actually reported a problem with.
1796- %
1797- \normalturnoffactive
1798- \def\@{@}%
1799- \let\/=\empty
1800- \makevalueexpandable
1801- % do we want to go so far as to use \indexnofonts instead of just
1802- % special-casing \var here?
1803- \def\var##1{##1}%
1804- %
1805- \leavevmode\setcolor{\urlcolor}%
1806- \special{pdf:bann << /Border [0 0 0]
1807- /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1808- \endgroup}
1809- \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1810- \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1811- \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1812- \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1813- \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1814- \def\maketoks{%
1815- \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1816- \ifx\first0\adn0
1817- \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1818- \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1819- \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1820- \else
1821- \ifnum0=\countA\else\makelink\fi
1822- \ifx\first.\let\next=\done\else
1823- \let\next=\maketoks
1824- \addtokens{\toksB}{\the\toksD}
1825- \ifx\first,\addtokens{\toksB}{\space}\fi
1826- \fi
1827- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1828- \next}
1829- \def\makelink{\addtokens{\toksB}%
1830- {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1831- \def\pdflink#1{%
1832- \special{pdf:bann << /Border [0 0 0]
1833- /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1834- \setcolor{\linkcolor}#1\endlink}
1835- \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1836-%
1837- %
1838- % @image support
1839- %
1840- % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1841- \def\doxeteximage#1#2#3{%
1842- \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1843- \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1844- %
1845- % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1846- % others). Let's try in that order, PDF first since if
1847- % someone has a scalable image, presumably better to use that than a
1848- % bitmap.
1849- \let\xeteximgext=\empty
1850- \begingroup
1851- \openin 1 #1.pdf \ifeof 1
1852- \openin 1 #1.PDF \ifeof 1
1853- \openin 1 #1.png \ifeof 1
1854- \openin 1 #1.jpg \ifeof 1
1855- \openin 1 #1.jpeg \ifeof 1
1856- \openin 1 #1.JPG \ifeof 1
1857- \errmessage{Could not find image file #1 for XeTeX}%
1858- \else \gdef\xeteximgext{JPG}%
1859- \fi
1860- \else \gdef\xeteximgext{jpeg}%
1861- \fi
1862- \else \gdef\xeteximgext{jpg}%
1863- \fi
1864- \else \gdef\xeteximgext{png}%
1865- \fi
1866- \else \gdef\xeteximgext{PDF}%
1867- \fi
1868- \else \gdef\xeteximgext{pdf}%
1869- \fi
1870- \closein 1
1871- \endgroup
1872- %
1873- % Putting an \hbox around the image can prevent an over-long line
1874- % after the image.
1875- \hbox\bgroup
1876- \def\xetexpdfext{pdf}%
1877- \ifx\xeteximgext\xetexpdfext
1878- \XeTeXpdffile "#1".\xeteximgext ""
1879- \else
1880- \def\xetexpdfext{PDF}%
1881- \ifx\xeteximgext\xetexpdfext
1882- \XeTeXpdffile "#1".\xeteximgext ""
1883- \else
1884- \XeTeXpicfile "#1".\xeteximgext ""
1885- \fi
1886- \fi
1887- \ifdim \wd0 >0pt width \xeteximagewidth \fi
1888- \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1889- \egroup
1890- }
1891-\fi
1892-
1893-
1894-%
1895-\message{fonts,}
1896-
1897-% Set the baselineskip to #1, and the lineskip and strut size
1898-% correspondingly. There is no deep meaning behind these magic numbers
1899-% used as factors; they just match (closely enough) what Knuth defined.
1900-%
1901-\def\lineskipfactor{.08333}
1902-\def\strutheightpercent{.70833}
1903-\def\strutdepthpercent {.29167}
1904-%
1905-% can get a sort of poor man's double spacing by redefining this.
1906-\def\baselinefactor{1}
1907-%
1908-\newdimen\textleading
1909-\def\setleading#1{%
1910- \dimen0 = #1\relax
1911- \normalbaselineskip = \baselinefactor\dimen0
1912- \normallineskip = \lineskipfactor\normalbaselineskip
1913- \normalbaselines
1914- \setbox\strutbox =\hbox{%
1915- \vrule width0pt height\strutheightpercent\baselineskip
1916- depth \strutdepthpercent \baselineskip
1917- }%
1918-}
1919-
1920-% PDF CMaps. See also LaTeX's t1.cmap.
1921-%
1922-% do nothing with this by default.
1923-\expandafter\let\csname cmapOT1\endcsname\gobble
1924-\expandafter\let\csname cmapOT1IT\endcsname\gobble
1925-\expandafter\let\csname cmapOT1TT\endcsname\gobble
1926-
1927-% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1928-% (\pdffontattr was introduced many years ago, but people still run
1929-% older pdftex's; it's easy to conditionalize, so we do.)
1930-\ifpdf \ifx\pdffontattr\thisisundefined \else
1931- \begingroup
1932- \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1933- \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1934-%%DocumentNeededResources: ProcSet (CIDInit)
1935-%%IncludeResource: ProcSet (CIDInit)
1936-%%BeginResource: CMap (TeX-OT1-0)
1937-%%Title: (TeX-OT1-0 TeX OT1 0)
1938-%%Version: 1.000
1939-%%EndComments
1940-/CIDInit /ProcSet findresource begin
1941-12 dict begin
1942-begincmap
1943-/CIDSystemInfo
1944-<< /Registry (TeX)
1945-/Ordering (OT1)
1946-/Supplement 0
1947->> def
1948-/CMapName /TeX-OT1-0 def
1949-/CMapType 2 def
1950-1 begincodespacerange
1951-<00> <7F>
1952-endcodespacerange
1953-8 beginbfrange
1954-<00> <01> <0393>
1955-<09> <0A> <03A8>
1956-<23> <26> <0023>
1957-<28> <3B> <0028>
1958-<3F> <5B> <003F>
1959-<5D> <5E> <005D>
1960-<61> <7A> <0061>
1961-<7B> <7C> <2013>
1962-endbfrange
1963-40 beginbfchar
1964-<02> <0398>
1965-<03> <039B>
1966-<04> <039E>
1967-<05> <03A0>
1968-<06> <03A3>
1969-<07> <03D2>
1970-<08> <03A6>
1971-<0B> <00660066>
1972-<0C> <00660069>
1973-<0D> <0066006C>
1974-<0E> <006600660069>
1975-<0F> <00660066006C>
1976-<10> <0131>
1977-<11> <0237>
1978-<12> <0060>
1979-<13> <00B4>
1980-<14> <02C7>
1981-<15> <02D8>
1982-<16> <00AF>
1983-<17> <02DA>
1984-<18> <00B8>
1985-<19> <00DF>
1986-<1A> <00E6>
1987-<1B> <0153>
1988-<1C> <00F8>
1989-<1D> <00C6>
1990-<1E> <0152>
1991-<1F> <00D8>
1992-<21> <0021>
1993-<22> <201D>
1994-<27> <2019>
1995-<3C> <00A1>
1996-<3D> <003D>
1997-<3E> <00BF>
1998-<5C> <201C>
1999-<5F> <02D9>
2000-<60> <2018>
2001-<7D> <02DD>
2002-<7E> <007E>
2003-<7F> <00A8>
2004-endbfchar
2005-endcmap
2006-CMapName currentdict /CMap defineresource pop
2007-end
2008-end
2009-%%EndResource
2010-%%EOF
2011- }\endgroup
2012- \expandafter\edef\csname cmapOT1\endcsname#1{%
2013- \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2014- }%
2015-%
2016-% \cmapOT1IT
2017- \begingroup
2018- \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2019- \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2020-%%DocumentNeededResources: ProcSet (CIDInit)
2021-%%IncludeResource: ProcSet (CIDInit)
2022-%%BeginResource: CMap (TeX-OT1IT-0)
2023-%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
2024-%%Version: 1.000
2025-%%EndComments
2026-/CIDInit /ProcSet findresource begin
2027-12 dict begin
2028-begincmap
2029-/CIDSystemInfo
2030-<< /Registry (TeX)
2031-/Ordering (OT1IT)
2032-/Supplement 0
2033->> def
2034-/CMapName /TeX-OT1IT-0 def
2035-/CMapType 2 def
2036-1 begincodespacerange
2037-<00> <7F>
2038-endcodespacerange
2039-8 beginbfrange
2040-<00> <01> <0393>
2041-<09> <0A> <03A8>
2042-<25> <26> <0025>
2043-<28> <3B> <0028>
2044-<3F> <5B> <003F>
2045-<5D> <5E> <005D>
2046-<61> <7A> <0061>
2047-<7B> <7C> <2013>
2048-endbfrange
2049-42 beginbfchar
2050-<02> <0398>
2051-<03> <039B>
2052-<04> <039E>
2053-<05> <03A0>
2054-<06> <03A3>
2055-<07> <03D2>
2056-<08> <03A6>
2057-<0B> <00660066>
2058-<0C> <00660069>
2059-<0D> <0066006C>
2060-<0E> <006600660069>
2061-<0F> <00660066006C>
2062-<10> <0131>
2063-<11> <0237>
2064-<12> <0060>
2065-<13> <00B4>
2066-<14> <02C7>
2067-<15> <02D8>
2068-<16> <00AF>
2069-<17> <02DA>
2070-<18> <00B8>
2071-<19> <00DF>
2072-<1A> <00E6>
2073-<1B> <0153>
2074-<1C> <00F8>
2075-<1D> <00C6>
2076-<1E> <0152>
2077-<1F> <00D8>
2078-<21> <0021>
2079-<22> <201D>
2080-<23> <0023>
2081-<24> <00A3>
2082-<27> <2019>
2083-<3C> <00A1>
2084-<3D> <003D>
2085-<3E> <00BF>
2086-<5C> <201C>
2087-<5F> <02D9>
2088-<60> <2018>
2089-<7D> <02DD>
2090-<7E> <007E>
2091-<7F> <00A8>
2092-endbfchar
2093-endcmap
2094-CMapName currentdict /CMap defineresource pop
2095-end
2096-end
2097-%%EndResource
2098-%%EOF
2099- }\endgroup
2100- \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2101- \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2102- }%
2103-%
2104-% \cmapOT1TT
2105- \begingroup
2106- \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2107- \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2108-%%DocumentNeededResources: ProcSet (CIDInit)
2109-%%IncludeResource: ProcSet (CIDInit)
2110-%%BeginResource: CMap (TeX-OT1TT-0)
2111-%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2112-%%Version: 1.000
2113-%%EndComments
2114-/CIDInit /ProcSet findresource begin
2115-12 dict begin
2116-begincmap
2117-/CIDSystemInfo
2118-<< /Registry (TeX)
2119-/Ordering (OT1TT)
2120-/Supplement 0
2121->> def
2122-/CMapName /TeX-OT1TT-0 def
2123-/CMapType 2 def
2124-1 begincodespacerange
2125-<00> <7F>
2126-endcodespacerange
2127-5 beginbfrange
2128-<00> <01> <0393>
2129-<09> <0A> <03A8>
2130-<21> <26> <0021>
2131-<28> <5F> <0028>
2132-<61> <7E> <0061>
2133-endbfrange
2134-32 beginbfchar
2135-<02> <0398>
2136-<03> <039B>
2137-<04> <039E>
2138-<05> <03A0>
2139-<06> <03A3>
2140-<07> <03D2>
2141-<08> <03A6>
2142-<0B> <2191>
2143-<0C> <2193>
2144-<0D> <0027>
2145-<0E> <00A1>
2146-<0F> <00BF>
2147-<10> <0131>
2148-<11> <0237>
2149-<12> <0060>
2150-<13> <00B4>
2151-<14> <02C7>
2152-<15> <02D8>
2153-<16> <00AF>
2154-<17> <02DA>
2155-<18> <00B8>
2156-<19> <00DF>
2157-<1A> <00E6>
2158-<1B> <0153>
2159-<1C> <00F8>
2160-<1D> <00C6>
2161-<1E> <0152>
2162-<1F> <00D8>
2163-<20> <2423>
2164-<27> <2019>
2165-<60> <2018>
2166-<7F> <00A8>
2167-endbfchar
2168-endcmap
2169-CMapName currentdict /CMap defineresource pop
2170-end
2171-end
2172-%%EndResource
2173-%%EOF
2174- }\endgroup
2175- \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2176- \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2177- }%
2178-\fi\fi
2179-
2180-
2181-% Set the font macro #1 to the font named \fontprefix#2.
2182-% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2183-% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2184-% Example:
2185-% #1 = \textrm
2186-% #2 = \rmshape
2187-% #3 = 10
2188-% #4 = \mainmagstep
2189-% #5 = OT1
2190-%
2191-\def\setfont#1#2#3#4#5{%
2192- \font#1=\fontprefix#2#3 scaled #4
2193- \csname cmap#5\endcsname#1%
2194-}
2195-% This is what gets called when #5 of \setfont is empty.
2196-\let\cmap\gobble
2197-%
2198-% (end of cmaps)
2199-
2200-% Use cm as the default font prefix.
2201-% To specify the font prefix, you must define \fontprefix
2202-% before you read in texinfo.tex.
2203-\ifx\fontprefix\thisisundefined
2204-\def\fontprefix{cm}
2205-\fi
2206-% Support font families that don't use the same naming scheme as CM.
2207-\def\rmshape{r}
2208-\def\rmbshape{bx} % where the normal face is bold
2209-\def\bfshape{b}
2210-\def\bxshape{bx}
2211-\def\ttshape{tt}
2212-\def\ttbshape{tt}
2213-\def\ttslshape{sltt}
2214-\def\itshape{ti}
2215-\def\itbshape{bxti}
2216-\def\slshape{sl}
2217-\def\slbshape{bxsl}
2218-\def\sfshape{ss}
2219-\def\sfbshape{ss}
2220-\def\scshape{csc}
2221-\def\scbshape{csc}
2222-
2223-% Definitions for a main text size of 11pt. (The default in Texinfo.)
2224-%
2225-\def\definetextfontsizexi{%
2226-% Text fonts (11.2pt, magstep1).
2227-\def\textnominalsize{11pt}
2228-\edef\mainmagstep{\magstephalf}
2229-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2230-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2231-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2232-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2233-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2234-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2235-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2236-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2237-\font\texti=cmmi10 scaled \mainmagstep
2238-\font\textsy=cmsy10 scaled \mainmagstep
2239-\def\textecsize{1095}
2240-
2241-% A few fonts for @defun names and args.
2242-\setfont\defbf\bfshape{10}{\magstep1}{OT1}
2243-\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2244-\setfont\defsl\slshape{10}{\magstep1}{OT1}
2245-\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2246-\def\df{\let\ttfont=\deftt \let\bffont = \defbf
2247-\let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2248-
2249-% Fonts for indices, footnotes, small examples (9pt).
2250-\def\smallnominalsize{9pt}
2251-\setfont\smallrm\rmshape{9}{1000}{OT1}
2252-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2253-\setfont\smallbf\bfshape{10}{900}{OT1}
2254-\setfont\smallit\itshape{9}{1000}{OT1IT}
2255-\setfont\smallsl\slshape{9}{1000}{OT1}
2256-\setfont\smallsf\sfshape{9}{1000}{OT1}
2257-\setfont\smallsc\scshape{10}{900}{OT1}
2258-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2259-\font\smalli=cmmi9
2260-\font\smallsy=cmsy9
2261-\def\smallecsize{0900}
2262-
2263-% Fonts for small examples (8pt).
2264-\def\smallernominalsize{8pt}
2265-\setfont\smallerrm\rmshape{8}{1000}{OT1}
2266-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2267-\setfont\smallerbf\bfshape{10}{800}{OT1}
2268-\setfont\smallerit\itshape{8}{1000}{OT1IT}
2269-\setfont\smallersl\slshape{8}{1000}{OT1}
2270-\setfont\smallersf\sfshape{8}{1000}{OT1}
2271-\setfont\smallersc\scshape{10}{800}{OT1}
2272-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2273-\font\smalleri=cmmi8
2274-\font\smallersy=cmsy8
2275-\def\smallerecsize{0800}
2276-
2277-% Fonts for math mode superscripts (7pt).
2278-\def\sevennominalsize{7pt}
2279-\setfont\sevenrm\rmshape{7}{1000}{OT1}
2280-\setfont\seventt\ttshape{10}{700}{OT1TT}
2281-\setfont\sevenbf\bfshape{10}{700}{OT1}
2282-\setfont\sevenit\itshape{7}{1000}{OT1IT}
2283-\setfont\sevensl\slshape{10}{700}{OT1}
2284-\setfont\sevensf\sfshape{10}{700}{OT1}
2285-\setfont\sevensc\scshape{10}{700}{OT1}
2286-\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2287-\font\seveni=cmmi7
2288-\font\sevensy=cmsy7
2289-\def\sevenecsize{0700}
2290-
2291-% Fonts for title page (20.4pt):
2292-\def\titlenominalsize{20pt}
2293-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2294-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2295-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2296-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2297-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2298-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2299-\let\titlebf=\titlerm
2300-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2301-\font\titlei=cmmi12 scaled \magstep3
2302-\font\titlesy=cmsy10 scaled \magstep4
2303-\def\titleecsize{2074}
2304-
2305-% Chapter (and unnumbered) fonts (17.28pt).
2306-\def\chapnominalsize{17pt}
2307-\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2308-\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2309-\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2310-\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2311-\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2312-\setfont\chapsf\sfbshape{17}{1000}{OT1}
2313-\let\chapbf=\chaprm
2314-\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2315-\font\chapi=cmmi12 scaled \magstep2
2316-\font\chapsy=cmsy10 scaled \magstep3
2317-\def\chapecsize{1728}
2318-
2319-% Section fonts (14.4pt).
2320-\def\secnominalsize{14pt}
2321-\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2322-\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2323-\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2324-\setfont\secsl\slbshape{10}{\magstep2}{OT1}
2325-\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2326-\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2327-\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2328-\let\secbf\secrm
2329-\setfont\secsc\scbshape{10}{\magstep2}{OT1}
2330-\font\seci=cmmi12 scaled \magstep1
2331-\font\secsy=cmsy10 scaled \magstep2
2332-\def\sececsize{1440}
2333-
2334-% Subsection fonts (13.15pt).
2335-\def\ssecnominalsize{13pt}
2336-\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2337-\setfont\ssecit\itbshape{10}{1315}{OT1IT}
2338-\setfont\ssecsl\slbshape{10}{1315}{OT1}
2339-\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2340-\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2341-\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2342-\let\ssecbf\ssecrm
2343-\setfont\ssecsc\scbshape{10}{1315}{OT1}
2344-\font\sseci=cmmi12 scaled \magstephalf
2345-\font\ssecsy=cmsy10 scaled 1315
2346-\def\ssececsize{1200}
2347-
2348-% Reduced fonts for @acronym in text (10pt).
2349-\def\reducednominalsize{10pt}
2350-\setfont\reducedrm\rmshape{10}{1000}{OT1}
2351-\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2352-\setfont\reducedbf\bfshape{10}{1000}{OT1}
2353-\setfont\reducedit\itshape{10}{1000}{OT1IT}
2354-\setfont\reducedsl\slshape{10}{1000}{OT1}
2355-\setfont\reducedsf\sfshape{10}{1000}{OT1}
2356-\setfont\reducedsc\scshape{10}{1000}{OT1}
2357-\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2358-\font\reducedi=cmmi10
2359-\font\reducedsy=cmsy10
2360-\def\reducedecsize{1000}
2361-
2362-\textleading = 13.2pt % line spacing for 11pt CM
2363-\textfonts % reset the current fonts
2364-\rm
2365-} % end of 11pt text font size definitions, \definetextfontsizexi
2366-
2367-
2368-% Definitions to make the main text be 10pt Computer Modern, with
2369-% section, chapter, etc., sizes following suit. This is for the GNU
2370-% Press printing of the Emacs 22 manual. Maybe other manuals in the
2371-% future. Used with @smallbook, which sets the leading to 12pt.
2372-%
2373-\def\definetextfontsizex{%
2374-% Text fonts (10pt).
2375-\def\textnominalsize{10pt}
2376-\edef\mainmagstep{1000}
2377-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2378-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2379-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2380-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2381-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2382-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2383-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2384-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2385-\font\texti=cmmi10 scaled \mainmagstep
2386-\font\textsy=cmsy10 scaled \mainmagstep
2387-\def\textecsize{1000}
2388-
2389-% A few fonts for @defun names and args.
2390-\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2391-\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2392-\setfont\defsl\slshape{10}{\magstephalf}{OT1}
2393-\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2394-\def\df{\let\ttfont=\deftt \let\bffont = \defbf
2395-\let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2396-
2397-% Fonts for indices, footnotes, small examples (9pt).
2398-\def\smallnominalsize{9pt}
2399-\setfont\smallrm\rmshape{9}{1000}{OT1}
2400-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2401-\setfont\smallbf\bfshape{10}{900}{OT1}
2402-\setfont\smallit\itshape{9}{1000}{OT1IT}
2403-\setfont\smallsl\slshape{9}{1000}{OT1}
2404-\setfont\smallsf\sfshape{9}{1000}{OT1}
2405-\setfont\smallsc\scshape{10}{900}{OT1}
2406-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2407-\font\smalli=cmmi9
2408-\font\smallsy=cmsy9
2409-\def\smallecsize{0900}
2410-
2411-% Fonts for small examples (8pt).
2412-\def\smallernominalsize{8pt}
2413-\setfont\smallerrm\rmshape{8}{1000}{OT1}
2414-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2415-\setfont\smallerbf\bfshape{10}{800}{OT1}
2416-\setfont\smallerit\itshape{8}{1000}{OT1IT}
2417-\setfont\smallersl\slshape{8}{1000}{OT1}
2418-\setfont\smallersf\sfshape{8}{1000}{OT1}
2419-\setfont\smallersc\scshape{10}{800}{OT1}
2420-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2421-\font\smalleri=cmmi8
2422-\font\smallersy=cmsy8
2423-\def\smallerecsize{0800}
2424-
2425-% Fonts for math mode superscripts (7pt).
2426-\def\sevennominalsize{7pt}
2427-\setfont\sevenrm\rmshape{7}{1000}{OT1}
2428-\setfont\seventt\ttshape{10}{700}{OT1TT}
2429-\setfont\sevenbf\bfshape{10}{700}{OT1}
2430-\setfont\sevenit\itshape{7}{1000}{OT1IT}
2431-\setfont\sevensl\slshape{10}{700}{OT1}
2432-\setfont\sevensf\sfshape{10}{700}{OT1}
2433-\setfont\sevensc\scshape{10}{700}{OT1}
2434-\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2435-\font\seveni=cmmi7
2436-\font\sevensy=cmsy7
2437-\def\sevenecsize{0700}
2438-
2439-% Fonts for title page (20.4pt):
2440-\def\titlenominalsize{20pt}
2441-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2442-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2443-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2444-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2445-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2446-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2447-\let\titlebf=\titlerm
2448-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2449-\font\titlei=cmmi12 scaled \magstep3
2450-\font\titlesy=cmsy10 scaled \magstep4
2451-\def\titleecsize{2074}
2452-
2453-% Chapter fonts (14.4pt).
2454-\def\chapnominalsize{14pt}
2455-\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2456-\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2457-\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2458-\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2459-\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2460-\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2461-\let\chapbf\chaprm
2462-\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2463-\font\chapi=cmmi12 scaled \magstep1
2464-\font\chapsy=cmsy10 scaled \magstep2
2465-\def\chapecsize{1440}
2466-
2467-% Section fonts (12pt).
2468-\def\secnominalsize{12pt}
2469-\setfont\secrm\rmbshape{12}{1000}{OT1}
2470-\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2471-\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2472-\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2473-\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2474-\setfont\secsf\sfbshape{12}{1000}{OT1}
2475-\let\secbf\secrm
2476-\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2477-\font\seci=cmmi12
2478-\font\secsy=cmsy10 scaled \magstep1
2479-\def\sececsize{1200}
2480-
2481-% Subsection fonts (10pt).
2482-\def\ssecnominalsize{10pt}
2483-\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2484-\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2485-\setfont\ssecsl\slbshape{10}{1000}{OT1}
2486-\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2487-\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2488-\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2489-\let\ssecbf\ssecrm
2490-\setfont\ssecsc\scbshape{10}{1000}{OT1}
2491-\font\sseci=cmmi10
2492-\font\ssecsy=cmsy10
2493-\def\ssececsize{1000}
2494-
2495-% Reduced fonts for @acronym in text (9pt).
2496-\def\reducednominalsize{9pt}
2497-\setfont\reducedrm\rmshape{9}{1000}{OT1}
2498-\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2499-\setfont\reducedbf\bfshape{10}{900}{OT1}
2500-\setfont\reducedit\itshape{9}{1000}{OT1IT}
2501-\setfont\reducedsl\slshape{9}{1000}{OT1}
2502-\setfont\reducedsf\sfshape{9}{1000}{OT1}
2503-\setfont\reducedsc\scshape{10}{900}{OT1}
2504-\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2505-\font\reducedi=cmmi9
2506-\font\reducedsy=cmsy9
2507-\def\reducedecsize{0900}
2508-
2509-\divide\parskip by 2 % reduce space between paragraphs
2510-\textleading = 12pt % line spacing for 10pt CM
2511-\textfonts % reset the current fonts
2512-\rm
2513-} % end of 10pt text font size definitions, \definetextfontsizex
2514-
2515-% Fonts for short table of contents.
2516-\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2517-\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2518-\setfont\shortcontsl\slshape{12}{1000}{OT1}
2519-\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2520-
2521-
2522-% We provide the user-level command
2523-% @fonttextsize 10
2524-% (or 11) to redefine the text font size. pt is assumed.
2525-%
2526-\def\xiword{11}
2527-\def\xword{10}
2528-\def\xwordpt{10pt}
2529-%
2530-\parseargdef\fonttextsize{%
2531- \def\textsizearg{#1}%
2532- %\wlog{doing @fonttextsize \textsizearg}%
2533- %
2534- % Set \globaldefs so that documents can use this inside @tex, since
2535- % makeinfo 4.8 does not support it, but we need it nonetheless.
2536- %
2537- \begingroup \globaldefs=1
2538- \ifx\textsizearg\xword \definetextfontsizex
2539- \else \ifx\textsizearg\xiword \definetextfontsizexi
2540- \else
2541- \errhelp=\EMsimple
2542- \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2543- \fi\fi
2544- \endgroup
2545-}
2546-
2547-%
2548-% Change the current font style to #1, remembering it in \curfontstyle.
2549-% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2550-% italics, not bold italics.
2551-%
2552-\def\setfontstyle#1{%
2553- \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2554- \csname #1font\endcsname % change the current font
2555-}
2556-
2557-\def\rm{\fam=0 \setfontstyle{rm}}
2558-\def\it{\fam=\itfam \setfontstyle{it}}
2559-\def\sl{\fam=\slfam \setfontstyle{sl}}
2560-\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2561-\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
2562-
2563-% Texinfo sort of supports the sans serif font style, which plain TeX does not.
2564-% So we set up a \sf.
2565-\newfam\sffam
2566-\def\sf{\fam=\sffam \setfontstyle{sf}}
2567-
2568-% We don't need math for this font style.
2569-\def\ttsl{\setfontstyle{ttsl}}
2570-
2571-
2572-% In order for the font changes to affect most math symbols and letters,
2573-% we have to define the \textfont of the standard families.
2574-% We don't bother to reset \scriptscriptfont; awaiting user need.
2575-%
2576-\def\resetmathfonts{%
2577- \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2578- \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2579- \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2580- %
2581- % Fonts for superscript. Note that the 7pt fonts are used regardless
2582- % of the current font size.
2583- \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2584- \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2585- \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2586- \scriptfont\sffam=\sevensf
2587-}
2588-
2589-%
2590-
2591-% The font-changing commands (all called \...fonts) redefine the meanings
2592-% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
2593-% to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
2594-% commands hardwire \STYLEfont to set the current font.
2595-%
2596-% The fonts used for \ifont are for "math italics" (\itfont is for italics
2597-% in regular text). \syfont is also used in math mode only.
2598-%
2599-% Each font-changing command also sets the names \lsize (one size lower)
2600-% and \lllsize (three sizes lower). These relative commands are used
2601-% in, e.g., the LaTeX logo and acronyms.
2602-%
2603-% This all needs generalizing, badly.
2604-%
2605-
2606-\def\assignfonts#1{%
2607- \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
2608- \expandafter\let\expandafter\itfont\csname #1it\endcsname
2609- \expandafter\let\expandafter\slfont\csname #1sl\endcsname
2610- \expandafter\let\expandafter\bffont\csname #1bf\endcsname
2611- \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
2612- \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
2613- \expandafter\let\expandafter\sffont \csname #1sf\endcsname
2614- \expandafter\let\expandafter\ifont \csname #1i\endcsname
2615- \expandafter\let\expandafter\syfont \csname #1sy\endcsname
2616- \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
2617-}
2618-
2619-\newif\ifrmisbold
2620-
2621-% Select smaller font size with the current style. Used to change font size
2622-% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2623-% normal roman text, also use bold fonts for roman text in the smaller size.
2624-\def\switchtolllsize{%
2625- \expandafter\assignfonts\expandafter{\lllsize}%
2626- \ifrmisbold
2627- \let\rmfont\bffont
2628- \fi
2629- \csname\curfontstyle\endcsname
2630-}%
2631-
2632-\def\switchtolsize{%
2633- \expandafter\assignfonts\expandafter{\lsize}%
2634- \ifrmisbold
2635- \let\rmfont\bffont
2636- \fi
2637- \csname\curfontstyle\endcsname
2638-}%
2639-
2640-\def\definefontsetatsize#1#2#3#4#5{%
2641-\expandafter\def\csname #1fonts\endcsname{%
2642- \def\curfontsize{#1}%
2643- \def\lsize{#2}\def\lllsize{#3}%
2644- \csname rmisbold#5\endcsname
2645- \assignfonts{#1}%
2646- \resetmathfonts
2647- \setleading{#4}%
2648-}}
2649-
2650-\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2651-\definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2652-\definefontsetatsize{chap} {sec} {text} {19pt} {true}
2653-\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2654-\definefontsetatsize{ssec} {text} {small} {15pt} {true}
2655-\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2656-\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2657-\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2658-
2659-\def\titlefont#1{{\titlefonts\rm #1}}
2660-\let\subsecfonts = \ssecfonts
2661-\let\subsubsecfonts = \ssecfonts
2662-
2663-% Define these just so they can be easily changed for other fonts.
2664-\def\angleleft{$\langle$}
2665-\def\angleright{$\rangle$}
2666-
2667-% Set the fonts to use with the @small... environments.
2668-\let\smallexamplefonts = \smallfonts
2669-
2670-% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2671-% can fit this many characters:
2672-% 8.5x11=86 smallbook=72 a4=90 a5=69
2673-% If we use \scriptfonts (8pt), then we can fit this many characters:
2674-% 8.5x11=90+ smallbook=80 a4=90+ a5=77
2675-% For me, subjectively, the few extra characters that fit aren't worth
2676-% the additional smallness of 8pt. So I'm making the default 9pt.
2677-%
2678-% By the way, for comparison, here's what fits with @example (10pt):
2679-% 8.5x11=71 smallbook=60 a4=75 a5=58
2680-% --karl, 24jan03.
2681-
2682-% Set up the default fonts, so we can use them for creating boxes.
2683-%
2684-\definetextfontsizexi
2685-
2686-
2687-% Check if we are currently using a typewriter font. Since all the
2688-% Computer Modern typewriter fonts have zero interword stretch (and
2689-% shrink), and it is reasonable to expect all typewriter fonts to have
2690-% this property, we can check that font parameter.
2691-%
2692-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2693-
2694-{
2695-\catcode`\'=\active
2696-\catcode`\`=\active
2697-
2698-\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2699-\gdef\setregularquotes{\let`\lq \let'\rq}
2700-}
2701-
2702-% Allow an option to not use regular directed right quote/apostrophe
2703-% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2704-% The undirected quote is ugly, so don't make it the default, but it
2705-% works for pasting with more pdf viewers (at least evince), the
2706-% lilypond developers report. xpdf does work with the regular 0x27.
2707-%
2708-\def\codequoteright{%
2709- \ifmonospace
2710- \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2711- \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2712- '%
2713- \else \char'15 \fi
2714- \else \char'15 \fi
2715- \else
2716- '%
2717- \fi
2718-}
2719-%
2720-% and a similar option for the left quote char vs. a grave accent.
2721-% Modern fonts display ASCII 0x60 as a grave accent, so some people like
2722-% the code environments to do likewise.
2723-%
2724-\def\codequoteleft{%
2725- \ifmonospace
2726- \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2727- \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2728- % [Knuth] pp. 380,381,391
2729- % \relax disables Spanish ligatures ?` and !` of \tt font.
2730- \relax`%
2731- \else \char'22 \fi
2732- \else \char'22 \fi
2733- \else
2734- \relax`%
2735- \fi
2736-}
2737-
2738-% Commands to set the quote options.
2739-%
2740-\parseargdef\codequoteundirected{%
2741- \def\temp{#1}%
2742- \ifx\temp\onword
2743- \expandafter\let\csname SETtxicodequoteundirected\endcsname
2744- = t%
2745- \else\ifx\temp\offword
2746- \expandafter\let\csname SETtxicodequoteundirected\endcsname
2747- = \relax
2748- \else
2749- \errhelp = \EMsimple
2750- \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2751- \fi\fi
2752-}
2753-%
2754-\parseargdef\codequotebacktick{%
2755- \def\temp{#1}%
2756- \ifx\temp\onword
2757- \expandafter\let\csname SETtxicodequotebacktick\endcsname
2758- = t%
2759- \else\ifx\temp\offword
2760- \expandafter\let\csname SETtxicodequotebacktick\endcsname
2761- = \relax
2762- \else
2763- \errhelp = \EMsimple
2764- \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2765- \fi\fi
2766-}
2767-
2768-% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2769-\def\noligaturesquoteleft{\relax\lq}
2770-
2771-% Count depth in font-changes, for error checks
2772-\newcount\fontdepth \fontdepth=0
2773-
2774-% Font commands.
2775-
2776-% #1 is the font command (\sl or \it), #2 is the text to slant.
2777-% If we are in a monospaced environment, however, 1) always use \ttsl,
2778-% and 2) do not add an italic correction.
2779-\def\dosmartslant#1#2{%
2780- \ifusingtt
2781- {{\ttsl #2}\let\next=\relax}%
2782- {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2783- \next
2784-}
2785-\def\smartslanted{\dosmartslant\sl}
2786-\def\smartitalic{\dosmartslant\it}
2787-
2788-% Output an italic correction unless \next (presumed to be the following
2789-% character) is such as not to need one.
2790-\def\smartitaliccorrection{%
2791- \ifx\next,%
2792- \else\ifx\next-%
2793- \else\ifx\next.%
2794- \else\ifx\next\.%
2795- \else\ifx\next\comma%
2796- \else\ptexslash
2797- \fi\fi\fi\fi\fi
2798- \aftersmartic
2799-}
2800-
2801-% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2802-\def\ttslanted#1{{\ttsl #1}}
2803-
2804-% @cite is like \smartslanted except unconditionally use \sl. We never want
2805-% ttsl for book titles, do we?
2806-\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2807-
2808-\def\aftersmartic{}
2809-\def\var#1{%
2810- \let\saveaftersmartic = \aftersmartic
2811- \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2812- \smartslanted{#1}%
2813-}
2814-
2815-\let\i=\smartitalic
2816-\let\slanted=\smartslanted
2817-\let\dfn=\smartslanted
2818-\let\emph=\smartitalic
2819-
2820-% Explicit font changes: @r, @sc, undocumented @ii.
2821-\def\r#1{{\rm #1}} % roman font
2822-\def\sc#1{{\smallcaps#1}} % smallcaps font
2823-\def\ii#1{{\it #1}} % italic font
2824-
2825-% @b, explicit bold. Also @strong.
2826-\def\b#1{{\bf #1}}
2827-\let\strong=\b
2828-
2829-% @sansserif, explicit sans.
2830-\def\sansserif#1{{\sf #1}}
2831-
2832-% We can't just use \exhyphenpenalty, because that only has effect at
2833-% the end of a paragraph. Restore normal hyphenation at the end of the
2834-% group within which \nohyphenation is presumably called.
2835-%
2836-\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2837-\def\restorehyphenation{\hyphenchar\font = `- }
2838-
2839-% Set sfcode to normal for the chars that usually have another value.
2840-% Can't use plain's \frenchspacing because it uses the `\x notation, and
2841-% sometimes \x has an active definition that messes things up.
2842-%
2843-\catcode`@=11
2844- \def\plainfrenchspacing{%
2845- \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2846- \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2847- \def\endofsentencespacefactor{1000}% for @. and friends
2848- }
2849- \def\plainnonfrenchspacing{%
2850- \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2851- \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2852- \def\endofsentencespacefactor{3000}% for @. and friends
2853- }
2854-\catcode`@=\other
2855-\def\endofsentencespacefactor{3000}% default
2856-
2857-% @t, explicit typewriter.
2858-\def\t#1{%
2859- {\tt \plainfrenchspacing #1}%
2860- \null
2861-}
2862-
2863-% @samp.
2864-\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2865-
2866-% @indicateurl is \samp, that is, with quotes.
2867-\let\indicateurl=\samp
2868-
2869-% @code (and similar) prints in typewriter, but with spaces the same
2870-% size as normal in the surrounding text, without hyphenation, etc.
2871-% This is a subroutine for that.
2872-\def\tclose#1{%
2873- {%
2874- % Change normal interword space to be same as for the current font.
2875- \spaceskip = \fontdimen2\font
2876- %
2877- % Switch to typewriter.
2878- \tt
2879- %
2880- % But `\ ' produces the large typewriter interword space.
2881- \def\ {{\spaceskip = 0pt{} }}%
2882- %
2883- % Turn off hyphenation.
2884- \nohyphenation
2885- %
2886- \plainfrenchspacing
2887- #1%
2888- }%
2889- \null % reset spacefactor to 1000
2890-}
2891-
2892-% We *must* turn on hyphenation at `-' and `_' in @code.
2893-% (But see \codedashfinish below.)
2894-% Otherwise, it is too hard to avoid overfull hboxes
2895-% in the Emacs manual, the Library manual, etc.
2896-%
2897-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2898-% both hyphenation at - and hyphenation within words.
2899-% We must therefore turn them both off (\tclose does that)
2900-% and arrange explicitly to hyphenate at a dash. -- rms.
2901-{
2902- \catcode`\-=\active \catcode`\_=\active
2903- \catcode`\'=\active \catcode`\`=\active
2904- \global\let'=\rq \global\let`=\lq % default definitions
2905- %
2906- \global\def\code{\begingroup
2907- \setcodequotes
2908- \catcode\dashChar=\active \catcode\underChar=\active
2909- \ifallowcodebreaks
2910- \let-\codedash
2911- \let_\codeunder
2912- \else
2913- \let-\normaldash
2914- \let_\realunder
2915- \fi
2916- % Given -foo (with a single dash), we do not want to allow a break
2917- % after the hyphen.
2918- \global\let\codedashprev=\codedash
2919- %
2920- \codex
2921- }
2922- %
2923- \gdef\codedash{\futurelet\next\codedashfinish}
2924- \gdef\codedashfinish{%
2925- \normaldash % always output the dash character itself.
2926- %
2927- % Now, output a discretionary to allow a line break, unless
2928- % (a) the next character is a -, or
2929- % (b) the preceding character is a -.
2930- % E.g., given --posix, we do not want to allow a break after either -.
2931- % Given --foo-bar, we do want to allow a break between the - and the b.
2932- \ifx\next\codedash \else
2933- \ifx\codedashprev\codedash
2934- \else \discretionary{}{}{}\fi
2935- \fi
2936- % we need the space after the = for the case when \next itself is a
2937- % space token; it would get swallowed otherwise. As in @code{- a}.
2938- \global\let\codedashprev= \next
2939- }
2940-}
2941-\def\normaldash{-}
2942-%
2943-\def\codex #1{\tclose{#1}\endgroup}
2944-
2945-\def\codeunder{%
2946- % this is all so @math{@code{var_name}+1} can work. In math mode, _
2947- % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2948- % will therefore expand the active definition of _, which is us
2949- % (inside @code that is), therefore an endless loop.
2950- \ifusingtt{\ifmmode
2951- \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2952- \else\normalunderscore \fi
2953- \discretionary{}{}{}}%
2954- {\_}%
2955-}
2956-
2957-% An additional complication: the above will allow breaks after, e.g.,
2958-% each of the four underscores in __typeof__. This is bad.
2959-% @allowcodebreaks provides a document-level way to turn breaking at -
2960-% and _ on and off.
2961-%
2962-\newif\ifallowcodebreaks \allowcodebreakstrue
2963-
2964-\def\keywordtrue{true}
2965-\def\keywordfalse{false}
2966-
2967-\parseargdef\allowcodebreaks{%
2968- \def\txiarg{#1}%
2969- \ifx\txiarg\keywordtrue
2970- \allowcodebreakstrue
2971- \else\ifx\txiarg\keywordfalse
2972- \allowcodebreaksfalse
2973- \else
2974- \errhelp = \EMsimple
2975- \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2976- \fi\fi
2977-}
2978-
2979-% For @command, @env, @file, @option quotes seem unnecessary,
2980-% so use \code rather than \samp.
2981-\let\command=\code
2982-\let\env=\code
2983-\let\file=\code
2984-\let\option=\code
2985-
2986-% @uref (abbreviation for `urlref') aka @url takes an optional
2987-% (comma-separated) second argument specifying the text to display and
2988-% an optional third arg as text to display instead of (rather than in
2989-% addition to) the url itself. First (mandatory) arg is the url.
2990-
2991-% TeX-only option to allow changing PDF output to show only the second
2992-% arg (if given), and not the url (which is then just the link target).
2993-\newif\ifurefurlonlylink
2994-
2995-% The default \pretolerance setting stops the penalty inserted in
2996-% \urefallowbreak being a discouragement to line breaking. Set it to
2997-% a negative value for this paragraph only. Hopefully this does not
2998-% conflict with redefinitions of \par done elsewhere.
2999-\def\nopretolerance{%
3000-\pretolerance=-1
3001-\def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3002-}
3003-
3004-% The main macro is \urefbreak, which allows breaking at expected
3005-% places within the url.
3006-\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3007-\let\uref=\urefbreak
3008-%
3009-\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3010-\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3011- \unsepspaces
3012- \pdfurl{#1}%
3013- \setbox0 = \hbox{\ignorespaces #3}%
3014- \ifdim\wd0 > 0pt
3015- \unhbox0 % third arg given, show only that
3016- \else
3017- \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3018- \ifdim\wd0 > 0pt
3019- \ifpdf
3020- % For pdfTeX and LuaTeX
3021- \ifurefurlonlylink
3022- % PDF plus option to not display url, show just arg
3023- \unhbox0
3024- \else
3025- % PDF, normally display both arg and url for consistency,
3026- % visibility, if the pdf is eventually used to print, etc.
3027- \unhbox0\ (\urefcode{#1})%
3028- \fi
3029- \else
3030- \ifx\XeTeXrevision\thisisundefined
3031- \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3032- \else
3033- % For XeTeX
3034- \ifurefurlonlylink
3035- % PDF plus option to not display url, show just arg
3036- \unhbox0
3037- \else
3038- % PDF, normally display both arg and url for consistency,
3039- % visibility, if the pdf is eventually used to print, etc.
3040- \unhbox0\ (\urefcode{#1})%
3041- \fi
3042- \fi
3043- \fi
3044- \else
3045- \urefcode{#1}% only url given, so show it
3046- \fi
3047- \fi
3048- \endlink
3049-\endgroup}
3050-
3051-% Allow line breaks around only a few characters (only).
3052-\def\urefcatcodes{%
3053- \catcode`\&=\active \catcode`\.=\active
3054- \catcode`\#=\active \catcode`\?=\active
3055- \catcode`\/=\active
3056-}
3057-{
3058- \urefcatcodes
3059- %
3060- \global\def\urefcode{\begingroup
3061- \setcodequotes
3062- \urefcatcodes
3063- \let&\urefcodeamp
3064- \let.\urefcodedot
3065- \let#\urefcodehash
3066- \let?\urefcodequest
3067- \let/\urefcodeslash
3068- \codex
3069- }
3070- %
3071- % By default, they are just regular characters.
3072- \global\def&{\normalamp}
3073- \global\def.{\normaldot}
3074- \global\def#{\normalhash}
3075- \global\def?{\normalquest}
3076- \global\def/{\normalslash}
3077-}
3078-
3079-\def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3080-\def\urefcodedot{\urefprebreak .\urefpostbreak}
3081-\def\urefcodehash{\urefprebreak \#\urefpostbreak}
3082-\def\urefcodequest{\urefprebreak ?\urefpostbreak}
3083-\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3084-{
3085- \catcode`\/=\active
3086- \global\def\urefcodeslashfinish{%
3087- \urefprebreak \slashChar
3088- % Allow line break only after the final / in a sequence of
3089- % slashes, to avoid line break between the slashes in http://.
3090- \ifx\next/\else \urefpostbreak \fi
3091- }
3092-}
3093-
3094-% By default we'll break after the special characters, but some people like to
3095-% break before the special chars, so allow that. Also allow no breaking at
3096-% all, for manual control.
3097-%
3098-\parseargdef\urefbreakstyle{%
3099- \def\txiarg{#1}%
3100- \ifx\txiarg\wordnone
3101- \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3102- \else\ifx\txiarg\wordbefore
3103- \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3104- \else\ifx\txiarg\wordafter
3105- \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3106- \else
3107- \errhelp = \EMsimple
3108- \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3109- \fi\fi\fi
3110-}
3111-\def\wordafter{after}
3112-\def\wordbefore{before}
3113-\def\wordnone{none}
3114-
3115-% Allow a ragged right output to aid breaking long URL's. There can
3116-% be a break at the \allowbreak with no extra glue (if the existing stretch in
3117-% the line is sufficient), a break at the \penalty with extra glue added
3118-% at the end of the line, or no break at all here.
3119-% Changing the value of the penalty and/or the amount of stretch affects how
3120-% preferable one choice is over the other.
3121-\def\urefallowbreak{%
3122- \penalty0\relax
3123- \hskip 0pt plus 2 em\relax
3124- \penalty1000\relax
3125- \hskip 0pt plus -2 em\relax
3126-}
3127-
3128-\urefbreakstyle after
3129-
3130-% @url synonym for @uref, since that's how everyone uses it.
3131-%
3132-\let\url=\uref
3133-
3134-% rms does not like angle brackets --karl, 17may97.
3135-% So now @email is just like @uref, unless we are pdf.
3136-%
3137-%\def\email#1{\angleleft{\tt #1}\angleright}
3138-\ifpdforxetex
3139- \def\email#1{\doemail#1,,\finish}
3140- \def\doemail#1,#2,#3\finish{\begingroup
3141- \unsepspaces
3142- \pdfurl{mailto:#1}%
3143- \setbox0 = \hbox{\ignorespaces #2}%
3144- \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3145- \endlink
3146- \endgroup}
3147-\else
3148- \let\email=\uref
3149-\fi
3150-
3151-% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3152-% `example' (@kbd uses ttsl only inside of @example and friends),
3153-% or `code' (@kbd uses normal tty font always).
3154-\parseargdef\kbdinputstyle{%
3155- \def\txiarg{#1}%
3156- \ifx\txiarg\worddistinct
3157- \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3158- \else\ifx\txiarg\wordexample
3159- \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3160- \else\ifx\txiarg\wordcode
3161- \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3162- \else
3163- \errhelp = \EMsimple
3164- \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3165- \fi\fi\fi
3166-}
3167-\def\worddistinct{distinct}
3168-\def\wordexample{example}
3169-\def\wordcode{code}
3170-
3171-% Default is `distinct'.
3172-\kbdinputstyle distinct
3173-
3174-% @kbd is like @code, except that if the argument is just one @key command,
3175-% then @kbd has no effect.
3176-\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3177-
3178-\def\xkey{\key}
3179-\def\kbdsub#1#2#3\par{%
3180- \def\one{#1}\def\three{#3}\def\threex{??}%
3181- \ifx\one\xkey\ifx\threex\three \key{#2}%
3182- \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3183- \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3184-}
3185-
3186-% definition of @key that produces a lozenge. Doesn't adjust to text size.
3187-%\setfont\keyrm\rmshape{8}{1000}{OT1}
3188-%\font\keysy=cmsy9
3189-%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3190-% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3191-% \vbox{\hrule\kern-0.4pt
3192-% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3193-% \kern-0.4pt\hrule}%
3194-% \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3195-
3196-% definition of @key with no lozenge. If the current font is already
3197-% monospace, don't change it; that way, we respect @kbdinputstyle. But
3198-% if it isn't monospace, then use \tt.
3199-%
3200-\def\key#1{{\setregularquotes
3201- \nohyphenation
3202- \ifmonospace\else\tt\fi
3203- #1}\null}
3204-
3205-% @clicksequence{File @click{} Open ...}
3206-\def\clicksequence#1{\begingroup #1\endgroup}
3207-
3208-% @clickstyle @arrow (by default)
3209-\parseargdef\clickstyle{\def\click{#1}}
3210-\def\click{\arrow}
3211-
3212-% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3213-% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3214-%
3215-\def\dmn#1{\thinspace #1}
3216-
3217-% @acronym for "FBI", "NATO", and the like.
3218-% We print this one point size smaller, since it's intended for
3219-% all-uppercase.
3220-%
3221-\def\acronym#1{\doacronym #1,,\finish}
3222-\def\doacronym#1,#2,#3\finish{%
3223- {\switchtolsize #1}%
3224- \def\temp{#2}%
3225- \ifx\temp\empty \else
3226- \space ({\unsepspaces \ignorespaces \temp \unskip})%
3227- \fi
3228- \null % reset \spacefactor=1000
3229-}
3230-
3231-% @abbr for "Comput. J." and the like.
3232-% No font change, but don't do end-of-sentence spacing.
3233-%
3234-\def\abbr#1{\doabbr #1,,\finish}
3235-\def\doabbr#1,#2,#3\finish{%
3236- {\plainfrenchspacing #1}%
3237- \def\temp{#2}%
3238- \ifx\temp\empty \else
3239- \space ({\unsepspaces \ignorespaces \temp \unskip})%
3240- \fi
3241- \null % reset \spacefactor=1000
3242-}
3243-
3244-% @asis just yields its argument. Used with @table, for example.
3245-%
3246-\def\asis#1{#1}
3247-
3248-% @math outputs its argument in math mode.
3249-%
3250-% One complication: _ usually means subscripts, but it could also mean
3251-% an actual _ character, as in @math{@var{some_variable} + 1}. So make
3252-% _ active, and distinguish by seeing if the current family is \slfam,
3253-% which is what @var uses.
3254-{
3255- \catcode`\_ = \active
3256- \gdef\mathunderscore{%
3257- \catcode`\_=\active
3258- \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3259- }
3260-}
3261-% Another complication: we want \\ (and @\) to output a math (or tt) \.
3262-% FYI, plain.tex uses \\ as a temporary control sequence (for no
3263-% particular reason), but this is not advertised and we don't care.
3264-%
3265-% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3266-\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3267-%
3268-\def\math{%
3269- \ifmmode\else % only go into math if not in math mode already
3270- \tex
3271- \mathunderscore
3272- \let\\ = \mathbackslash
3273- \mathactive
3274- % make the texinfo accent commands work in math mode
3275- \let\"=\ddot
3276- \let\'=\acute
3277- \let\==\bar
3278- \let\^=\hat
3279- \let\`=\grave
3280- \let\u=\breve
3281- \let\v=\check
3282- \let\~=\tilde
3283- \let\dotaccent=\dot
3284- % have to provide another name for sup operator
3285- \let\mathopsup=\sup
3286- $\expandafter\finishmath\fi
3287-}
3288-\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3289-
3290-% Some active characters (such as <) are spaced differently in math.
3291-% We have to reset their definitions in case the @math was an argument
3292-% to a command which sets the catcodes (such as @item or @section).
3293-%
3294-{
3295- \catcode`^ = \active
3296- \catcode`< = \active
3297- \catcode`> = \active
3298- \catcode`+ = \active
3299- \catcode`' = \active
3300- \gdef\mathactive{%
3301- \let^ = \ptexhat
3302- \let< = \ptexless
3303- \let> = \ptexgtr
3304- \let+ = \ptexplus
3305- \let' = \ptexquoteright
3306- }
3307-}
3308-
3309-% for @sub and @sup, if in math mode, just do a normal sub/superscript.
3310-% If in text, use math to place as sub/superscript, but switch
3311-% into text mode, with smaller fonts. This is a different font than the
3312-% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3313-% fix it (significant additions to font machinery) until someone notices.
3314-%
3315-\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3316-\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3317-%
3318-\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3319-\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3320-
3321-% provide this command from LaTeX as it is very common
3322-\def\frac#1#2{{{#1}\over{#2}}}
3323-
3324-% @displaymath.
3325-% \globaldefs is needed to recognize the end lines in \tex and
3326-% \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3327-{\obeylines
3328-\globaldefs=1
3329-\envdef\displaymath{%
3330-\tex%
3331-\def\thisenv{\displaymath}%
3332-\begingroup\let\end\displaymathend%
3333-$$%
3334-}
3335-
3336-\def\displaymathend{$$\endgroup\end}%
3337-
3338-\def\Edisplaymath{%
3339-\def\thisenv{\tex}%
3340-\end tex
3341-}}
3342-
3343-
3344-% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3345-% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3346-% except specified as a normal braced arg, so no newlines to worry about.
3347-%
3348-\def\outfmtnametex{tex}
3349-%
3350-\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3351-\long\def\doinlinefmt#1,#2,\finish{%
3352- \def\inlinefmtname{#1}%
3353- \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3354-}
3355-%
3356-% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3357-% FMTNAME is tex, else ELSE-TEXT.
3358-\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3359-\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3360- \def\inlinefmtname{#1}%
3361- \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3362-}
3363-%
3364-% For raw, must switch into @tex before parsing the argument, to avoid
3365-% setting catcodes prematurely. Doing it this way means that, for
3366-% example, @inlineraw{html, foo{bar} gets a parse error instead of being
3367-% ignored. But this isn't important because if people want a literal
3368-% *right* brace they would have to use a command anyway, so they may as
3369-% well use a command to get a left brace too. We could re-use the
3370-% delimiter character idea from \verb, but it seems like overkill.
3371-%
3372-\long\def\inlineraw{\tex \doinlineraw}
3373-\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3374-\def\doinlinerawtwo#1,#2,\finish{%
3375- \def\inlinerawname{#1}%
3376- \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3377- \endgroup % close group opened by \tex.
3378-}
3379-
3380-% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3381-%
3382-\long\def\inlineifset#1{\doinlineifset #1,\finish}
3383-\long\def\doinlineifset#1,#2,\finish{%
3384- \def\inlinevarname{#1}%
3385- \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3386- \else\ignorespaces#2\fi
3387-}
3388-
3389-% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3390-%
3391-\long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3392-\long\def\doinlineifclear#1,#2,\finish{%
3393- \def\inlinevarname{#1}%
3394- \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3395-}
3396-
3397-
3398-\message{glyphs,}
3399-% and logos.
3400-
3401-% @@ prints an @, as does @atchar{}.
3402-\def\@{\char64 }
3403-\let\atchar=\@
3404-
3405-% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3406-\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3407-\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3408-\let\{=\lbracechar
3409-\let\}=\rbracechar
3410-
3411-% @comma{} to avoid , parsing problems.
3412-\let\comma = ,
3413-
3414-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3415-% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3416-\let\, = \ptexc
3417-\let\dotaccent = \ptexdot
3418-\def\ringaccent#1{{\accent23 #1}}
3419-\let\tieaccent = \ptext
3420-\let\ubaraccent = \ptexb
3421-\let\udotaccent = \d
3422-
3423-% Other special characters: @questiondown @exclamdown @ordf @ordm
3424-% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3425-\def\questiondown{?`}
3426-\def\exclamdown{!`}
3427-\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3428-\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3429-
3430-% Dotless i and dotless j, used for accents.
3431-\def\imacro{i}
3432-\def\jmacro{j}
3433-\def\dotless#1{%
3434- \def\temp{#1}%
3435- \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3436- \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3437- \else \errmessage{@dotless can be used only with i or j}%
3438- \fi\fi
3439-}
3440-
3441-% The \TeX{} logo, as in plain, but resetting the spacing so that a
3442-% period following counts as ending a sentence. (Idea found in latex.)
3443-%
3444-\edef\TeX{\TeX \spacefactor=1000 }
3445-
3446-% @LaTeX{} logo. Not quite the same results as the definition in
3447-% latex.ltx, since we use a different font for the raised A; it's most
3448-% convenient for us to use an explicitly smaller font, rather than using
3449-% the \scriptstyle font (since we don't reset \scriptstyle and
3450-% \scriptscriptstyle).
3451-%
3452-\def\LaTeX{%
3453- L\kern-.36em
3454- {\setbox0=\hbox{T}%
3455- \vbox to \ht0{\hbox{%
3456- \ifx\textnominalsize\xwordpt
3457- % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3458- % Revert to plain's \scriptsize, which is 7pt.
3459- \count255=\the\fam $\fam\count255 \scriptstyle A$%
3460- \else
3461- % For 11pt, we can use our lllsize.
3462- \switchtolllsize A%
3463- \fi
3464- }%
3465- \vss
3466- }}%
3467- \kern-.15em
3468- \TeX
3469-}
3470-
3471-% Some math mode symbols. Define \ensuremath to switch into math mode
3472-% unless we are already there. Expansion tricks may not be needed here,
3473-% but safer, and can't hurt.
3474-\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3475-\def\ensuredmath#1{$\relax#1$}
3476-%
3477-\def\bullet{\ensuremath\ptexbullet}
3478-\def\geq{\ensuremath\ge}
3479-\def\leq{\ensuremath\le}
3480-\def\minus{\ensuremath-}
3481-
3482-% @dots{} outputs an ellipsis using the current font.
3483-% We do .5em per period so that it has the same spacing in the cm
3484-% typewriter fonts as three actual period characters; on the other hand,
3485-% in other typewriter fonts three periods are wider than 1.5em. So do
3486-% whichever is larger.
3487-%
3488-\def\dots{%
3489- \leavevmode
3490- \setbox0=\hbox{...}% get width of three periods
3491- \ifdim\wd0 > 1.5em
3492- \dimen0 = \wd0
3493- \else
3494- \dimen0 = 1.5em
3495- \fi
3496- \hbox to \dimen0{%
3497- \hskip 0pt plus.25fil
3498- .\hskip 0pt plus1fil
3499- .\hskip 0pt plus1fil
3500- .\hskip 0pt plus.5fil
3501- }%
3502-}
3503-
3504-% @enddots{} is an end-of-sentence ellipsis.
3505-%
3506-\def\enddots{%
3507- \dots
3508- \spacefactor=\endofsentencespacefactor
3509-}
3510-
3511-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3512-%
3513-% Since these characters are used in examples, they should be an even number of
3514-% \tt widths. Each \tt character is 1en, so two makes it 1em.
3515-%
3516-\def\point{$\star$}
3517-\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3518-\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3519-\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3520-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3521-\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3522-
3523-% The @error{} command.
3524-% Adapted from the TeXbook's \boxit.
3525-%
3526-\newbox\errorbox
3527-%
3528-{\ttfont \global\dimen0 = 3em}% Width of the box.
3529-\dimen2 = .55pt % Thickness of rules
3530-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
3531-\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3532-%
3533-\setbox\errorbox=\hbox to \dimen0{\hfil
3534- \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3535- \advance\hsize by -2\dimen2 % Rules.
3536- \vbox{%
3537- \hrule height\dimen2
3538- \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3539- \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3540- \kern3pt\vrule width\dimen2}% Space to right.
3541- \hrule height\dimen2}
3542- \hfil}
3543-%
3544-\def\error{\leavevmode\lower.7ex\copy\errorbox}
3545-
3546-% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3547-%
3548-\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
3549-
3550-% @euro{} comes from a separate font, depending on the current style.
3551-% We use the free feym* fonts from the eurosym package by Henrik
3552-% Theiling, which support regular, slanted, bold and bold slanted (and
3553-% "outlined" (blackboard board, sort of) versions, which we don't need).
3554-% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3555-%
3556-% Although only regular is the truly official Euro symbol, we ignore
3557-% that. The Euro is designed to be slightly taller than the regular
3558-% font height.
3559-%
3560-% feymr - regular
3561-% feymo - slanted
3562-% feybr - bold
3563-% feybo - bold slanted
3564-%
3565-% There is no good (free) typewriter version, to my knowledge.
3566-% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3567-% Hmm.
3568-%
3569-% Also doesn't work in math. Do we need to do math with euro symbols?
3570-% Hope not.
3571-%
3572-%
3573-\def\euro{{\eurofont e}}
3574-\def\eurofont{%
3575- % We set the font at each command, rather than predefining it in
3576- % \textfonts and the other font-switching commands, so that
3577- % installations which never need the symbol don't have to have the
3578- % font installed.
3579- %
3580- % There is only one designed size (nominal 10pt), so we always scale
3581- % that to the current nominal size.
3582- %
3583- % By the way, simply using "at 1em" works for cmr10 and the like, but
3584- % does not work for cmbx10 and other extended/shrunken fonts.
3585- %
3586- \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3587- %
3588- \ifx\curfontstyle\bfstylename
3589- % bold:
3590- \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3591- \else
3592- % regular:
3593- \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3594- \fi
3595- \thiseurofont
3596-}
3597-
3598-% Glyphs from the EC fonts. We don't use \let for the aliases, because
3599-% sometimes we redefine the original macro, and the alias should reflect
3600-% the redefinition.
3601-%
3602-% Use LaTeX names for the Icelandic letters.
3603-\def\DH{{\ecfont \char"D0}} % Eth
3604-\def\dh{{\ecfont \char"F0}} % eth
3605-\def\TH{{\ecfont \char"DE}} % Thorn
3606-\def\th{{\ecfont \char"FE}} % thorn
3607-%
3608-\def\guillemetleft{{\ecfont \char"13}}
3609-\def\guillemotleft{\guillemetleft}
3610-\def\guillemetright{{\ecfont \char"14}}
3611-\def\guillemotright{\guillemetright}
3612-\def\guilsinglleft{{\ecfont \char"0E}}
3613-\def\guilsinglright{{\ecfont \char"0F}}
3614-\def\quotedblbase{{\ecfont \char"12}}
3615-\def\quotesinglbase{{\ecfont \char"0D}}
3616-%
3617-% This positioning is not perfect (see the ogonek LaTeX package), but
3618-% we have the precomposed glyphs for the most common cases. We put the
3619-% tests to use those glyphs in the single \ogonek macro so we have fewer
3620-% dummy definitions to worry about for index entries, etc.
3621-%
3622-% ogonek is also used with other letters in Lithuanian (IOU), but using
3623-% the precomposed glyphs for those is not so easy since they aren't in
3624-% the same EC font.
3625-\def\ogonek#1{{%
3626- \def\temp{#1}%
3627- \ifx\temp\macrocharA\Aogonek
3628- \else\ifx\temp\macrochara\aogonek
3629- \else\ifx\temp\macrocharE\Eogonek
3630- \else\ifx\temp\macrochare\eogonek
3631- \else
3632- \ecfont \setbox0=\hbox{#1}%
3633- \ifdim\ht0=1ex\accent"0C #1%
3634- \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3635- \fi
3636- \fi\fi\fi\fi
3637- }%
3638-}
3639-\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3640-\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3641-\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3642-\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3643-%
3644-% Use the European Computer Modern fonts (cm-super in outline format)
3645-% for non-CM glyphs. That is ec* for regular text and tc* for the text
3646-% companion symbols (LaTeX TS1 encoding). Both are part of the ec
3647-% package and follow the same conventions.
3648-%
3649-\def\ecfont{\etcfont{e}}
3650-\def\tcfont{\etcfont{t}}
3651-%
3652-\def\etcfont#1{%
3653- % We can't distinguish serif/sans and italic/slanted, but this
3654- % is used for crude hacks anyway (like adding French and German
3655- % quotes to documents typeset with CM, where we lose kerning), so
3656- % hopefully nobody will notice/care.
3657- \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3658- \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3659- \ifmonospace
3660- % typewriter:
3661- \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3662- \else
3663- \ifx\curfontstyle\bfstylename
3664- % bold:
3665- \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3666- \else
3667- % regular:
3668- \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3669- \fi
3670- \fi
3671- \thisecfont
3672-}
3673-
3674-% @registeredsymbol - R in a circle. The font for the R should really
3675-% be smaller yet, but lllsize is the best we can do for now.
3676-% Adapted from the plain.tex definition of \copyright.
3677-%
3678-\def\registeredsymbol{%
3679- $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3680- \hfil\crcr\Orb}}%
3681- }$%
3682-}
3683-
3684-% @textdegree - the normal degrees sign.
3685-%
3686-\def\textdegree{$^\circ$}
3687-
3688-% Laurent Siebenmann reports \Orb undefined with:
3689-% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3690-% so we'll define it if necessary.
3691-%
3692-\ifx\Orb\thisisundefined
3693-\def\Orb{\mathhexbox20D}
3694-\fi
3695-
3696-% Quotes.
3697-\chardef\quoteleft=`\`
3698-\chardef\quoteright=`\'
3699-
3700-% only change font for tt for correct kerning and to avoid using
3701-% \ecfont unless necessary.
3702-\def\quotedblleft{%
3703- \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
3704-}
3705-
3706-\def\quotedblright{%
3707- \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
3708-}
3709-
3710-
3711-\message{page headings,}
3712-
3713-\newskip\titlepagetopglue \titlepagetopglue = 1.5in
3714-\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3715-
3716-% First the title page. Must do @settitle before @titlepage.
3717-\newif\ifseenauthor
3718-\newif\iffinishedtitlepage
3719-
3720-% @setcontentsaftertitlepage used to do an implicit @contents or
3721-% @shortcontents after @end titlepage, but it is now obsolete.
3722-\def\setcontentsaftertitlepage{%
3723- \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3724- command; move your @contents command if you want the contents
3725- after the title page.}}%
3726-\def\setshortcontentsaftertitlepage{%
3727- \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3728- command; move your @shortcontents and @contents commands if you
3729- want the contents after the title page.}}%
3730-
3731-\parseargdef\shorttitlepage{%
3732- \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3733- \endgroup\page\hbox{}\page}
3734-
3735-\envdef\titlepage{%
3736- % Open one extra group, as we want to close it in the middle of \Etitlepage.
3737- \begingroup
3738- \parindent=0pt \textfonts
3739- % Leave some space at the very top of the page.
3740- \vglue\titlepagetopglue
3741- % No rule at page bottom unless we print one at the top with @title.
3742- \finishedtitlepagetrue
3743- %
3744- % Most title ``pages'' are actually two pages long, with space
3745- % at the top of the second. We don't want the ragged left on the second.
3746- \let\oldpage = \page
3747- \def\page{%
3748- \iffinishedtitlepage\else
3749- \finishtitlepage
3750- \fi
3751- \let\page = \oldpage
3752- \page
3753- \null
3754- }%
3755-}
3756-
3757-\def\Etitlepage{%
3758- \iffinishedtitlepage\else
3759- \finishtitlepage
3760- \fi
3761- % It is important to do the page break before ending the group,
3762- % because the headline and footline are only empty inside the group.
3763- % If we use the new definition of \page, we always get a blank page
3764- % after the title page, which we certainly don't want.
3765- \oldpage
3766- \endgroup
3767- %
3768- % Need this before the \...aftertitlepage checks so that if they are
3769- % in effect the toc pages will come out with page numbers.
3770- \HEADINGSon
3771-}
3772-
3773-\def\finishtitlepage{%
3774- \vskip4pt \hrule height 2pt width \hsize
3775- \vskip\titlepagebottomglue
3776- \finishedtitlepagetrue
3777-}
3778-
3779-% Settings used for typesetting titles: no hyphenation, no indentation,
3780-% don't worry much about spacing, ragged right. This should be used
3781-% inside a \vbox, and fonts need to be set appropriately first. \par should
3782-% be specified before the end of the \vbox, since a vbox is a group.
3783-%
3784-\def\raggedtitlesettings{%
3785- \rm
3786- \hyphenpenalty=10000
3787- \parindent=0pt
3788- \tolerance=5000
3789- \ptexraggedright
3790-}
3791-
3792-% Macros to be used within @titlepage:
3793-
3794-\let\subtitlerm=\rmfont
3795-\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3796-
3797-\parseargdef\title{%
3798- \checkenv\titlepage
3799- \vbox{\titlefonts \raggedtitlesettings #1\par}%
3800- % print a rule at the page bottom also.
3801- \finishedtitlepagefalse
3802- \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3803-}
3804-
3805-\parseargdef\subtitle{%
3806- \checkenv\titlepage
3807- {\subtitlefont \rightline{#1}}%
3808-}
3809-
3810-% @author should come last, but may come many times.
3811-% It can also be used inside @quotation.
3812-%
3813-\parseargdef\author{%
3814- \def\temp{\quotation}%
3815- \ifx\thisenv\temp
3816- \def\quotationauthor{#1}% printed in \Equotation.
3817- \else
3818- \checkenv\titlepage
3819- \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3820- {\secfonts\rm \leftline{#1}}%
3821- \fi
3822-}
3823-
3824-
3825-% Set up page headings and footings.
3826-
3827-\let\thispage=\folio
3828-
3829-\newtoks\evenheadline % headline on even pages
3830-\newtoks\oddheadline % headline on odd pages
3831-\newtoks\evenchapheadline% headline on even pages with a new chapter
3832-\newtoks\oddchapheadline % headline on odd pages with a new chapter
3833-\newtoks\evenfootline % footline on even pages
3834-\newtoks\oddfootline % footline on odd pages
3835-
3836-% Now make \makeheadline and \makefootline in Plain TeX use those variables
3837-\headline={{\textfonts\rm
3838- \ifchapterpage
3839- \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3840- \else
3841- \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3842- \fi}}
3843-
3844-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3845- \else \the\evenfootline \fi}\HEADINGShook}
3846-\let\HEADINGShook=\relax
3847-
3848-% Commands to set those variables.
3849-% For example, this is what @headings on does
3850-% @evenheading @thistitle|@thispage|@thischapter
3851-% @oddheading @thischapter|@thispage|@thistitle
3852-% @evenfooting @thisfile||
3853-% @oddfooting ||@thisfile
3854-
3855-
3856-\def\evenheading{\parsearg\evenheadingxxx}
3857-\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3858-\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3859- \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3860- \global\evenchapheadline=\evenheadline}
3861-
3862-\def\oddheading{\parsearg\oddheadingxxx}
3863-\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3864-\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3865- \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3866- \global\oddchapheadline=\oddheadline}
3867-
3868-\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3869-
3870-\def\evenfooting{\parsearg\evenfootingxxx}
3871-\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3872-\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3873-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3874-
3875-\def\oddfooting{\parsearg\oddfootingxxx}
3876-\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3877-\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3878- \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3879- %
3880- % Leave some space for the footline. Hopefully ok to assume
3881- % @evenfooting will not be used by itself.
3882- \global\advance\txipageheight by -12pt
3883- \global\advance\vsize by -12pt
3884-}
3885-
3886-\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3887-
3888-% @evenheadingmarks top \thischapter <- chapter at the top of a page
3889-% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3890-%
3891-% The same set of arguments for:
3892-%
3893-% @oddheadingmarks
3894-% @evenfootingmarks
3895-% @oddfootingmarks
3896-% @everyheadingmarks
3897-% @everyfootingmarks
3898-
3899-% These define \getoddheadingmarks, \getevenheadingmarks,
3900-% \getoddfootingmarks, and \getevenfootingmarks, each to one of
3901-% \gettopheadingmarks, \getbottomheadingmarks.
3902-%
3903-\def\evenheadingmarks{\headingmarks{even}{heading}}
3904-\def\oddheadingmarks{\headingmarks{odd}{heading}}
3905-\def\evenfootingmarks{\headingmarks{even}{footing}}
3906-\def\oddfootingmarks{\headingmarks{odd}{footing}}
3907-\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3908- \headingmarks{odd}{heading}{#1} }
3909-\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3910- \headingmarks{odd}{footing}{#1} }
3911-% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3912-\def\headingmarks#1#2#3 {%
3913- \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3914- \global\expandafter\let\csname get#1#2marks\endcsname \temp
3915-}
3916-
3917-\everyheadingmarks bottom
3918-\everyfootingmarks bottom
3919-
3920-% @headings double turns headings on for double-sided printing.
3921-% @headings single turns headings on for single-sided printing.
3922-% @headings off turns them off.
3923-% @headings on same as @headings double, retained for compatibility.
3924-% @headings after turns on double-sided headings after this page.
3925-% @headings doubleafter turns on double-sided headings after this page.
3926-% @headings singleafter turns on single-sided headings after this page.
3927-% By default, they are off at the start of a document,
3928-% and turned `on' after @end titlepage.
3929-
3930-\parseargdef\headings{\csname HEADINGS#1\endcsname}
3931-
3932-\def\headingsoff{% non-global headings elimination
3933- \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3934- \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3935-}
3936-
3937-\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3938-\HEADINGSoff % it's the default
3939-
3940-% When we turn headings on, set the page number to 1.
3941-\def\pageone{
3942- \global\pageno=1
3943- \global\arabiccount = \pagecount
3944-}
3945-
3946-% For double-sided printing, put current file name in lower left corner,
3947-% chapter name on inside top of right hand pages, document
3948-% title on inside top of left hand pages, and page numbers on outside top
3949-% edge of all pages.
3950-\def\HEADINGSdouble{%
3951-\pageone
3952-\HEADINGSdoublex
3953-}
3954-\let\contentsalignmacro = \chappager
3955-
3956-% For single-sided printing, chapter title goes across top left of page,
3957-% page number on top right.
3958-\def\HEADINGSsingle{%
3959-\pageone
3960-\HEADINGSsinglex
3961-}
3962-\def\HEADINGSon{\HEADINGSdouble}
3963-
3964-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3965-\let\HEADINGSdoubleafter=\HEADINGSafter
3966-\def\HEADINGSdoublex{%
3967-\global\evenfootline={\hfil}
3968-\global\oddfootline={\hfil}
3969-\global\evenheadline={\line{\folio\hfil\thistitle}}
3970-\global\oddheadline={\line{\thischapter\hfil\folio}}
3971-\global\evenchapheadline={\line{\folio\hfil}}
3972-\global\oddchapheadline={\line{\hfil\folio}}
3973-\global\let\contentsalignmacro = \chapoddpage
3974-}
3975-
3976-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3977-\def\HEADINGSsinglex{%
3978-\global\evenfootline={\hfil}
3979-\global\oddfootline={\hfil}
3980-\global\evenheadline={\line{\thischapter\hfil\folio}}
3981-\global\oddheadline={\line{\thischapter\hfil\folio}}
3982-\global\evenchapheadline={\line{\hfil\folio}}
3983-\global\oddchapheadline={\line{\hfil\folio}}
3984-\global\let\contentsalignmacro = \chappager
3985-}
3986-
3987-% for @setchapternewpage off
3988-\def\HEADINGSsinglechapoff{%
3989-\pageone
3990-\global\evenfootline={\hfil}
3991-\global\oddfootline={\hfil}
3992-\global\evenheadline={\line{\thischapter\hfil\folio}}
3993-\global\oddheadline={\line{\thischapter\hfil\folio}}
3994-\global\evenchapheadline=\evenheadline
3995-\global\oddchapheadline=\oddheadline
3996-\global\let\contentsalignmacro = \chappager
3997-}
3998-
3999-% Subroutines used in generating headings
4000-% This produces Day Month Year style of output.
4001-% Only define if not already defined, in case a txi-??.tex file has set
4002-% up a different format (e.g., txi-cs.tex does this).
4003-\ifx\today\thisisundefined
4004-\def\today{%
4005- \number\day\space
4006- \ifcase\month
4007- \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4008- \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4009- \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4010- \fi
4011- \space\number\year}
4012-\fi
4013-
4014-% @settitle line... specifies the title of the document, for headings.
4015-% It generates no output of its own.
4016-\def\thistitle{\putwordNoTitle}
4017-\def\settitle{\parsearg{\gdef\thistitle}}
4018-
4019-
4020-\message{tables,}
4021-% Tables -- @table, @ftable, @vtable, @item(x).
4022-
4023-% default indentation of table text
4024-\newdimen\tableindent \tableindent=.8in
4025-% default indentation of @itemize and @enumerate text
4026-\newdimen\itemindent \itemindent=.3in
4027-% margin between end of table item and start of table text.
4028-\newdimen\itemmargin \itemmargin=.1in
4029-
4030-% used internally for \itemindent minus \itemmargin
4031-\newdimen\itemmax
4032-
4033-% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4034-% these defs.
4035-% They also define \itemindex
4036-% to index the item name in whatever manner is desired (perhaps none).
4037-
4038-\newif\ifitemxneedsnegativevskip
4039-
4040-\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4041-
4042-\def\internalBitem{\smallbreak \parsearg\itemzzz}
4043-\def\internalBitemx{\itemxpar \parsearg\itemzzz}
4044-
4045-\def\itemzzz #1{\begingroup %
4046- \advance\hsize by -\rightskip
4047- \advance\hsize by -\tableindent
4048- \setbox0=\hbox{\itemindicate{#1}}%
4049- \itemindex{#1}%
4050- \nobreak % This prevents a break before @itemx.
4051- %
4052- % If the item text does not fit in the space we have, put it on a line
4053- % by itself, and do not allow a page break either before or after that
4054- % line. We do not start a paragraph here because then if the next
4055- % command is, e.g., @kindex, the whatsit would get put into the
4056- % horizontal list on a line by itself, resulting in extra blank space.
4057- \ifdim \wd0>\itemmax
4058- %
4059- % Make this a paragraph so we get the \parskip glue and wrapping,
4060- % but leave it ragged-right.
4061- \begingroup
4062- \advance\leftskip by-\tableindent
4063- \advance\hsize by\tableindent
4064- \advance\rightskip by0pt plus1fil\relax
4065- \leavevmode\unhbox0\par
4066- \endgroup
4067- %
4068- % We're going to be starting a paragraph, but we don't want the
4069- % \parskip glue -- logically it's part of the @item we just started.
4070- \nobreak \vskip-\parskip
4071- %
4072- % Stop a page break at the \parskip glue coming up. However, if
4073- % what follows is an environment such as @example, there will be no
4074- % \parskip glue; then the negative vskip we just inserted would
4075- % cause the example and the item to crash together. So we use this
4076- % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4077- % \parskip glue after all. Section titles are handled this way also.
4078- %
4079- \penalty 10001
4080- \endgroup
4081- \itemxneedsnegativevskipfalse
4082- \else
4083- % The item text fits into the space. Start a paragraph, so that the
4084- % following text (if any) will end up on the same line.
4085- \noindent
4086- % Do this with kerns and \unhbox so that if there is a footnote in
4087- % the item text, it can migrate to the main vertical list and
4088- % eventually be printed.
4089- \nobreak\kern-\tableindent
4090- \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4091- \unhbox0
4092- \nobreak\kern\dimen0
4093- \endgroup
4094- \itemxneedsnegativevskiptrue
4095- \fi
4096-}
4097-
4098-\def\item{\errmessage{@item while not in a list environment}}
4099-\def\itemx{\errmessage{@itemx while not in a list environment}}
4100-
4101-% @table, @ftable, @vtable.
4102-\envdef\table{%
4103- \let\itemindex\gobble
4104- \tablecheck{table}%
4105-}
4106-\envdef\ftable{%
4107- \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4108- \tablecheck{ftable}%
4109-}
4110-\envdef\vtable{%
4111- \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4112- \tablecheck{vtable}%
4113-}
4114-\def\tablecheck#1{%
4115- \ifnum \the\catcode`\^^M=\active
4116- \endgroup
4117- \errmessage{This command won't work in this context; perhaps the problem is
4118- that we are \inenvironment\thisenv}%
4119- \def\next{\doignore{#1}}%
4120- \else
4121- \let\next\tablex
4122- \fi
4123- \next
4124-}
4125-\def\tablex#1{%
4126- \def\itemindicate{#1}%
4127- \parsearg\tabley
4128-}
4129-\def\tabley#1{%
4130- {%
4131- \makevalueexpandable
4132- \edef\temp{\noexpand\tablez #1\space\space\space}%
4133- \expandafter
4134- }\temp \endtablez
4135-}
4136-\def\tablez #1 #2 #3 #4\endtablez{%
4137- \aboveenvbreak
4138- \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4139- \ifnum 0#2>0 \tableindent=#2\mil \fi
4140- \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4141- \itemmax=\tableindent
4142- \advance \itemmax by -\itemmargin
4143- \advance \leftskip by \tableindent
4144- \exdentamount=\tableindent
4145- \parindent = 0pt
4146- \parskip = \smallskipamount
4147- \ifdim \parskip=0pt \parskip=2pt \fi
4148- \let\item = \internalBitem
4149- \let\itemx = \internalBitemx
4150-}
4151-\def\Etable{\endgraf\afterenvbreak}
4152-\let\Eftable\Etable
4153-\let\Evtable\Etable
4154-\let\Eitemize\Etable
4155-\let\Eenumerate\Etable
4156-
4157-% This is the counter used by @enumerate, which is really @itemize
4158-
4159-\newcount \itemno
4160-
4161-\envdef\itemize{\parsearg\doitemize}
4162-
4163-\def\doitemize#1{%
4164- \aboveenvbreak
4165- \itemmax=\itemindent
4166- \advance\itemmax by -\itemmargin
4167- \advance\leftskip by \itemindent
4168- \exdentamount=\itemindent
4169- \parindent=0pt
4170- \parskip=\smallskipamount
4171- \ifdim\parskip=0pt \parskip=2pt \fi
4172- %
4173- % Try typesetting the item mark so that if the document erroneously says
4174- % something like @itemize @samp (intending @table), there's an error
4175- % right away at the @itemize. It's not the best error message in the
4176- % world, but it's better than leaving it to the @item. This means if
4177- % the user wants an empty mark, they have to say @w{} not just @w.
4178- \def\itemcontents{#1}%
4179- \setbox0 = \hbox{\itemcontents}%
4180- %
4181- % @itemize with no arg is equivalent to @itemize @bullet.
4182- \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4183- %
4184- \let\item=\itemizeitem
4185-}
4186-
4187-% Definition of @item while inside @itemize and @enumerate.
4188-%
4189-\def\itemizeitem{%
4190- \advance\itemno by 1 % for enumerations
4191- {\let\par=\endgraf \smallbreak}% reasonable place to break
4192- {%
4193- % If the document has an @itemize directly after a section title, a
4194- % \nobreak will be last on the list, and \sectionheading will have
4195- % done a \vskip-\parskip. In that case, we don't want to zero
4196- % parskip, or the item text will crash with the heading. On the
4197- % other hand, when there is normal text preceding the item (as there
4198- % usually is), we do want to zero parskip, or there would be too much
4199- % space. In that case, we won't have a \nobreak before. At least
4200- % that's the theory.
4201- \ifnum\lastpenalty<10000 \parskip=0in \fi
4202- \noindent
4203- \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4204- %
4205- \ifinner\else
4206- \vadjust{\penalty 1200}% not good to break after first line of item.
4207- \fi
4208- % We can be in inner vertical mode in a footnote, although an
4209- % @itemize looks awful there.
4210- }%
4211- \flushcr
4212-}
4213-
4214-% \splitoff TOKENS\endmark defines \first to be the first token in
4215-% TOKENS, and \rest to be the remainder.
4216-%
4217-\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4218-
4219-% Allow an optional argument of an uppercase letter, lowercase letter,
4220-% or number, to specify the first label in the enumerated list. No
4221-% argument is the same as `1'.
4222-%
4223-\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4224-\def\enumeratey #1 #2\endenumeratey{%
4225- % If we were given no argument, pretend we were given `1'.
4226- \def\thearg{#1}%
4227- \ifx\thearg\empty \def\thearg{1}\fi
4228- %
4229- % Detect if the argument is a single token. If so, it might be a
4230- % letter. Otherwise, the only valid thing it can be is a number.
4231- % (We will always have one token, because of the test we just made.
4232- % This is a good thing, since \splitoff doesn't work given nothing at
4233- % all -- the first parameter is undelimited.)
4234- \expandafter\splitoff\thearg\endmark
4235- \ifx\rest\empty
4236- % Only one token in the argument. It could still be anything.
4237- % A ``lowercase letter'' is one whose \lccode is nonzero.
4238- % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4239- % not equal to itself.
4240- % Otherwise, we assume it's a number.
4241- %
4242- % We need the \relax at the end of the \ifnum lines to stop TeX from
4243- % continuing to look for a <number>.
4244- %
4245- \ifnum\lccode\expandafter`\thearg=0\relax
4246- \numericenumerate % a number (we hope)
4247- \else
4248- % It's a letter.
4249- \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4250- \lowercaseenumerate % lowercase letter
4251- \else
4252- \uppercaseenumerate % uppercase letter
4253- \fi
4254- \fi
4255- \else
4256- % Multiple tokens in the argument. We hope it's a number.
4257- \numericenumerate
4258- \fi
4259-}
4260-
4261-% An @enumerate whose labels are integers. The starting integer is
4262-% given in \thearg.
4263-%
4264-\def\numericenumerate{%
4265- \itemno = \thearg
4266- \startenumeration{\the\itemno}%
4267-}
4268-
4269-% The starting (lowercase) letter is in \thearg.
4270-\def\lowercaseenumerate{%
4271- \itemno = \expandafter`\thearg
4272- \startenumeration{%
4273- % Be sure we're not beyond the end of the alphabet.
4274- \ifnum\itemno=0
4275- \errmessage{No more lowercase letters in @enumerate; get a bigger
4276- alphabet}%
4277- \fi
4278- \char\lccode\itemno
4279- }%
4280-}
4281-
4282-% The starting (uppercase) letter is in \thearg.
4283-\def\uppercaseenumerate{%
4284- \itemno = \expandafter`\thearg
4285- \startenumeration{%
4286- % Be sure we're not beyond the end of the alphabet.
4287- \ifnum\itemno=0
4288- \errmessage{No more uppercase letters in @enumerate; get a bigger
4289- alphabet}
4290- \fi
4291- \char\uccode\itemno
4292- }%
4293-}
4294-
4295-% Call \doitemize, adding a period to the first argument and supplying the
4296-% common last two arguments. Also subtract one from the initial value in
4297-% \itemno, since @item increments \itemno.
4298-%
4299-\def\startenumeration#1{%
4300- \advance\itemno by -1
4301- \doitemize{#1.}\flushcr
4302-}
4303-
4304-
4305-% @multitable macros
4306-
4307-% Macros used to set up halign preamble:
4308-%
4309-\let\endsetuptable\relax
4310-\def\xendsetuptable{\endsetuptable}
4311-\let\columnfractions\relax
4312-\def\xcolumnfractions{\columnfractions}
4313-\newif\ifsetpercent
4314-
4315-% #1 is the @columnfraction, usually a decimal number like .5, but might
4316-% be just 1. We just use it, whatever it is.
4317-%
4318-\def\pickupwholefraction#1 {%
4319- \global\advance\colcount by 1
4320- \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4321- \setuptable
4322-}
4323-
4324-\newcount\colcount
4325-\def\setuptable#1{%
4326- \def\firstarg{#1}%
4327- \ifx\firstarg\xendsetuptable
4328- \let\go = \relax
4329- \else
4330- \ifx\firstarg\xcolumnfractions
4331- \global\setpercenttrue
4332- \else
4333- \ifsetpercent
4334- \let\go\pickupwholefraction
4335- \else
4336- \global\advance\colcount by 1
4337- \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4338- % separator; typically that is always in the input, anyway.
4339- \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4340- \fi
4341- \fi
4342- \ifx\go\pickupwholefraction
4343- % Put the argument back for the \pickupwholefraction call, so
4344- % we'll always have a period there to be parsed.
4345- \def\go{\pickupwholefraction#1}%
4346- \else
4347- \let\go = \setuptable
4348- \fi%
4349- \fi
4350- \go
4351-}
4352-
4353-% @headitem starts a heading row, which we typeset in bold. Assignments
4354-% have to be global since we are inside the implicit group of an
4355-% alignment entry. \everycr below resets \everytab so we don't have to
4356-% undo it ourselves.
4357-\def\headitemfont{\b}% for people to use in the template row; not changeable
4358-\def\headitem{%
4359- \checkenv\multitable
4360- \crcr
4361- \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4362- \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4363- \the\everytab % for the first item
4364-}%
4365-%
4366-% default for tables with no headings.
4367-\let\headitemcrhook=\relax
4368-%
4369-\def\tab{\checkenv\multitable &\the\everytab}%
4370-
4371-\newtoks\everytab % insert after every tab.
4372-%
4373-\envdef\multitable{%
4374- \vskip\parskip
4375- \startsavinginserts
4376- %
4377- % @item within a multitable starts a normal row.
4378- % We use \def instead of \let so that if one of the multitable entries
4379- % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4380- % \endtemplate) expanding \doitemize.
4381- \def\item{\crcr}%
4382- %
4383- \tolerance=9500
4384- \hbadness=9500
4385- \parskip=0pt
4386- \parindent=6pt
4387- \overfullrule=0pt
4388- \global\colcount=0
4389- %
4390- \everycr = {%
4391- \noalign{%
4392- \global\everytab={}% Reset from possible headitem.
4393- \global\colcount=0 % Reset the column counter.
4394- %
4395- % Check for saved footnotes, etc.:
4396- \checkinserts
4397- %
4398- % Perhaps a \nobreak, then reset:
4399- \headitemcrhook
4400- \global\let\headitemcrhook=\relax
4401- }%
4402- }%
4403- %
4404- \parsearg\domultitable
4405-}
4406-\def\domultitable#1{%
4407- % To parse everything between @multitable and @item:
4408- \setuptable#1 \endsetuptable
4409- %
4410- % This preamble sets up a generic column definition, which will
4411- % be used as many times as user calls for columns.
4412- % \vtop will set a single line and will also let text wrap and
4413- % continue for many paragraphs if desired.
4414- \halign\bgroup &%
4415- \global\advance\colcount by 1
4416- \strut
4417- \vtop{%
4418- \advance\hsize by -1\leftskip
4419- % Find the correct column width
4420- \hsize=\expandafter\csname col\the\colcount\endcsname
4421- %
4422- \rightskip=0pt
4423- \ifnum\colcount=1
4424- \advance\hsize by\leftskip % Add indent of surrounding text
4425- \else
4426- % In order to keep entries from bumping into each other.
4427- \leftskip=12pt
4428- \ifsetpercent \else
4429- % If a template has been used
4430- \advance\hsize by \leftskip
4431- \fi
4432- \fi
4433- \noindent\ignorespaces##\unskip\strut
4434- }\cr
4435-}
4436-\def\Emultitable{%
4437- \crcr
4438- \egroup % end the \halign
4439- \global\setpercentfalse
4440-}
4441-
4442-
4443-\message{conditionals,}
4444-
4445-% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4446-% @ifnotxml always succeed. They currently do nothing; we don't
4447-% attempt to check whether the conditionals are properly nested. But we
4448-% have to remember that they are conditionals, so that @end doesn't
4449-% attempt to close an environment group.
4450-%
4451-\def\makecond#1{%
4452- \expandafter\let\csname #1\endcsname = \relax
4453- \expandafter\let\csname iscond.#1\endcsname = 1
4454-}
4455-\makecond{iftex}
4456-\makecond{ifnotdocbook}
4457-\makecond{ifnothtml}
4458-\makecond{ifnotinfo}
4459-\makecond{ifnotplaintext}
4460-\makecond{ifnotxml}
4461-
4462-% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4463-%
4464-\def\direntry{\doignore{direntry}}
4465-\def\documentdescription{\doignore{documentdescription}}
4466-\def\docbook{\doignore{docbook}}
4467-\def\html{\doignore{html}}
4468-\def\ifdocbook{\doignore{ifdocbook}}
4469-\def\ifhtml{\doignore{ifhtml}}
4470-\def\ifinfo{\doignore{ifinfo}}
4471-\def\ifnottex{\doignore{ifnottex}}
4472-\def\ifplaintext{\doignore{ifplaintext}}
4473-\def\ifxml{\doignore{ifxml}}
4474-\def\ignore{\doignore{ignore}}
4475-\def\menu{\doignore{menu}}
4476-\def\xml{\doignore{xml}}
4477-
4478-% Ignore text until a line `@end #1', keeping track of nested conditionals.
4479-%
4480-% A count to remember the depth of nesting.
4481-\newcount\doignorecount
4482-
4483-\def\doignore#1{\begingroup
4484- % Scan in ``verbatim'' mode:
4485- \obeylines
4486- \catcode`\@ = \other
4487- \catcode`\{ = \other
4488- \catcode`\} = \other
4489- %
4490- % Make sure that spaces turn into tokens that match what \doignoretext wants.
4491- \spaceisspace
4492- %
4493- % Count number of #1's that we've seen.
4494- \doignorecount = 0
4495- %
4496- % Swallow text until we reach the matching `@end #1'.
4497- \dodoignore{#1}%
4498-}
4499-
4500-{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4501- \obeylines %
4502- %
4503- \gdef\dodoignore#1{%
4504- % #1 contains the command name as a string, e.g., `ifinfo'.
4505- %
4506- % Define a command to find the next `@end #1'.
4507- \long\def\doignoretext##1^^M@end #1{%
4508- \doignoretextyyy##1^^M@#1\_STOP_}%
4509- %
4510- % And this command to find another #1 command, at the beginning of a
4511- % line. (Otherwise, we would consider a line `@c @ifset', for
4512- % example, to count as an @ifset for nesting.)
4513- \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4514- %
4515- % And now expand that command.
4516- \doignoretext ^^M%
4517- }%
4518-}
4519-
4520-\def\doignoreyyy#1{%
4521- \def\temp{#1}%
4522- \ifx\temp\empty % Nothing found.
4523- \let\next\doignoretextzzz
4524- \else % Found a nested condition, ...
4525- \advance\doignorecount by 1
4526- \let\next\doignoretextyyy % ..., look for another.
4527- % If we're here, #1 ends with ^^M\ifinfo (for example).
4528- \fi
4529- \next #1% the token \_STOP_ is present just after this macro.
4530-}
4531-
4532-% We have to swallow the remaining "\_STOP_".
4533-%
4534-\def\doignoretextzzz#1{%
4535- \ifnum\doignorecount = 0 % We have just found the outermost @end.
4536- \let\next\enddoignore
4537- \else % Still inside a nested condition.
4538- \advance\doignorecount by -1
4539- \let\next\doignoretext % Look for the next @end.
4540- \fi
4541- \next
4542-}
4543-
4544-% Finish off ignored text.
4545-{ \obeylines%
4546- % Ignore anything after the last `@end #1'; this matters in verbatim
4547- % environments, where otherwise the newline after an ignored conditional
4548- % would result in a blank line in the output.
4549- \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4550-}
4551-
4552-
4553-% @set VAR sets the variable VAR to an empty value.
4554-% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4555-%
4556-% Since we want to separate VAR from REST-OF-LINE (which might be
4557-% empty), we can't just use \parsearg; we have to insert a space of our
4558-% own to delimit the rest of the line, and then take it out again if we
4559-% didn't need it.
4560-% We rely on the fact that \parsearg sets \catcode`\ =10.
4561-%
4562-\parseargdef\set{\setyyy#1 \endsetyyy}
4563-\def\setyyy#1 #2\endsetyyy{%
4564- {%
4565- \makevalueexpandable
4566- \def\temp{#2}%
4567- \edef\next{\gdef\makecsname{SET#1}}%
4568- \ifx\temp\empty
4569- \next{}%
4570- \else
4571- \setzzz#2\endsetzzz
4572- \fi
4573- }%
4574-}
4575-% Remove the trailing space \setxxx inserted.
4576-\def\setzzz#1 \endsetzzz{\next{#1}}
4577-
4578-% @clear VAR clears (i.e., unsets) the variable VAR.
4579-%
4580-\parseargdef\clear{%
4581- {%
4582- \makevalueexpandable
4583- \global\expandafter\let\csname SET#1\endcsname=\relax
4584- }%
4585-}
4586-
4587-% @value{foo} gets the text saved in variable foo.
4588-\def\value{\begingroup\makevalueexpandable\valuexxx}
4589-\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4590-{
4591- \catcode`\-=\active \catcode`\_=\active
4592- %
4593- \gdef\makevalueexpandable{%
4594- \let\value = \expandablevalue
4595- % We don't want these characters active, ...
4596- \catcode`\-=\other \catcode`\_=\other
4597- % ..., but we might end up with active ones in the argument if
4598- % we're called from @code, as @code{@value{foo-bar_}}, though.
4599- % So \let them to their normal equivalents.
4600- \let-\normaldash \let_\normalunderscore
4601- }
4602-}
4603-
4604-\def\expandablevalue#1{%
4605- \expandafter\ifx\csname SET#1\endcsname\relax
4606- {[No value for ``#1'']}%
4607- \message{Variable `#1', used in @value, is not set.}%
4608- \else
4609- \csname SET#1\endcsname
4610- \fi
4611-}
4612-
4613-% Like \expandablevalue, but completely expandable (the \message in the
4614-% definition above operates at the execution level of TeX). Used when
4615-% writing to auxiliary files, due to the expansion that \write does.
4616-% If flag is undefined, pass through an unexpanded @value command: maybe it
4617-% will be set by the time it is read back in.
4618-%
4619-% NB flag names containing - or _ may not work here.
4620-\def\dummyvalue#1{%
4621- \expandafter\ifx\csname SET#1\endcsname\relax
4622- \string\value{#1}%
4623- \else
4624- \csname SET#1\endcsname
4625- \fi
4626-}
4627-
4628-% Used for @value's in index entries to form the sort key: expand the @value
4629-% if possible, otherwise sort late.
4630-\def\indexnofontsvalue#1{%
4631- \expandafter\ifx\csname SET#1\endcsname\relax
4632- ZZZZZZZ%
4633- \else
4634- \csname SET#1\endcsname
4635- \fi
4636-}
4637-
4638-% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4639-% with @set.
4640-%
4641-% To get the special treatment we need for `@end ifset,' we call
4642-% \makecond and then redefine.
4643-%
4644-\makecond{ifset}
4645-\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4646-\def\doifset#1#2{%
4647- {%
4648- \makevalueexpandable
4649- \let\next=\empty
4650- \expandafter\ifx\csname SET#2\endcsname\relax
4651- #1% If not set, redefine \next.
4652- \fi
4653- \expandafter
4654- }\next
4655-}
4656-\def\ifsetfail{\doignore{ifset}}
4657-
4658-% @ifclear VAR ... @end executes the `...' iff VAR has never been
4659-% defined with @set, or has been undefined with @clear.
4660-%
4661-% The `\else' inside the `\doifset' parameter is a trick to reuse the
4662-% above code: if the variable is not set, do nothing, if it is set,
4663-% then redefine \next to \ifclearfail.
4664-%
4665-\makecond{ifclear}
4666-\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4667-\def\ifclearfail{\doignore{ifclear}}
4668-
4669-% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4670-% without the @) is in fact defined. We can only feasibly check at the
4671-% TeX level, so something like `mathcode' is going to considered
4672-% defined even though it is not a Texinfo command.
4673-%
4674-\makecond{ifcommanddefined}
4675-\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4676-%
4677-\def\doifcmddefined#1#2{{%
4678- \makevalueexpandable
4679- \let\next=\empty
4680- \expandafter\ifx\csname #2\endcsname\relax
4681- #1% If not defined, \let\next as above.
4682- \fi
4683- \expandafter
4684- }\next
4685-}
4686-\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4687-
4688-% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4689-\makecond{ifcommandnotdefined}
4690-\def\ifcommandnotdefined{%
4691- \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4692-\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4693-
4694-% Set the `txicommandconditionals' variable, so documents have a way to
4695-% test if the @ifcommand...defined conditionals are available.
4696-\set txicommandconditionals
4697-
4698-% @dircategory CATEGORY -- specify a category of the dir file
4699-% which this file should belong to. Ignore this in TeX.
4700-\let\dircategory=\comment
4701-
4702-% @defininfoenclose.
4703-\let\definfoenclose=\comment
4704-
4705-
4706-\message{indexing,}
4707-% Index generation facilities
4708-
4709-% Define \newwrite to be identical to plain tex's \newwrite
4710-% except not \outer, so it can be used within macros and \if's.
4711-\edef\newwrite{\makecsname{ptexnewwrite}}
4712-
4713-% \newindex {foo} defines an index named IX.
4714-% It automatically defines \IXindex such that
4715-% \IXindex ...rest of line... puts an entry in the index IX.
4716-% It also defines \IXindfile to be the number of the output channel for
4717-% the file that accumulates this index. The file's extension is IX.
4718-% The name of an index should be no more than 2 characters long
4719-% for the sake of vms.
4720-%
4721-\def\newindex#1{%
4722- \expandafter\chardef\csname#1indfile\endcsname=0
4723- \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4724- \noexpand\doindex{#1}}
4725-}
4726-
4727-% @defindex foo == \newindex{foo}
4728-%
4729-\def\defindex{\parsearg\newindex}
4730-
4731-% Define @defcodeindex, like @defindex except put all entries in @code.
4732-%
4733-\def\defcodeindex{\parsearg\newcodeindex}
4734-%
4735-\def\newcodeindex#1{%
4736- \expandafter\chardef\csname#1indfile\endcsname=0
4737- \expandafter\xdef\csname#1index\endcsname{%
4738- \noexpand\docodeindex{#1}}%
4739-}
4740-
4741-% The default indices:
4742-\newindex{cp}% concepts,
4743-\newcodeindex{fn}% functions,
4744-\newcodeindex{vr}% variables,
4745-\newcodeindex{tp}% types,
4746-\newcodeindex{ky}% keys
4747-\newcodeindex{pg}% and programs.
4748-
4749-
4750-% @synindex foo bar makes index foo feed into index bar.
4751-% Do this instead of @defindex foo if you don't want it as a separate index.
4752-%
4753-% @syncodeindex foo bar similar, but put all entries made for index foo
4754-% inside @code.
4755-%
4756-\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4757-\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4758-
4759-% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4760-% #3 the target index (bar).
4761-\def\dosynindex#1#2#3{%
4762- \requireopenindexfile{#3}%
4763- % redefine \fooindfile:
4764- \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4765- \expandafter\let\csname#2indfile\endcsname=\temp
4766- % redefine \fooindex:
4767- \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4768-}
4769-
4770-% Define \doindex, the driver for all index macros.
4771-% Argument #1 is generated by the calling \fooindex macro,
4772-% and it is the two-letter name of the index.
4773-
4774-\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4775-\def\doindexxxx #1{\doind{\indexname}{#1}}
4776-
4777-% like the previous two, but they put @code around the argument.
4778-\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4779-\def\docodeindexxxx #1{\docind{\indexname}{#1}}
4780-
4781-
4782-% Used for the aux, toc and index files to prevent expansion of Texinfo
4783-% commands.
4784-%
4785-\def\atdummies{%
4786- \definedummyletter\@%
4787- \definedummyletter\ %
4788- \definedummyletter\{%
4789- \definedummyletter\}%
4790- \definedummyletter\&%
4791- %
4792- % Do the redefinitions.
4793- \definedummies
4794- \otherbackslash
4795-}
4796-
4797-% \definedummyword defines \#1 as \string\#1\space, thus effectively
4798-% preventing its expansion. This is used only for control words,
4799-% not control letters, because the \space would be incorrect for
4800-% control characters, but is needed to separate the control word
4801-% from whatever follows.
4802-%
4803-% These can be used both for control words that take an argument and
4804-% those that do not. If it is followed by {arg} in the input, then
4805-% that will dutifully get written to the index (or wherever).
4806-%
4807-% For control letters, we have \definedummyletter, which omits the
4808-% space.
4809-%
4810-\def\definedummyword #1{\def#1{\string#1\space}}%
4811-\def\definedummyletter#1{\def#1{\string#1}}%
4812-\let\definedummyaccent\definedummyletter
4813-
4814-% Called from \atdummies to prevent the expansion of commands.
4815-%
4816-\def\definedummies{%
4817- %
4818- \let\commondummyword\definedummyword
4819- \let\commondummyletter\definedummyletter
4820- \let\commondummyaccent\definedummyaccent
4821- \commondummiesnofonts
4822- %
4823- \definedummyletter\_%
4824- \definedummyletter\-%
4825- %
4826- % Non-English letters.
4827- \definedummyword\AA
4828- \definedummyword\AE
4829- \definedummyword\DH
4830- \definedummyword\L
4831- \definedummyword\O
4832- \definedummyword\OE
4833- \definedummyword\TH
4834- \definedummyword\aa
4835- \definedummyword\ae
4836- \definedummyword\dh
4837- \definedummyword\exclamdown
4838- \definedummyword\l
4839- \definedummyword\o
4840- \definedummyword\oe
4841- \definedummyword\ordf
4842- \definedummyword\ordm
4843- \definedummyword\questiondown
4844- \definedummyword\ss
4845- \definedummyword\th
4846- %
4847- % Although these internal commands shouldn't show up, sometimes they do.
4848- \definedummyword\bf
4849- \definedummyword\gtr
4850- \definedummyword\hat
4851- \definedummyword\less
4852- \definedummyword\sf
4853- \definedummyword\sl
4854- \definedummyword\tclose
4855- \definedummyword\tt
4856- %
4857- \definedummyword\LaTeX
4858- \definedummyword\TeX
4859- %
4860- % Assorted special characters.
4861- \definedummyword\ampchar
4862- \definedummyword\atchar
4863- \definedummyword\arrow
4864- \definedummyword\backslashchar
4865- \definedummyword\bullet
4866- \definedummyword\comma
4867- \definedummyword\copyright
4868- \definedummyword\registeredsymbol
4869- \definedummyword\dots
4870- \definedummyword\enddots
4871- \definedummyword\entrybreak
4872- \definedummyword\equiv
4873- \definedummyword\error
4874- \definedummyword\euro
4875- \definedummyword\expansion
4876- \definedummyword\geq
4877- \definedummyword\guillemetleft
4878- \definedummyword\guillemetright
4879- \definedummyword\guilsinglleft
4880- \definedummyword\guilsinglright
4881- \definedummyword\lbracechar
4882- \definedummyword\leq
4883- \definedummyword\mathopsup
4884- \definedummyword\minus
4885- \definedummyword\ogonek
4886- \definedummyword\pounds
4887- \definedummyword\point
4888- \definedummyword\print
4889- \definedummyword\quotedblbase
4890- \definedummyword\quotedblleft
4891- \definedummyword\quotedblright
4892- \definedummyword\quoteleft
4893- \definedummyword\quoteright
4894- \definedummyword\quotesinglbase
4895- \definedummyword\rbracechar
4896- \definedummyword\result
4897- \definedummyword\sub
4898- \definedummyword\sup
4899- \definedummyword\textdegree
4900- %
4901- \definedummyword\subentry
4902- %
4903- % We want to disable all macros so that they are not expanded by \write.
4904- \macrolist
4905- \let\value\dummyvalue
4906- %
4907- \normalturnoffactive
4908-}
4909-
4910-% \commondummiesnofonts: common to \definedummies and \indexnofonts.
4911-% Define \commondummyletter, \commondummyaccent and \commondummyword before
4912-% using. Used for accents, font commands, and various control letters.
4913-%
4914-\def\commondummiesnofonts{%
4915- % Control letters and accents.
4916- \commondummyletter\!%
4917- \commondummyaccent\"%
4918- \commondummyaccent\'%
4919- \commondummyletter\*%
4920- \commondummyaccent\,%
4921- \commondummyletter\.%
4922- \commondummyletter\/%
4923- \commondummyletter\:%
4924- \commondummyaccent\=%
4925- \commondummyletter\?%
4926- \commondummyaccent\^%
4927- \commondummyaccent\`%
4928- \commondummyaccent\~%
4929- \commondummyword\u
4930- \commondummyword\v
4931- \commondummyword\H
4932- \commondummyword\dotaccent
4933- \commondummyword\ogonek
4934- \commondummyword\ringaccent
4935- \commondummyword\tieaccent
4936- \commondummyword\ubaraccent
4937- \commondummyword\udotaccent
4938- \commondummyword\dotless
4939- %
4940- % Texinfo font commands.
4941- \commondummyword\b
4942- \commondummyword\i
4943- \commondummyword\r
4944- \commondummyword\sansserif
4945- \commondummyword\sc
4946- \commondummyword\slanted
4947- \commondummyword\t
4948- %
4949- % Commands that take arguments.
4950- \commondummyword\abbr
4951- \commondummyword\acronym
4952- \commondummyword\anchor
4953- \commondummyword\cite
4954- \commondummyword\code
4955- \commondummyword\command
4956- \commondummyword\dfn
4957- \commondummyword\dmn
4958- \commondummyword\email
4959- \commondummyword\emph
4960- \commondummyword\env
4961- \commondummyword\file
4962- \commondummyword\image
4963- \commondummyword\indicateurl
4964- \commondummyword\inforef
4965- \commondummyword\kbd
4966- \commondummyword\key
4967- \commondummyword\math
4968- \commondummyword\option
4969- \commondummyword\pxref
4970- \commondummyword\ref
4971- \commondummyword\samp
4972- \commondummyword\strong
4973- \commondummyword\tie
4974- \commondummyword\U
4975- \commondummyword\uref
4976- \commondummyword\url
4977- \commondummyword\var
4978- \commondummyword\verb
4979- \commondummyword\w
4980- \commondummyword\xref
4981-}
4982-
4983-\let\indexlbrace\relax
4984-\let\indexrbrace\relax
4985-\let\indexatchar\relax
4986-\let\indexbackslash\relax
4987-
4988-{\catcode`\@=0
4989-\catcode`\\=13
4990- @gdef@backslashdisappear{@def\{}}
4991-}
4992-
4993-{
4994-\catcode`\<=13
4995-\catcode`\-=13
4996-\catcode`\`=13
4997- \gdef\indexnonalnumdisappear{%
4998- \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
4999- % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5000- % (Introduced for FSFS 2nd ed.)
5001- \let`=\empty
5002- \fi
5003- %
5004- \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5005- \backslashdisappear
5006- \fi
5007- %
5008- \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5009- \def-{}%
5010- \fi
5011- \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5012- \def<{}%
5013- \fi
5014- \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5015- \def\@{}%
5016- \fi
5017- }
5018-
5019- \gdef\indexnonalnumreappear{%
5020- \let-\normaldash
5021- \let<\normalless
5022- }
5023-}
5024-
5025-
5026-% \indexnofonts is used when outputting the strings to sort the index
5027-% by, and when constructing control sequence names. It eliminates all
5028-% control sequences and just writes whatever the best ASCII sort string
5029-% would be for a given command (usually its argument).
5030-%
5031-\def\indexnofonts{%
5032- % Accent commands should become @asis.
5033- \def\commondummyaccent##1{\let##1\asis}%
5034- % We can just ignore other control letters.
5035- \def\commondummyletter##1{\let##1\empty}%
5036- % All control words become @asis by default; overrides below.
5037- \let\commondummyword\commondummyaccent
5038- \commondummiesnofonts
5039- %
5040- % Don't no-op \tt, since it isn't a user-level command
5041- % and is used in the definitions of the active chars like <, >, |, etc.
5042- % Likewise with the other plain tex font commands.
5043- %\let\tt=\asis
5044- %
5045- \def\ { }%
5046- \def\@{@}%
5047- \def\_{\normalunderscore}%
5048- \def\-{}% @- shouldn't affect sorting
5049- %
5050- \uccode`\1=`\{ \uppercase{\def\{{1}}%
5051- \uccode`\1=`\} \uppercase{\def\}{1}}%
5052- \let\lbracechar\{%
5053- \let\rbracechar\}%
5054- %
5055- % Non-English letters.
5056- \def\AA{AA}%
5057- \def\AE{AE}%
5058- \def\DH{DZZ}%
5059- \def\L{L}%
5060- \def\OE{OE}%
5061- \def\O{O}%
5062- \def\TH{TH}%
5063- \def\aa{aa}%
5064- \def\ae{ae}%
5065- \def\dh{dzz}%
5066- \def\exclamdown{!}%
5067- \def\l{l}%
5068- \def\oe{oe}%
5069- \def\ordf{a}%
5070- \def\ordm{o}%
5071- \def\o{o}%
5072- \def\questiondown{?}%
5073- \def\ss{ss}%
5074- \def\th{th}%
5075- %
5076- \let\do\indexnofontsdef
5077- %
5078- \do\LaTeX{LaTeX}%
5079- \do\TeX{TeX}%
5080- %
5081- % Assorted special characters.
5082- \do\atchar{@}%
5083- \do\arrow{->}%
5084- \do\bullet{bullet}%
5085- \do\comma{,}%
5086- \do\copyright{copyright}%
5087- \do\dots{...}%
5088- \do\enddots{...}%
5089- \do\equiv{==}%
5090- \do\error{error}%
5091- \do\euro{euro}%
5092- \do\expansion{==>}%
5093- \do\geq{>=}%
5094- \do\guillemetleft{<<}%
5095- \do\guillemetright{>>}%
5096- \do\guilsinglleft{<}%
5097- \do\guilsinglright{>}%
5098- \do\leq{<=}%
5099- \do\lbracechar{\{}%
5100- \do\minus{-}%
5101- \do\point{.}%
5102- \do\pounds{pounds}%
5103- \do\print{-|}%
5104- \do\quotedblbase{"}%
5105- \do\quotedblleft{"}%
5106- \do\quotedblright{"}%
5107- \do\quoteleft{`}%
5108- \do\quoteright{'}%
5109- \do\quotesinglbase{,}%
5110- \do\rbracechar{\}}%
5111- \do\registeredsymbol{R}%
5112- \do\result{=>}%
5113- \do\textdegree{o}%
5114- %
5115- % We need to get rid of all macros, leaving only the arguments (if present).
5116- % Of course this is not nearly correct, but it is the best we can do for now.
5117- % makeinfo does not expand macros in the argument to @deffn, which ends up
5118- % writing an index entry, and texindex isn't prepared for an index sort entry
5119- % that starts with \.
5120- %
5121- % Since macro invocations are followed by braces, we can just redefine them
5122- % to take a single TeX argument. The case of a macro invocation that
5123- % goes to end-of-line is not handled.
5124- %
5125- \macrolist
5126- \let\value\indexnofontsvalue
5127-}
5128-
5129-% Give the control sequence a definition that removes the {} that follows
5130-% its use, e.g. @AA{} -> AA
5131-\def\indexnofontsdef#1#2{\def#1##1{#2}}%
5132-
5133-
5134-
5135-
5136-% #1 is the index name, #2 is the entry text.
5137-\def\doind#1#2{%
5138- \iflinks
5139- {%
5140- %
5141- \requireopenindexfile{#1}%
5142- \edef\writeto{\csname#1indfile\endcsname}%
5143- %
5144- \def\indextext{#2}%
5145- \safewhatsit\doindwrite
5146- }%
5147- \fi
5148-}
5149-
5150-% Same as \doind, but for code indices
5151-\def\docind#1#2{%
5152- \iflinks
5153- {%
5154- %
5155- \requireopenindexfile{#1}%
5156- \edef\writeto{\csname#1indfile\endcsname}%
5157- %
5158- \def\indextext{#2}%
5159- \safewhatsit\docindwrite
5160- }%
5161- \fi
5162-}
5163-
5164-% Check if an index file has been opened, and if not, open it.
5165-\def\requireopenindexfile#1{%
5166-\ifnum\csname #1indfile\endcsname=0
5167- \expandafter\newwrite \csname#1indfile\endcsname
5168- \edef\suffix{#1}%
5169- % A .fls suffix would conflict with the file extension for the output
5170- % of -recorder, so use .f1s instead.
5171- \ifx\suffix\indexisfl\def\suffix{f1}\fi
5172- % Open the file
5173- \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5174- % Using \immediate above here prevents an object entering into the current
5175- % box, which could confound checks such as those in \safewhatsit for
5176- % preceding skips.
5177- \typeout{Writing index file \jobname.\suffix}%
5178-\fi}
5179-\def\indexisfl{fl}
5180-
5181-% Definition for writing index entry sort key.
5182-{
5183-\catcode`\-=13
5184-\gdef\indexwritesortas{%
5185- \begingroup
5186- \indexnonalnumreappear
5187- \indexwritesortasxxx}
5188-\gdef\indexwritesortasxxx#1{%
5189- \xdef\indexsortkey{#1}\endgroup}
5190-}
5191-
5192-\def\indexwriteseealso#1{
5193- \gdef\pagenumbertext{\string\seealso{#1}}%
5194-}
5195-\def\indexwriteseeentry#1{
5196- \gdef\pagenumbertext{\string\seeentry{#1}}%
5197-}
5198-
5199-% The default definitions
5200-\def\sortas#1{}%
5201-\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5202-\def\putwordSeeAlso{See also}
5203-\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5204-
5205-
5206-% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5207-% * Set \bracedtext to "{aaa}{bbb}"
5208-% * Set \fullindexsortkey to "aaa @subentry ZZZ"
5209-% * If @seealso occurs, set \pagenumbertext
5210-%
5211-\def\splitindexentry#1{%
5212- \gdef\fullindexsortkey{}%
5213- \xdef\bracedtext{}%
5214- \def\sep{}%
5215- \def\seealso##1{}%
5216- \def\seeentry##1{}%
5217- \expandafter\doindexsegment#1\subentry\finish\subentry
5218-}
5219-
5220-% append the results from the next segment
5221-\def\doindexsegment#1\subentry{%
5222- \def\segment{#1}%
5223- \ifx\segment\isfinish
5224- \else
5225- %
5226- % Fully expand the segment, throwing away any @sortas directives, and
5227- % trim spaces.
5228- \edef\trimmed{\segment}%
5229- \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5230- \ifincodeindex
5231- \edef\trimmed{\noexpand\code{\trimmed}}%
5232- \fi
5233- %
5234- \xdef\bracedtext{\bracedtext{\trimmed}}%
5235- %
5236- % Get the string to sort by. Process the segment with all
5237- % font commands turned off.
5238- \bgroup
5239- \let\sortas\indexwritesortas
5240- \let\seealso\indexwriteseealso
5241- \let\seeentry\indexwriteseeentry
5242- \indexnofonts
5243- % The braces around the commands are recognized by texindex.
5244- \def\lbracechar{{\string\indexlbrace}}%
5245- \def\rbracechar{{\string\indexrbrace}}%
5246- \let\{=\lbracechar
5247- \let\}=\rbracechar
5248- \def\@{{\string\indexatchar}}%
5249- \def\atchar##1{\@}%
5250- \def\backslashchar{{\string\indexbackslash}}%
5251- \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5252- %
5253- \let\indexsortkey\empty
5254- \global\let\pagenumbertext\empty
5255- % Execute the segment and throw away the typeset output. This executes
5256- % any @sortas or @seealso commands in this segment.
5257- \setbox\dummybox = \hbox{\segment}%
5258- \ifx\indexsortkey\empty{%
5259- \indexnonalnumdisappear
5260- \xdef\trimmed{\segment}%
5261- \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5262- \xdef\indexsortkey{\trimmed}%
5263- \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5264- }\fi
5265- %
5266- % Append to \fullindexsortkey.
5267- \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5268- \fullindexsortkey\sep\indexsortkey}}%
5269- \tmp
5270- \egroup
5271- \def\sep{\subentry}%
5272- %
5273- \expandafter\doindexsegment
5274- \fi
5275-}
5276-\def\isfinish{\finish}%
5277-\newbox\dummybox % used above
5278-
5279-\let\subentry\relax
5280-
5281-% Use \ instead of @ in index files. To support old texi2dvi and texindex.
5282-% This works without changing the escape character used in the toc or aux
5283-% files because the index entries are fully expanded here, and \string uses
5284-% the current value of \escapechar.
5285-\def\escapeisbackslash{\escapechar=`\\}
5286-
5287-% Use \ in index files by default. texi2dvi didn't support @ as the escape
5288-% character (as it checked for "\entry" in the files, and not "@entry"). When
5289-% the new version of texi2dvi has had a chance to become more prevalent, then
5290-% the escape character can change back to @ again. This should be an easy
5291-% change to make now because both @ and \ are only used as escape characters in
5292-% index files, never standing for themselves.
5293-%
5294-\set txiindexescapeisbackslash
5295-
5296-% Write the entry in \indextext to the index file.
5297-%
5298-
5299-\newif\ifincodeindex
5300-\def\doindwrite{\incodeindexfalse\doindwritex}
5301-\def\docindwrite{\incodeindextrue\doindwritex}
5302-
5303-\def\doindwritex{%
5304- \maybemarginindex
5305- %
5306- \atdummies
5307- %
5308- \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
5309- \escapeisbackslash
5310- \fi
5311- %
5312- % For texindex which always views { and } as separators.
5313- \def\{{\lbracechar{}}%
5314- \def\}{\rbracechar{}}%
5315- \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5316- %
5317- % Split the entry into primary entry and any subentries, and get the index
5318- % sort key.
5319- \splitindexentry\indextext
5320- %
5321- % Set up the complete index entry, with both the sort key and
5322- % the original text, including any font commands. We write
5323- % three arguments to \entry to the .?? file (four in the
5324- % subentry case), texindex reduces to two when writing the .??s
5325- % sorted result.
5326- %
5327- \edef\temp{%
5328- \write\writeto{%
5329- \string\entry{\fullindexsortkey}%
5330- {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5331- \bracedtext}%
5332- }%
5333- \temp
5334-}
5335-
5336-% Put the index entry in the margin if desired (undocumented).
5337-\def\maybemarginindex{%
5338- \ifx\SETmarginindex\relax\else
5339- \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5340- \fi
5341-}
5342-\let\SETmarginindex=\relax
5343-
5344-
5345-% Take care of unwanted page breaks/skips around a whatsit:
5346-%
5347-% If a skip is the last thing on the list now, preserve it
5348-% by backing up by \lastskip, doing the \write, then inserting
5349-% the skip again. Otherwise, the whatsit generated by the
5350-% \write or \pdfdest will make \lastskip zero. The result is that
5351-% sequences like this:
5352-% @end defun
5353-% @tindex whatever
5354-% @defun ...
5355-% will have extra space inserted, because the \medbreak in the
5356-% start of the @defun won't see the skip inserted by the @end of
5357-% the previous defun.
5358-%
5359-% But don't do any of this if we're not in vertical mode. We
5360-% don't want to do a \vskip and prematurely end a paragraph.
5361-%
5362-% Avoid page breaks due to these extra skips, too.
5363-%
5364-% But wait, there is a catch there:
5365-% We'll have to check whether \lastskip is zero skip. \ifdim is not
5366-% sufficient for this purpose, as it ignores stretch and shrink parts
5367-% of the skip. The only way seems to be to check the textual
5368-% representation of the skip.
5369-%
5370-% The following is almost like \def\zeroskipmacro{0.0pt} except that
5371-% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5372-%
5373-\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5374-%
5375-\newskip\whatsitskip
5376-\newcount\whatsitpenalty
5377-%
5378-% ..., ready, GO:
5379-%
5380-\def\safewhatsit#1{\ifhmode
5381- #1%
5382- \else
5383- % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5384- \whatsitskip = \lastskip
5385- \edef\lastskipmacro{\the\lastskip}%
5386- \whatsitpenalty = \lastpenalty
5387- %
5388- % If \lastskip is nonzero, that means the last item was a
5389- % skip. And since a skip is discardable, that means this
5390- % -\whatsitskip glue we're inserting is preceded by a
5391- % non-discardable item, therefore it is not a potential
5392- % breakpoint, therefore no \nobreak needed.
5393- \ifx\lastskipmacro\zeroskipmacro
5394- \else
5395- \vskip-\whatsitskip
5396- \fi
5397- %
5398- #1%
5399- %
5400- \ifx\lastskipmacro\zeroskipmacro
5401- % If \lastskip was zero, perhaps the last item was a penalty, and
5402- % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5403- % to re-insert the same penalty (values >10000 are used for various
5404- % signals); since we just inserted a non-discardable item, any
5405- % following glue (such as a \parskip) would be a breakpoint. For example:
5406- % @deffn deffn-whatever
5407- % @vindex index-whatever
5408- % Description.
5409- % would allow a break between the index-whatever whatsit
5410- % and the "Description." paragraph.
5411- \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5412- \else
5413- % On the other hand, if we had a nonzero \lastskip,
5414- % this make-up glue would be preceded by a non-discardable item
5415- % (the whatsit from the \write), so we must insert a \nobreak.
5416- \nobreak\vskip\whatsitskip
5417- \fi
5418-\fi}
5419-
5420-% The index entry written in the file actually looks like
5421-% \entry {sortstring}{page}{topic}
5422-% or
5423-% \entry {sortstring}{page}{topic}{subtopic}
5424-% The texindex program reads in these files and writes files
5425-% containing these kinds of lines:
5426-% \initial {c}
5427-% before the first topic whose initial is c
5428-% \entry {topic}{pagelist}
5429-% for a topic that is used without subtopics
5430-% \primary {topic}
5431-% \entry {topic}{}
5432-% for the beginning of a topic that is used with subtopics
5433-% \secondary {subtopic}{pagelist}
5434-% for each subtopic.
5435-% \secondary {subtopic}{}
5436-% for a subtopic with sub-subtopics
5437-% \tertiary {subtopic}{subsubtopic}{pagelist}
5438-% for each sub-subtopic.
5439-
5440-% Define the user-accessible indexing commands
5441-% @findex, @vindex, @kindex, @cindex.
5442-
5443-\def\findex {\fnindex}
5444-\def\kindex {\kyindex}
5445-\def\cindex {\cpindex}
5446-\def\vindex {\vrindex}
5447-\def\tindex {\tpindex}
5448-\def\pindex {\pgindex}
5449-
5450-% Define the macros used in formatting output of the sorted index material.
5451-
5452-% @printindex causes a particular index (the ??s file) to get printed.
5453-% It does not print any chapter heading (usually an @unnumbered).
5454-%
5455-\parseargdef\printindex{\begingroup
5456- \dobreak \chapheadingskip{10000}%
5457- %
5458- \smallfonts \rm
5459- \tolerance = 9500
5460- \plainfrenchspacing
5461- \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5462- %
5463- % See comment in \requireopenindexfile.
5464- \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5465- %
5466- % See if the index file exists and is nonempty.
5467- \openin 1 \jobname.\indexname s
5468- \ifeof 1
5469- % \enddoublecolumns gets confused if there is no text in the index,
5470- % and it loses the chapter title and the aux file entries for the
5471- % index. The easiest way to prevent this problem is to make sure
5472- % there is some text.
5473- \putwordIndexNonexistent
5474- \typeout{No file \jobname.\indexname s.}%
5475- \else
5476- % If the index file exists but is empty, then \openin leaves \ifeof
5477- % false. We have to make TeX try to read something from the file, so
5478- % it can discover if there is anything in it.
5479- \read 1 to \thisline
5480- \ifeof 1
5481- \putwordIndexIsEmpty
5482- \else
5483- \expandafter\printindexzz\thisline\relax\relax\finish%
5484- \fi
5485- \fi
5486- \closein 1
5487-\endgroup}
5488-
5489-% If the index file starts with a backslash, forgo reading the index
5490-% file altogether. If somebody upgrades texinfo.tex they may still have
5491-% old index files using \ as the escape character. Reading this would
5492-% at best lead to typesetting garbage, at worst a TeX syntax error.
5493-\def\printindexzz#1#2\finish{%
5494- \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
5495- \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5496- \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
5497-\errmessage{%
5498-ERROR: A sorted index file in an obsolete format was skipped.
5499-To fix this problem, please upgrade your version of 'texi2dvi'
5500-or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5501-If you are using an old version of 'texindex' (part of the Texinfo
5502-distribution), you may also need to upgrade to a newer version (at least 6.0).
5503-You may be able to typeset the index if you run
5504-'texindex \jobname.\indexname' yourself.
5505-You could also try setting the 'txiindexescapeisbackslash' flag by
5506-running a command like
5507-'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5508-this, Texinfo will try to use index files in the old format.
5509-If you continue to have problems, deleting the index files and starting again
5510-might help (with 'rm \jobname.?? \jobname.??s')%
5511-}%
5512- \else
5513- (Skipped sorted index file in obsolete format)
5514- \fi
5515- \else
5516- \begindoublecolumns
5517- \input \jobname.\indexname s
5518- \enddoublecolumns
5519- \fi
5520- \else
5521- \begindoublecolumns
5522- \catcode`\\=0\relax
5523- %
5524- % Make @ an escape character to give macros a chance to work. This
5525- % should work because we (hopefully) don't otherwise use @ in index files.
5526- %\catcode`\@=12\relax
5527- \catcode`\@=0\relax
5528- \input \jobname.\indexname s
5529- \enddoublecolumns
5530- \fi
5531-}
5532-
5533-% These macros are used by the sorted index file itself.
5534-% Change them to control the appearance of the index.
5535-
5536-{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5537-\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5538-\catcode`\$=3
5539-\gdef\initialglyphs{%
5540- % special control sequences used in the index sort key
5541- \let\indexlbrace\{%
5542- \let\indexrbrace\}%
5543- \let\indexatchar\@%
5544- \def\indexbackslash{\math{\backslash}}%
5545- %
5546- % Some changes for non-alphabetic characters. Using the glyphs from the
5547- % math fonts looks more consistent than the typewriter font used elsewhere
5548- % for these characters.
5549- \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5550- %
5551- % In case @\ is used for backslash
5552- \uppercase{\let\\=~}
5553- % Can't get bold backslash so don't use bold forward slash
5554- \catcode`\/=13
5555- \def/{{\secrmnotbold \normalslash}}%
5556- \def-{{\normaldash\normaldash}}% en dash `--'
5557- \def^{{\chapbf \normalcaret}}%
5558- \def~{{\chapbf \normaltilde}}%
5559- \def\_{%
5560- \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5561- \def|{$\vert$}%
5562- \def<{$\less$}%
5563- \def>{$\gtr$}%
5564- \def+{$\normalplus$}%
5565-}}
5566-
5567-\def\initial{%
5568- \bgroup
5569- \initialglyphs
5570- \initialx
5571-}
5572-
5573-\def\initialx#1{%
5574- % Remove any glue we may have, we'll be inserting our own.
5575- \removelastskip
5576- %
5577- % We like breaks before the index initials, so insert a bonus.
5578- % The glue before the bonus allows a little bit of space at the
5579- % bottom of a column to reduce an increase in inter-line spacing.
5580- \nobreak
5581- \vskip 0pt plus 5\baselineskip
5582- \penalty -300
5583- \vskip 0pt plus -5\baselineskip
5584- %
5585- % Typeset the initial. Making this add up to a whole number of
5586- % baselineskips increases the chance of the dots lining up from column
5587- % to column. It still won't often be perfect, because of the stretch
5588- % we need before each entry, but it's better.
5589- %
5590- % No shrink because it confuses \balancecolumns.
5591- \vskip 1.67\baselineskip plus 1\baselineskip
5592- \leftline{\secfonts \kern-0.05em \secbf #1}%
5593- % \secfonts is inside the argument of \leftline so that the change of
5594- % \baselineskip will not affect any glue inserted before the vbox that
5595- % \leftline creates.
5596- % Do our best not to break after the initial.
5597- \nobreak
5598- \vskip .33\baselineskip plus .1\baselineskip
5599- \egroup % \initialglyphs
5600-}
5601-
5602-\newdimen\entryrightmargin
5603-\entryrightmargin=0pt
5604-
5605-% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5606-% then page number (#2) flushed to the right margin. It is used for index
5607-% and table of contents entries. The paragraph is indented by \leftskip.
5608-%
5609-\def\entry{%
5610- \begingroup
5611- %
5612- % Start a new paragraph if necessary, so our assignments below can't
5613- % affect previous text.
5614- \par
5615- %
5616- % No extra space above this paragraph.
5617- \parskip = 0in
5618- %
5619- % When reading the text of entry, convert explicit line breaks
5620- % from @* into spaces. The user might give these in long section
5621- % titles, for instance.
5622- \def\*{\unskip\space\ignorespaces}%
5623- \def\entrybreak{\hfil\break}% An undocumented command
5624- %
5625- % Swallow the left brace of the text (first parameter):
5626- \afterassignment\doentry
5627- \let\temp =
5628-}
5629-\def\entrybreak{\unskip\space\ignorespaces}%
5630-\def\doentry{%
5631- % Save the text of the entry
5632- \global\setbox\boxA=\hbox\bgroup
5633- \bgroup % Instead of the swallowed brace.
5634- \noindent
5635- \aftergroup\finishentry
5636- % And now comes the text of the entry.
5637- % Not absorbing as a macro argument reduces the chance of problems
5638- % with catcodes occurring.
5639-}
5640-{\catcode`\@=11
5641-\gdef\finishentry#1{%
5642- \egroup % end box A
5643- \dimen@ = \wd\boxA % Length of text of entry
5644- \global\setbox\boxA=\hbox\bgroup
5645- \unhbox\boxA
5646- % #1 is the page number.
5647- %
5648- % Get the width of the page numbers, and only use
5649- % leaders if they are present.
5650- \global\setbox\boxB = \hbox{#1}%
5651- \ifdim\wd\boxB = 0pt
5652- \null\nobreak\hfill\ %
5653- \else
5654- %
5655- \null\nobreak\indexdotfill % Have leaders before the page number.
5656- %
5657- \ifpdforxetex
5658- \pdfgettoks#1.%
5659- \hskip\skip\thinshrinkable\the\toksA
5660- \else
5661- \hskip\skip\thinshrinkable #1%
5662- \fi
5663- \fi
5664- \egroup % end \boxA
5665- \ifdim\wd\boxB = 0pt
5666- \noindent\unhbox\boxA\par
5667- \nobreak
5668- \else\bgroup
5669- % We want the text of the entries to be aligned to the left, and the
5670- % page numbers to be aligned to the right.
5671- %
5672- \parindent = 0pt
5673- \advance\leftskip by 0pt plus 1fil
5674- \advance\leftskip by 0pt plus -1fill
5675- \rightskip = 0pt plus -1fil
5676- \advance\rightskip by 0pt plus 1fill
5677- % Cause last line, which could consist of page numbers on their own
5678- % if the list of page numbers is long, to be aligned to the right.
5679- \parfillskip=0pt plus -1fill
5680- %
5681- \advance\rightskip by \entryrightmargin
5682- % Determine how far we can stretch into the margin.
5683- % This allows, e.g., "Appendix H GNU Free Documentation License" to
5684- % fit on one line in @letterpaper format.
5685- \ifdim\entryrightmargin>2.1em
5686- \dimen@i=2.1em
5687- \else
5688- \dimen@i=0em
5689- \fi
5690- \advance \parfillskip by 0pt minus 1\dimen@i
5691- %
5692- \dimen@ii = \hsize
5693- \advance\dimen@ii by -1\leftskip
5694- \advance\dimen@ii by -1\entryrightmargin
5695- \advance\dimen@ii by 1\dimen@i
5696- \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5697- \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5698- % Try to split the text roughly evenly. \dimen@ will be the length of
5699- % the first line.
5700- \dimen@ = 0.7\dimen@
5701- \dimen@ii = \hsize
5702- \ifnum\dimen@>\dimen@ii
5703- % If the entry is too long (for example, if it needs more than
5704- % two lines), use all the space in the first line.
5705- \dimen@ = \dimen@ii
5706- \fi
5707- \advance\leftskip by 0pt plus 1fill % ragged right
5708- \advance \dimen@ by 1\rightskip
5709- \parshape = 2 0pt \dimen@ 0em \dimen@ii
5710- % Ideally we'd add a finite glue at the end of the first line only,
5711- % instead of using \parshape with explicit line lengths, but TeX
5712- % doesn't seem to provide a way to do such a thing.
5713- %
5714- % Indent all lines but the first one.
5715- \advance\leftskip by 1em
5716- \advance\parindent by -1em
5717- \fi\fi
5718- \indent % start paragraph
5719- \unhbox\boxA
5720- %
5721- % Do not prefer a separate line ending with a hyphen to fewer lines.
5722- \finalhyphendemerits = 0
5723- %
5724- % Word spacing - no stretch
5725- \spaceskip=\fontdimen2\font minus \fontdimen4\font
5726- %
5727- \linepenalty=1000 % Discourage line breaks.
5728- \hyphenpenalty=5000 % Discourage hyphenation.
5729- %
5730- \par % format the paragraph
5731- \egroup % The \vbox
5732- \fi
5733- \endgroup
5734-}}
5735-
5736-\newskip\thinshrinkable
5737-\skip\thinshrinkable=.15em minus .15em
5738-
5739-% Like plain.tex's \dotfill, except uses up at least 1 em.
5740-% The filll stretch here overpowers both the fil and fill stretch to push
5741-% the page number to the right.
5742-\def\indexdotfill{\cleaders
5743- \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5744-
5745-
5746-\def\primary #1{\line{#1\hfil}}
5747-
5748-\def\secondary{\indententry{0.5cm}}
5749-\def\tertiary{\indententry{1cm}}
5750-
5751-\def\indententry#1#2#3{%
5752- \bgroup
5753- \leftskip=#1
5754- \entry{#2}{#3}%
5755- \egroup
5756-}
5757-
5758-% Define two-column mode, which we use to typeset indexes.
5759-% Adapted from the TeXbook, page 416, which is to say,
5760-% the manmac.tex format used to print the TeXbook itself.
5761-\catcode`\@=11 % private names
5762-
5763-\newbox\partialpage
5764-\newdimen\doublecolumnhsize
5765-
5766-\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5767- % If not much space left on page, start a new page.
5768- \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5769- %
5770- % Grab any single-column material above us.
5771- \output = {%
5772- \savetopmark
5773- %
5774- \global\setbox\partialpage = \vbox{%
5775- % Unvbox the main output page.
5776- \unvbox\PAGE
5777- \kern-\topskip \kern\baselineskip
5778- }%
5779- }%
5780- \eject % run that output routine to set \partialpage
5781- %
5782- % Use the double-column output routine for subsequent pages.
5783- \output = {\doublecolumnout}%
5784- %
5785- % Change the page size parameters. We could do this once outside this
5786- % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5787- % format, but then we repeat the same computation. Repeating a couple
5788- % of assignments once per index is clearly meaningless for the
5789- % execution time, so we may as well do it in one place.
5790- %
5791- % First we halve the line length, less a little for the gutter between
5792- % the columns. We compute the gutter based on the line length, so it
5793- % changes automatically with the paper format. The magic constant
5794- % below is chosen so that the gutter has the same value (well, +-<1pt)
5795- % as it did when we hard-coded it.
5796- %
5797- % We put the result in a separate register, \doublecolumhsize, so we
5798- % can restore it in \pagesofar, after \hsize itself has (potentially)
5799- % been clobbered.
5800- %
5801- \doublecolumnhsize = \hsize
5802- \advance\doublecolumnhsize by -.04154\hsize
5803- \divide\doublecolumnhsize by 2
5804- \hsize = \doublecolumnhsize
5805- %
5806- % Get the available space for the double columns -- the normal
5807- % (undoubled) page height minus any material left over from the
5808- % previous page.
5809- \advance\vsize by -\ht\partialpage
5810- \vsize = 2\vsize
5811- %
5812- % For the benefit of balancing columns
5813- \advance\baselineskip by 0pt plus 0.5pt
5814-}
5815-
5816-% The double-column output routine for all double-column pages except
5817-% the last, which is done by \balancecolumns.
5818-%
5819-\def\doublecolumnout{%
5820- %
5821- \savetopmark
5822- \splittopskip=\topskip \splitmaxdepth=\maxdepth
5823- \dimen@ = \vsize
5824- \divide\dimen@ by 2
5825- %
5826- % box0 will be the left-hand column, box2 the right.
5827- \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5828- \global\advance\vsize by 2\ht\partialpage
5829- \onepageout\pagesofar % empty except for the first time we are called
5830- \unvbox\PAGE
5831- \penalty\outputpenalty
5832-}
5833-%
5834-% Re-output the contents of the output page -- any previous material,
5835-% followed by the two boxes we just split, in box0 and box2.
5836-\def\pagesofar{%
5837- \unvbox\partialpage
5838- %
5839- \hsize = \doublecolumnhsize
5840- \wd0=\hsize \wd2=\hsize
5841- \hbox to\txipagewidth{\box0\hfil\box2}%
5842-}
5843-
5844-
5845-% Finished with double columns.
5846-\def\enddoublecolumns{%
5847- % The following penalty ensures that the page builder is exercised
5848- % _before_ we change the output routine. This is necessary in the
5849- % following situation:
5850- %
5851- % The last section of the index consists only of a single entry.
5852- % Before this section, \pagetotal is less than \pagegoal, so no
5853- % break occurs before the last section starts. However, the last
5854- % section, consisting of \initial and the single \entry, does not
5855- % fit on the page and has to be broken off. Without the following
5856- % penalty the page builder will not be exercised until \eject
5857- % below, and by that time we'll already have changed the output
5858- % routine to the \balancecolumns version, so the next-to-last
5859- % double-column page will be processed with \balancecolumns, which
5860- % is wrong: The two columns will go to the main vertical list, with
5861- % the broken-off section in the recent contributions. As soon as
5862- % the output routine finishes, TeX starts reconsidering the page
5863- % break. The two columns and the broken-off section both fit on the
5864- % page, because the two columns now take up only half of the page
5865- % goal. When TeX sees \eject from below which follows the final
5866- % section, it invokes the new output routine that we've set after
5867- % \balancecolumns below; \onepageout will try to fit the two columns
5868- % and the final section into the vbox of \txipageheight (see
5869- % \pagebody), causing an overfull box.
5870- %
5871- % Note that glue won't work here, because glue does not exercise the
5872- % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5873- \penalty0
5874- %
5875- \output = {%
5876- % Split the last of the double-column material.
5877- \savetopmark
5878- \balancecolumns
5879- }%
5880- \eject % call the \output just set
5881- \ifdim\pagetotal=0pt
5882- % Having called \balancecolumns once, we do not
5883- % want to call it again. Therefore, reset \output to its normal
5884- % definition right away.
5885- \global\output=\expandafter{\the\defaultoutput}
5886- %
5887- \endgroup % started in \begindoublecolumns
5888- % Leave the double-column material on the current page, no automatic
5889- % page break.
5890- \box\balancedcolumns
5891- %
5892- % \pagegoal was set to the doubled \vsize above, since we restarted
5893- % the current page. We're now back to normal single-column
5894- % typesetting, so reset \pagegoal to the normal \vsize.
5895- \global\vsize = \txipageheight %
5896- \pagegoal = \txipageheight %
5897- \else
5898- % We had some left-over material. This might happen when \doublecolumnout
5899- % is called in \balancecolumns. Try again.
5900- \expandafter\enddoublecolumns
5901- \fi
5902-}
5903-\newbox\balancedcolumns
5904-\setbox\balancedcolumns=\vbox{shouldnt see this}%
5905-%
5906-% Only called for the last of the double column material. \doublecolumnout
5907-% does the others.
5908-\def\balancecolumns{%
5909- \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5910- \dimen@ = \ht0
5911- \ifdim\dimen@<7\baselineskip
5912- % Don't split a short final column in two.
5913- \setbox2=\vbox{}%
5914- \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5915- \else
5916- % double the leading vertical space
5917- \advance\dimen@ by \topskip
5918- \advance\dimen@ by-\baselineskip
5919- \divide\dimen@ by 2 % target to split to
5920- \dimen@ii = \dimen@
5921- \splittopskip = \topskip
5922- % Loop until left column is at least as high as the right column.
5923- {%
5924- \vbadness = 10000
5925- \loop
5926- \global\setbox3 = \copy0
5927- \global\setbox1 = \vsplit3 to \dimen@
5928- \ifdim\ht1<\ht3
5929- \global\advance\dimen@ by 1pt
5930- \repeat
5931- }%
5932- % Now the left column is in box 1, and the right column in box 3.
5933- %
5934- % Check whether the left column has come out higher than the page itself.
5935- % (Note that we have doubled \vsize for the double columns, so
5936- % the actual height of the page is 0.5\vsize).
5937- \ifdim2\ht1>\vsize
5938- % It appears that we have been called upon to balance too much material.
5939- % Output some of it with \doublecolumnout, leaving the rest on the page.
5940- \setbox\PAGE=\box0
5941- \doublecolumnout
5942- \else
5943- % Compare the heights of the two columns.
5944- \ifdim4\ht1>5\ht3
5945- % Column heights are too different, so don't make their bottoms
5946- % flush with each other.
5947- \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
5948- \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
5949- \else
5950- % Make column bottoms flush with each other.
5951- \setbox2=\vbox to\ht1{\unvbox3\unskip}%
5952- \setbox0=\vbox to\ht1{\unvbox1\unskip}%
5953- \fi
5954- \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5955- \fi
5956- \fi
5957- %
5958-}
5959-\catcode`\@ = \other
5960-
5961-
5962-\message{sectioning,}
5963-% Chapters, sections, etc.
5964-
5965-% Let's start with @part.
5966-\outer\parseargdef\part{\partzzz{#1}}
5967-\def\partzzz#1{%
5968- \chapoddpage
5969- \null
5970- \vskip.3\vsize % move it down on the page a bit
5971- \begingroup
5972- \noindent \titlefonts\rm #1\par % the text
5973- \let\lastnode=\empty % no node to associate with
5974- \writetocentry{part}{#1}{}% but put it in the toc
5975- \headingsoff % no headline or footline on the part page
5976- % This outputs a mark at the end of the page that clears \thischapter
5977- % and \thissection, as is done in \startcontents.
5978- \let\pchapsepmacro\relax
5979- \chapmacro{}{Yomitfromtoc}{}%
5980- \chapoddpage
5981- \endgroup
5982-}
5983-
5984-% \unnumberedno is an oxymoron. But we count the unnumbered
5985-% sections so that we can refer to them unambiguously in the pdf
5986-% outlines by their "section number". We avoid collisions with chapter
5987-% numbers by starting them at 10000. (If a document ever has 10000
5988-% chapters, we're in trouble anyway, I'm sure.)
5989-\newcount\unnumberedno \unnumberedno = 10000
5990-\newcount\chapno
5991-\newcount\secno \secno=0
5992-\newcount\subsecno \subsecno=0
5993-\newcount\subsubsecno \subsubsecno=0
5994-
5995-% This counter is funny since it counts through charcodes of letters A, B, ...
5996-\newcount\appendixno \appendixno = `\@
5997-%
5998-% \def\appendixletter{\char\the\appendixno}
5999-% We do the following ugly conditional instead of the above simple
6000-% construct for the sake of pdftex, which needs the actual
6001-% letter in the expansion, not just typeset.
6002-%
6003-\def\appendixletter{%
6004- \ifnum\appendixno=`A A%
6005- \else\ifnum\appendixno=`B B%
6006- \else\ifnum\appendixno=`C C%
6007- \else\ifnum\appendixno=`D D%
6008- \else\ifnum\appendixno=`E E%
6009- \else\ifnum\appendixno=`F F%
6010- \else\ifnum\appendixno=`G G%
6011- \else\ifnum\appendixno=`H H%
6012- \else\ifnum\appendixno=`I I%
6013- \else\ifnum\appendixno=`J J%
6014- \else\ifnum\appendixno=`K K%
6015- \else\ifnum\appendixno=`L L%
6016- \else\ifnum\appendixno=`M M%
6017- \else\ifnum\appendixno=`N N%
6018- \else\ifnum\appendixno=`O O%
6019- \else\ifnum\appendixno=`P P%
6020- \else\ifnum\appendixno=`Q Q%
6021- \else\ifnum\appendixno=`R R%
6022- \else\ifnum\appendixno=`S S%
6023- \else\ifnum\appendixno=`T T%
6024- \else\ifnum\appendixno=`U U%
6025- \else\ifnum\appendixno=`V V%
6026- \else\ifnum\appendixno=`W W%
6027- \else\ifnum\appendixno=`X X%
6028- \else\ifnum\appendixno=`Y Y%
6029- \else\ifnum\appendixno=`Z Z%
6030- % The \the is necessary, despite appearances, because \appendixletter is
6031- % expanded while writing the .toc file. \char\appendixno is not
6032- % expandable, thus it is written literally, thus all appendixes come out
6033- % with the same letter (or @) in the toc without it.
6034- \else\char\the\appendixno
6035- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6036- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6037-
6038-% Each @chapter defines these (using marks) as the number+name, number
6039-% and name of the chapter. Page headings and footings can use
6040-% these. @section does likewise.
6041-\def\thischapter{}
6042-\def\thischapternum{}
6043-\def\thischaptername{}
6044-\def\thissection{}
6045-\def\thissectionnum{}
6046-\def\thissectionname{}
6047-
6048-\newcount\absseclevel % used to calculate proper heading level
6049-\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6050-
6051-% @raisesections: treat @section as chapter, @subsection as section, etc.
6052-\def\raisesections{\global\advance\secbase by -1}
6053-
6054-% @lowersections: treat @chapter as section, @section as subsection, etc.
6055-\def\lowersections{\global\advance\secbase by 1}
6056-
6057-% we only have subsub.
6058-\chardef\maxseclevel = 3
6059-%
6060-% A numbered section within an unnumbered changes to unnumbered too.
6061-% To achieve this, remember the "biggest" unnum. sec. we are currently in:
6062-\chardef\unnlevel = \maxseclevel
6063-%
6064-% Trace whether the current chapter is an appendix or not:
6065-% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6066-\def\chapheadtype{N}
6067-
6068-% Choose a heading macro
6069-% #1 is heading type
6070-% #2 is heading level
6071-% #3 is text for heading
6072-\def\genhead#1#2#3{%
6073- % Compute the abs. sec. level:
6074- \absseclevel=#2
6075- \advance\absseclevel by \secbase
6076- % Make sure \absseclevel doesn't fall outside the range:
6077- \ifnum \absseclevel < 0
6078- \absseclevel = 0
6079- \else
6080- \ifnum \absseclevel > 3
6081- \absseclevel = 3
6082- \fi
6083- \fi
6084- % The heading type:
6085- \def\headtype{#1}%
6086- \if \headtype U%
6087- \ifnum \absseclevel < \unnlevel
6088- \chardef\unnlevel = \absseclevel
6089- \fi
6090- \else
6091- % Check for appendix sections:
6092- \ifnum \absseclevel = 0
6093- \edef\chapheadtype{\headtype}%
6094- \else
6095- \if \headtype A\if \chapheadtype N%
6096- \errmessage{@appendix... within a non-appendix chapter}%
6097- \fi\fi
6098- \fi
6099- % Check for numbered within unnumbered:
6100- \ifnum \absseclevel > \unnlevel
6101- \def\headtype{U}%
6102- \else
6103- \chardef\unnlevel = 3
6104- \fi
6105- \fi
6106- % Now print the heading:
6107- \if \headtype U%
6108- \ifcase\absseclevel
6109- \unnumberedzzz{#3}%
6110- \or \unnumberedseczzz{#3}%
6111- \or \unnumberedsubseczzz{#3}%
6112- \or \unnumberedsubsubseczzz{#3}%
6113- \fi
6114- \else
6115- \if \headtype A%
6116- \ifcase\absseclevel
6117- \appendixzzz{#3}%
6118- \or \appendixsectionzzz{#3}%
6119- \or \appendixsubseczzz{#3}%
6120- \or \appendixsubsubseczzz{#3}%
6121- \fi
6122- \else
6123- \ifcase\absseclevel
6124- \chapterzzz{#3}%
6125- \or \seczzz{#3}%
6126- \or \numberedsubseczzz{#3}%
6127- \or \numberedsubsubseczzz{#3}%
6128- \fi
6129- \fi
6130- \fi
6131- \suppressfirstparagraphindent
6132-}
6133-
6134-% an interface:
6135-\def\numhead{\genhead N}
6136-\def\apphead{\genhead A}
6137-\def\unnmhead{\genhead U}
6138-
6139-% @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6140-% all lower-level sectioning counters to zero.
6141-%
6142-% Also set \chaplevelprefix, which we prepend to @float sequence numbers
6143-% (e.g., figures), q.v. By default (before any chapter), that is empty.
6144-\let\chaplevelprefix = \empty
6145-%
6146-\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6147-\def\chapterzzz#1{%
6148- % section resetting is \global in case the chapter is in a group, such
6149- % as an @include file.
6150- \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6151- \global\advance\chapno by 1
6152- %
6153- % Used for \float.
6154- \gdef\chaplevelprefix{\the\chapno.}%
6155- \resetallfloatnos
6156- %
6157- % \putwordChapter can contain complex things in translations.
6158- \toks0=\expandafter{\putwordChapter}%
6159- \message{\the\toks0 \space \the\chapno}%
6160- %
6161- % Write the actual heading.
6162- \chapmacro{#1}{Ynumbered}{\the\chapno}%
6163- %
6164- % So @section and the like are numbered underneath this chapter.
6165- \global\let\section = \numberedsec
6166- \global\let\subsection = \numberedsubsec
6167- \global\let\subsubsection = \numberedsubsubsec
6168-}
6169-
6170-\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6171-%
6172-\def\appendixzzz#1{%
6173- \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6174- \global\advance\appendixno by 1
6175- \gdef\chaplevelprefix{\appendixletter.}%
6176- \resetallfloatnos
6177- %
6178- % \putwordAppendix can contain complex things in translations.
6179- \toks0=\expandafter{\putwordAppendix}%
6180- \message{\the\toks0 \space \appendixletter}%
6181- %
6182- \chapmacro{#1}{Yappendix}{\appendixletter}%
6183- %
6184- \global\let\section = \appendixsec
6185- \global\let\subsection = \appendixsubsec
6186- \global\let\subsubsection = \appendixsubsubsec
6187-}
6188-
6189-% normally unnmhead0 calls unnumberedzzz:
6190-\outer\parseargdef\unnumbered{\unnmhead0{#1}}
6191-\def\unnumberedzzz#1{%
6192- \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6193- \global\advance\unnumberedno by 1
6194- %
6195- % Since an unnumbered has no number, no prefix for figures.
6196- \global\let\chaplevelprefix = \empty
6197- \resetallfloatnos
6198- %
6199- % This used to be simply \message{#1}, but TeX fully expands the
6200- % argument to \message. Therefore, if #1 contained @-commands, TeX
6201- % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6202- % expanded @cite (which turns out to cause errors because \cite is meant
6203- % to be executed, not expanded).
6204- %
6205- % Anyway, we don't want the fully-expanded definition of @cite to appear
6206- % as a result of the \message, we just want `@cite' itself. We use
6207- % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6208- % simply yielding the contents of <toks register>. (We also do this for
6209- % the toc entries.)
6210- \toks0 = {#1}%
6211- \message{(\the\toks0)}%
6212- %
6213- \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6214- %
6215- \global\let\section = \unnumberedsec
6216- \global\let\subsection = \unnumberedsubsec
6217- \global\let\subsubsection = \unnumberedsubsubsec
6218-}
6219-
6220-% @centerchap is like @unnumbered, but the heading is centered.
6221-\outer\parseargdef\centerchap{%
6222- \let\centerparametersmaybe = \centerparameters
6223- \unnmhead0{#1}%
6224- \let\centerparametersmaybe = \relax
6225-}
6226-
6227-% @top is like @unnumbered.
6228-\let\top\unnumbered
6229-
6230-% Sections.
6231-%
6232-\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6233-\def\seczzz#1{%
6234- \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6235- \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6236-}
6237-
6238-% normally calls appendixsectionzzz:
6239-\outer\parseargdef\appendixsection{\apphead1{#1}}
6240-\def\appendixsectionzzz#1{%
6241- \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6242- \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6243-}
6244-\let\appendixsec\appendixsection
6245-
6246-% normally calls unnumberedseczzz:
6247-\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6248-\def\unnumberedseczzz#1{%
6249- \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6250- \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6251-}
6252-
6253-% Subsections.
6254-%
6255-% normally calls numberedsubseczzz:
6256-\outer\parseargdef\numberedsubsec{\numhead2{#1}}
6257-\def\numberedsubseczzz#1{%
6258- \global\subsubsecno=0 \global\advance\subsecno by 1
6259- \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6260-}
6261-
6262-% normally calls appendixsubseczzz:
6263-\outer\parseargdef\appendixsubsec{\apphead2{#1}}
6264-\def\appendixsubseczzz#1{%
6265- \global\subsubsecno=0 \global\advance\subsecno by 1
6266- \sectionheading{#1}{subsec}{Yappendix}%
6267- {\appendixletter.\the\secno.\the\subsecno}%
6268-}
6269-
6270-% normally calls unnumberedsubseczzz:
6271-\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6272-\def\unnumberedsubseczzz#1{%
6273- \global\subsubsecno=0 \global\advance\subsecno by 1
6274- \sectionheading{#1}{subsec}{Ynothing}%
6275- {\the\unnumberedno.\the\secno.\the\subsecno}%
6276-}
6277-
6278-% Subsubsections.
6279-%
6280-% normally numberedsubsubseczzz:
6281-\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6282-\def\numberedsubsubseczzz#1{%
6283- \global\advance\subsubsecno by 1
6284- \sectionheading{#1}{subsubsec}{Ynumbered}%
6285- {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6286-}
6287-
6288-% normally appendixsubsubseczzz:
6289-\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6290-\def\appendixsubsubseczzz#1{%
6291- \global\advance\subsubsecno by 1
6292- \sectionheading{#1}{subsubsec}{Yappendix}%
6293- {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6294-}
6295-
6296-% normally unnumberedsubsubseczzz:
6297-\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6298-\def\unnumberedsubsubseczzz#1{%
6299- \global\advance\subsubsecno by 1
6300- \sectionheading{#1}{subsubsec}{Ynothing}%
6301- {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6302-}
6303-
6304-% These macros control what the section commands do, according
6305-% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6306-% Define them by default for a numbered chapter.
6307-\let\section = \numberedsec
6308-\let\subsection = \numberedsubsec
6309-\let\subsubsection = \numberedsubsubsec
6310-
6311-% Define @majorheading, @heading and @subheading
6312-
6313-\def\majorheading{%
6314- {\advance\chapheadingskip by 10pt \chapbreak }%
6315- \parsearg\chapheadingzzz
6316-}
6317-
6318-\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6319-\def\chapheadingzzz#1{%
6320- \vbox{\chapfonts \raggedtitlesettings #1\par}%
6321- \nobreak\bigskip \nobreak
6322- \suppressfirstparagraphindent
6323-}
6324-
6325-% @heading, @subheading, @subsubheading.
6326-\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6327- \suppressfirstparagraphindent}
6328-\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6329- \suppressfirstparagraphindent}
6330-\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6331- \suppressfirstparagraphindent}
6332-
6333-% These macros generate a chapter, section, etc. heading only
6334-% (including whitespace, linebreaking, etc. around it),
6335-% given all the information in convenient, parsed form.
6336-
6337-% Args are the skip and penalty (usually negative)
6338-\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6339-
6340-% Parameter controlling skip before chapter headings (if needed)
6341-\newskip\chapheadingskip
6342-
6343-% Define plain chapter starts, and page on/off switching for it.
6344-\def\chapbreak{\dobreak \chapheadingskip {-4000}}
6345-
6346-% Start a new page
6347-\def\chappager{\par\vfill\supereject}
6348-
6349-% \chapoddpage - start on an odd page for a new chapter
6350-% Because \domark is called before \chapoddpage, the filler page will
6351-% get the headings for the next chapter, which is wrong. But we don't
6352-% care -- we just disable all headings on the filler page.
6353-\def\chapoddpage{%
6354- \chappager
6355- \ifodd\pageno \else
6356- \begingroup
6357- \headingsoff
6358- \null
6359- \chappager
6360- \endgroup
6361- \fi
6362-}
6363-
6364-\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6365-
6366-\def\CHAPPAGoff{%
6367-\global\let\contentsalignmacro = \chappager
6368-\global\let\pchapsepmacro=\chapbreak
6369-\global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6370-
6371-\def\CHAPPAGon{%
6372-\global\let\contentsalignmacro = \chappager
6373-\global\let\pchapsepmacro=\chappager
6374-\global\def\HEADINGSon{\HEADINGSsingle}}
6375-
6376-\def\CHAPPAGodd{%
6377-\global\let\contentsalignmacro = \chapoddpage
6378-\global\let\pchapsepmacro=\chapoddpage
6379-\global\def\HEADINGSon{\HEADINGSdouble}}
6380-
6381-\CHAPPAGon
6382-
6383-% \chapmacro - Chapter opening.
6384-%
6385-% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6386-% Yappendix, Yomitfromtoc), #3 the chapter number.
6387-% Not used for @heading series.
6388-%
6389-% To test against our argument.
6390-\def\Ynothingkeyword{Ynothing}
6391-\def\Yappendixkeyword{Yappendix}
6392-\def\Yomitfromtockeyword{Yomitfromtoc}
6393-%
6394-\def\chapmacro#1#2#3{%
6395- \expandafter\ifx\thisenv\titlepage\else
6396- \checkenv{}% chapters, etc., should not start inside an environment.
6397- \fi
6398- % Insert the first mark before the heading break (see notes for \domark).
6399- \let\prevchapterdefs=\currentchapterdefs
6400- \let\prevsectiondefs=\currentsectiondefs
6401- \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6402- \gdef\thissection{}}%
6403- %
6404- \def\temptype{#2}%
6405- \ifx\temptype\Ynothingkeyword
6406- \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6407- \gdef\thischapter{\thischaptername}}%
6408- \else\ifx\temptype\Yomitfromtockeyword
6409- \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6410- \gdef\thischapter{}}%
6411- \else\ifx\temptype\Yappendixkeyword
6412- \toks0={#1}%
6413- \xdef\currentchapterdefs{%
6414- \gdef\noexpand\thischaptername{\the\toks0}%
6415- \gdef\noexpand\thischapternum{\appendixletter}%
6416- % \noexpand\putwordAppendix avoids expanding indigestible
6417- % commands in some of the translations.
6418- \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6419- \noexpand\thischapternum:
6420- \noexpand\thischaptername}%
6421- }%
6422- \else
6423- \toks0={#1}%
6424- \xdef\currentchapterdefs{%
6425- \gdef\noexpand\thischaptername{\the\toks0}%
6426- \gdef\noexpand\thischapternum{\the\chapno}%
6427- % \noexpand\putwordChapter avoids expanding indigestible
6428- % commands in some of the translations.
6429- \gdef\noexpand\thischapter{\noexpand\putwordChapterPre{}
6430- \noexpand\thischapternum
6431- \noexpand\putwordChapterSuf{}:
6432- \noexpand\thischaptername}%
6433- }%
6434- \fi\fi\fi
6435- %
6436- % Output the mark. Pass it through \safewhatsit, to take care of
6437- % the preceding space.
6438- \safewhatsit\domark
6439- %
6440- % Insert the chapter heading break.
6441- \pchapsepmacro
6442- %
6443- % Now the second mark, after the heading break. No break points
6444- % between here and the heading.
6445- \let\prevchapterdefs=\currentchapterdefs
6446- \let\prevsectiondefs=\currentsectiondefs
6447- \domark
6448- %
6449- {%
6450- \chapfonts \rm
6451- \let\footnote=\errfootnoteheading % give better error message
6452- %
6453- % Have to define \currentsection before calling \donoderef, because the
6454- % xref code eventually uses it. On the other hand, it has to be called
6455- % after \pchapsepmacro, or the headline will change too soon.
6456- \gdef\currentsection{#1}%
6457- %
6458- % Only insert the separating space if we have a chapter/appendix
6459- % number, and don't print the unnumbered ``number''.
6460- \ifx\temptype\Ynothingkeyword
6461- \setbox0 = \hbox{}%
6462- \def\toctype{unnchap}%
6463- \else\ifx\temptype\Yomitfromtockeyword
6464- \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6465- \def\toctype{omit}%
6466- \else\ifx\temptype\Yappendixkeyword
6467- \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6468- \def\toctype{app}%
6469- \else
6470- \setbox0 = \hbox{#3\enspace}%
6471- \def\toctype{numchap}%
6472- \fi\fi\fi
6473- %
6474- % Write the toc entry for this chapter. Must come before the
6475- % \donoderef, because we include the current node name in the toc
6476- % entry, and \donoderef resets it to empty.
6477- \writetocentry{\toctype}{#1}{#3}%
6478- %
6479- % For pdftex, we have to write out the node definition (aka, make
6480- % the pdfdest) after any page break, but before the actual text has
6481- % been typeset. If the destination for the pdf outline is after the
6482- % text, then jumping from the outline may wind up with the text not
6483- % being visible, for instance under high magnification.
6484- \donoderef{#2}%
6485- %
6486- % Typeset the actual heading.
6487- \nobreak % Avoid page breaks at the interline glue.
6488- \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6489- \unhbox0 #1\par}%
6490- }%
6491- \nobreak\bigskip % no page break after a chapter title
6492- \nobreak
6493-}
6494-
6495-% @centerchap -- centered and unnumbered.
6496-\let\centerparametersmaybe = \relax
6497-\def\centerparameters{%
6498- \advance\rightskip by 3\rightskip
6499- \leftskip = \rightskip
6500- \parfillskip = 0pt
6501-}
6502-
6503-
6504-% Section titles. These macros combine the section number parts and
6505-% call the generic \sectionheading to do the printing.
6506-%
6507-\newskip\secheadingskip
6508-\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6509-
6510-% Subsection titles.
6511-\newskip\subsecheadingskip
6512-\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6513-
6514-% Subsubsection titles.
6515-\def\subsubsecheadingskip{\subsecheadingskip}
6516-\def\subsubsecheadingbreak{\subsecheadingbreak}
6517-
6518-
6519-% Print any size, any type, section title.
6520-%
6521-% #1 is the text of the title,
6522-% #2 is the section level (sec/subsec/subsubsec),
6523-% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6524-% #4 is the section number.
6525-%
6526-\def\seckeyword{sec}
6527-%
6528-\def\sectionheading#1#2#3#4{%
6529- {%
6530- \def\sectionlevel{#2}%
6531- \def\temptype{#3}%
6532- %
6533- % It is ok for the @heading series commands to appear inside an
6534- % environment (it's been historically allowed, though the logic is
6535- % dubious), but not the others.
6536- \ifx\temptype\Yomitfromtockeyword\else
6537- \checkenv{}% non-@*heading should not be in an environment.
6538- \fi
6539- \let\footnote=\errfootnoteheading
6540- %
6541- % Switch to the right set of fonts.
6542- \csname #2fonts\endcsname \rm
6543- %
6544- % Insert first mark before the heading break (see notes for \domark).
6545- \let\prevsectiondefs=\currentsectiondefs
6546- \ifx\temptype\Ynothingkeyword
6547- \ifx\sectionlevel\seckeyword
6548- \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6549- \gdef\thissection{\thissectionname}}%
6550- \fi
6551- \else\ifx\temptype\Yomitfromtockeyword
6552- % Don't redefine \thissection.
6553- \else\ifx\temptype\Yappendixkeyword
6554- \ifx\sectionlevel\seckeyword
6555- \toks0={#1}%
6556- \xdef\currentsectiondefs{%
6557- \gdef\noexpand\thissectionname{\the\toks0}%
6558- \gdef\noexpand\thissectionnum{#4}%
6559- % \noexpand\putwordSection avoids expanding indigestible
6560- % commands in some of the translations.
6561- \gdef\noexpand\thissection{\noexpand\putwordSection{}
6562- \noexpand\thissectionnum:
6563- \noexpand\thissectionname}%
6564- }%
6565- \fi
6566- \else
6567- \ifx\sectionlevel\seckeyword
6568- \toks0={#1}%
6569- \xdef\currentsectiondefs{%
6570- \gdef\noexpand\thissectionname{\the\toks0}%
6571- \gdef\noexpand\thissectionnum{#4}%
6572- % \noexpand\putwordSection avoids expanding indigestible
6573- % commands in some of the translations.
6574- \gdef\noexpand\thissection{\noexpand\putwordSection{}
6575- \noexpand\thissectionnum:
6576- \noexpand\thissectionname}%
6577- }%
6578- \fi
6579- \fi\fi\fi
6580- %
6581- % Go into vertical mode. Usually we'll already be there, but we
6582- % don't want the following whatsit to end up in a preceding paragraph
6583- % if the document didn't happen to have a blank line.
6584- \par
6585- %
6586- % Output the mark. Pass it through \safewhatsit, to take care of
6587- % the preceding space.
6588- \safewhatsit\domark
6589- %
6590- % Insert space above the heading.
6591- \csname #2headingbreak\endcsname
6592- %
6593- % Now the second mark, after the heading break. No break points
6594- % between here and the heading.
6595- \global\let\prevsectiondefs=\currentsectiondefs
6596- \domark
6597- %
6598- % Only insert the space after the number if we have a section number.
6599- \ifx\temptype\Ynothingkeyword
6600- \setbox0 = \hbox{}%
6601- \def\toctype{unn}%
6602- \gdef\currentsection{#1}%
6603- \else\ifx\temptype\Yomitfromtockeyword
6604- % for @headings -- no section number, don't include in toc,
6605- % and don't redefine \currentsection.
6606- \setbox0 = \hbox{}%
6607- \def\toctype{omit}%
6608- \let\sectionlevel=\empty
6609- \else\ifx\temptype\Yappendixkeyword
6610- \setbox0 = \hbox{#4\enspace}%
6611- \def\toctype{app}%
6612- \gdef\currentsection{#1}%
6613- \else
6614- \setbox0 = \hbox{#4\enspace}%
6615- \def\toctype{num}%
6616- \gdef\currentsection{#1}%
6617- \fi\fi\fi
6618- %
6619- % Write the toc entry (before \donoderef). See comments in \chapmacro.
6620- \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6621- %
6622- % Write the node reference (= pdf destination for pdftex).
6623- % Again, see comments in \chapmacro.
6624- \donoderef{#3}%
6625- %
6626- % Interline glue will be inserted when the vbox is completed.
6627- % That glue will be a valid breakpoint for the page, since it'll be
6628- % preceded by a whatsit (usually from the \donoderef, or from the
6629- % \writetocentry if there was no node). We don't want to allow that
6630- % break, since then the whatsits could end up on page n while the
6631- % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6632- \nobreak
6633- %
6634- % Output the actual section heading.
6635- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6636- \hangindent=\wd0 % zero if no section number
6637- \unhbox0 #1}%
6638- }%
6639- % Add extra space after the heading -- half of whatever came above it.
6640- % Don't allow stretch, though.
6641- \kern .5 \csname #2headingskip\endcsname
6642- %
6643- % Do not let the kern be a potential breakpoint, as it would be if it
6644- % was followed by glue.
6645- \nobreak
6646- %
6647- % We'll almost certainly start a paragraph next, so don't let that
6648- % glue accumulate. (Not a breakpoint because it's preceded by a
6649- % discardable item.) However, when a paragraph is not started next
6650- % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6651- % or the negative glue will cause weirdly wrong output, typically
6652- % obscuring the section heading with something else.
6653- \vskip-\parskip
6654- %
6655- % This is so the last item on the main vertical list is a known
6656- % \penalty > 10000, so \startdefun, etc., can recognize the situation
6657- % and do the needful.
6658- \penalty 10001
6659-}
6660-
6661-
6662-\message{toc,}
6663-% Table of contents.
6664-\newwrite\tocfile
6665-
6666-% Write an entry to the toc file, opening it if necessary.
6667-% Called from @chapter, etc.
6668-%
6669-% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6670-% We append the current node name (if any) and page number as additional
6671-% arguments for the \{chap,sec,...}entry macros which will eventually
6672-% read this. The node name is used in the pdf outlines as the
6673-% destination to jump to.
6674-%
6675-% We open the .toc file for writing here instead of at @setfilename (or
6676-% any other fixed time) so that @contents can be anywhere in the document.
6677-% But if #1 is `omit', then we don't do anything. This is used for the
6678-% table of contents chapter openings themselves.
6679-%
6680-\newif\iftocfileopened
6681-\def\omitkeyword{omit}%
6682-%
6683-\def\writetocentry#1#2#3{%
6684- \edef\writetoctype{#1}%
6685- \ifx\writetoctype\omitkeyword \else
6686- \iftocfileopened\else
6687- \immediate\openout\tocfile = \jobname.toc
6688- \global\tocfileopenedtrue
6689- \fi
6690- %
6691- \iflinks
6692- {\atdummies
6693- \edef\temp{%
6694- \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6695- \temp
6696- }%
6697- \fi
6698- \fi
6699- %
6700- % Tell \shipout to create a pdf destination on each page, if we're
6701- % writing pdf. These are used in the table of contents. We can't
6702- % just write one on every page because the title pages are numbered
6703- % 1 and 2 (the page numbers aren't printed), and so are the first
6704- % two pages of the document. Thus, we'd have two destinations named
6705- % `1', and two named `2'.
6706- \ifpdforxetex
6707- \global\pdfmakepagedesttrue
6708- \fi
6709-}
6710-
6711-
6712-% These characters do not print properly in the Computer Modern roman
6713-% fonts, so we must take special care. This is more or less redundant
6714-% with the Texinfo input format setup at the end of this file.
6715-%
6716-\def\activecatcodes{%
6717- \catcode`\"=\active
6718- \catcode`\$=\active
6719- \catcode`\<=\active
6720- \catcode`\>=\active
6721- \catcode`\\=\active
6722- \catcode`\^=\active
6723- \catcode`\_=\active
6724- \catcode`\|=\active
6725- \catcode`\~=\active
6726-}
6727-
6728-
6729-% Read the toc file, which is essentially Texinfo input.
6730-\def\readtocfile{%
6731- \setupdatafile
6732- \activecatcodes
6733- \input \tocreadfilename
6734-}
6735-
6736-\newskip\contentsrightmargin \contentsrightmargin=1in
6737-\newcount\savepageno
6738-\newcount\lastnegativepageno \lastnegativepageno = -1
6739-
6740-% Prepare to read what we've written to \tocfile.
6741-%
6742-\def\startcontents#1{%
6743- % If @setchapternewpage on, and @headings double, the contents should
6744- % start on an odd page, unlike chapters.
6745- \contentsalignmacro
6746- \immediate\closeout\tocfile
6747- %
6748- % Don't need to put `Contents' or `Short Contents' in the headline.
6749- % It is abundantly clear what they are.
6750- \chapmacro{#1}{Yomitfromtoc}{}%
6751- %
6752- \savepageno = \pageno
6753- \begingroup % Set up to handle contents files properly.
6754- \raggedbottom % Worry more about breakpoints than the bottom.
6755- \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6756- %
6757- % Roman numerals for page numbers.
6758- \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6759- \def\thistitle{}% no title in double-sided headings
6760- % Record where the Roman numerals started.
6761- \ifnum\romancount=0 \global\romancount=\pagecount \fi
6762-}
6763-
6764-% redefined for the two-volume lispref. We always output on
6765-% \jobname.toc even if this is redefined.
6766-%
6767-\def\tocreadfilename{\jobname.toc}
6768-
6769-% Normal (long) toc.
6770-%
6771-\def\contents{%
6772- \startcontents{\putwordTOC}%
6773- \openin 1 \tocreadfilename\space
6774- \ifeof 1 \else
6775- \readtocfile
6776- \fi
6777- \vfill \eject
6778- \contentsalignmacro % in case @setchapternewpage odd is in effect
6779- \ifeof 1 \else
6780- \pdfmakeoutlines
6781- \fi
6782- \closein 1
6783- \endgroup
6784- \contentsendroman
6785-}
6786-
6787-% And just the chapters.
6788-\def\summarycontents{%
6789- \startcontents{\putwordShortTOC}%
6790- %
6791- \let\partentry = \shortpartentry
6792- \let\numchapentry = \shortchapentry
6793- \let\appentry = \shortchapentry
6794- \let\unnchapentry = \shortunnchapentry
6795- % We want a true roman here for the page numbers.
6796- \secfonts
6797- \let\rm=\shortcontrm \let\bf=\shortcontbf
6798- \let\sl=\shortcontsl \let\tt=\shortconttt
6799- \rm
6800- \hyphenpenalty = 10000
6801- \advance\baselineskip by 1pt % Open it up a little.
6802- \def\numsecentry##1##2##3##4{}
6803- \let\appsecentry = \numsecentry
6804- \let\unnsecentry = \numsecentry
6805- \let\numsubsecentry = \numsecentry
6806- \let\appsubsecentry = \numsecentry
6807- \let\unnsubsecentry = \numsecentry
6808- \let\numsubsubsecentry = \numsecentry
6809- \let\appsubsubsecentry = \numsecentry
6810- \let\unnsubsubsecentry = \numsecentry
6811- \openin 1 \tocreadfilename\space
6812- \ifeof 1 \else
6813- \readtocfile
6814- \fi
6815- \closein 1
6816- \vfill \eject
6817- \contentsalignmacro % in case @setchapternewpage odd is in effect
6818- \endgroup
6819- \contentsendroman
6820-}
6821-\let\shortcontents = \summarycontents
6822-
6823-% Get ready to use Arabic numerals again
6824-\def\contentsendroman{%
6825- \lastnegativepageno = \pageno
6826- \global\pageno = \savepageno
6827- %
6828- % If \romancount > \arabiccount, the contents are at the end of the
6829- % document. Otherwise, advance where the Arabic numerals start for
6830- % the page numbers.
6831- \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6832-}
6833-
6834-% Typeset the label for a chapter or appendix for the short contents.
6835-% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6836-%
6837-\def\shortchaplabel#1{%
6838- % This space should be enough, since a single number is .5em, and the
6839- % widest letter (M) is 1em, at least in the Computer Modern fonts.
6840- % But use \hss just in case.
6841- % (This space doesn't include the extra space that gets added after
6842- % the label; that gets put in by \shortchapentry above.)
6843- %
6844- % We'd like to right-justify chapter numbers, but that looks strange
6845- % with appendix letters. And right-justifying numbers and
6846- % left-justifying letters looks strange when there is less than 10
6847- % chapters. Have to read the whole toc once to know how many chapters
6848- % there are before deciding ...
6849- \hbox to 1em{#1\hss}%
6850-}
6851-
6852-% These macros generate individual entries in the table of contents.
6853-% The first argument is the chapter or section name.
6854-% The last argument is the page number.
6855-% The arguments in between are the chapter number, section number, ...
6856-
6857-% Parts, in the main contents. Replace the part number, which doesn't
6858-% exist, with an empty box. Let's hope all the numbers have the same width.
6859-% Also ignore the page number, which is conventionally not printed.
6860-\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6861-\def\partentry#1#2#3#4{%
6862- % Add stretch and a bonus for breaking the page before the part heading.
6863- % This reduces the chance of the page being broken immediately after the
6864- % part heading, before a following chapter heading.
6865- \vskip 0pt plus 5\baselineskip
6866- \penalty-300
6867- \vskip 0pt plus -5\baselineskip
6868- \dochapentry{\numeralbox\labelspace#1}{}%
6869-}
6870-%
6871-% Parts, in the short toc.
6872-\def\shortpartentry#1#2#3#4{%
6873- \penalty-300
6874- \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6875- \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6876-}
6877-
6878-% Chapters, in the main contents.
6879-\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6880-
6881-% Chapters, in the short toc.
6882-% See comments in \dochapentry re vbox and related settings.
6883-\def\shortchapentry#1#2#3#4{%
6884- \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6885-}
6886-
6887-% Appendices, in the main contents.
6888-% Need the word Appendix, and a fixed-size box.
6889-%
6890-\def\appendixbox#1{%
6891- % We use M since it's probably the widest letter.
6892- \setbox0 = \hbox{\putwordAppendix{} M}%
6893- \hbox to \wd0{\putwordAppendix{} #1\hss}}
6894-%
6895-\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6896-
6897-% Unnumbered chapters.
6898-\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6899-\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6900-
6901-% Sections.
6902-\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6903-\let\appsecentry=\numsecentry
6904-\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6905-
6906-% Subsections.
6907-\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6908-\let\appsubsecentry=\numsubsecentry
6909-\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6910-
6911-% And subsubsections.
6912-\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6913-\let\appsubsubsecentry=\numsubsubsecentry
6914-\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6915-
6916-% This parameter controls the indentation of the various levels.
6917-% Same as \defaultparindent.
6918-\newdimen\tocindent \tocindent = 15pt
6919-
6920-% Now for the actual typesetting. In all these, #1 is the text and #2 is the
6921-% page number.
6922-%
6923-% If the toc has to be broken over pages, we want it to be at chapters
6924-% if at all possible; hence the \penalty.
6925-\def\dochapentry#1#2{%
6926- \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6927- \begingroup
6928- % Move the page numbers slightly to the right
6929- \advance\entryrightmargin by -0.05em
6930- \chapentryfonts
6931- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6932- \endgroup
6933- \nobreak\vskip .25\baselineskip plus.1\baselineskip
6934-}
6935-
6936-\def\dosecentry#1#2{\begingroup
6937- \secentryfonts \leftskip=\tocindent
6938- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6939-\endgroup}
6940-
6941-\def\dosubsecentry#1#2{\begingroup
6942- \subsecentryfonts \leftskip=2\tocindent
6943- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6944-\endgroup}
6945-
6946-\def\dosubsubsecentry#1#2{\begingroup
6947- \subsubsecentryfonts \leftskip=3\tocindent
6948- \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6949-\endgroup}
6950-
6951-% We use the same \entry macro as for the index entries.
6952-\let\tocentry = \entry
6953-
6954-% Space between chapter (or whatever) number and the title.
6955-\def\labelspace{\hskip1em \relax}
6956-
6957-\def\dopageno#1{{\rm #1}}
6958-\def\doshortpageno#1{{\rm #1}}
6959-
6960-\def\chapentryfonts{\secfonts \rm}
6961-\def\secentryfonts{\textfonts}
6962-\def\subsecentryfonts{\textfonts}
6963-\def\subsubsecentryfonts{\textfonts}
6964-
6965-
6966-\message{environments,}
6967-% @foo ... @end foo.
6968-
6969-% @tex ... @end tex escapes into raw TeX temporarily.
6970-% One exception: @ is still an escape character, so that @end tex works.
6971-% But \@ or @@ will get a plain @ character.
6972-
6973-\envdef\tex{%
6974- \setregularquotes
6975- \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6976- \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6977- \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6978- \catcode `\%=14
6979- \catcode `\+=\other
6980- \catcode `\"=\other
6981- \catcode `\|=\other
6982- \catcode `\<=\other
6983- \catcode `\>=\other
6984- \catcode `\`=\other
6985- \catcode `\'=\other
6986- %
6987- % ' is active in math mode (mathcode"8000). So reset it, and all our
6988- % other math active characters (just in case), to plain's definitions.
6989- \mathactive
6990- %
6991- % Inverse of the list at the beginning of the file.
6992- \let\b=\ptexb
6993- \let\bullet=\ptexbullet
6994- \let\c=\ptexc
6995- \let\,=\ptexcomma
6996- \let\.=\ptexdot
6997- \let\dots=\ptexdots
6998- \let\equiv=\ptexequiv
6999- \let\!=\ptexexclam
7000- \let\i=\ptexi
7001- \let\indent=\ptexindent
7002- \let\noindent=\ptexnoindent
7003- \let\{=\ptexlbrace
7004- \let\+=\tabalign
7005- \let\}=\ptexrbrace
7006- \let\/=\ptexslash
7007- \let\sp=\ptexsp
7008- \let\*=\ptexstar
7009- %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7010- \let\t=\ptext
7011- \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7012- \let\frenchspacing=\plainfrenchspacing
7013- %
7014- \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7015- \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7016- \def\@{@}%
7017-}
7018-% There is no need to define \Etex.
7019-
7020-% Define @lisp ... @end lisp.
7021-% @lisp environment forms a group so it can rebind things,
7022-% including the definition of @end lisp (which normally is erroneous).
7023-
7024-% Amount to narrow the margins by for @lisp.
7025-\newskip\lispnarrowing \lispnarrowing=0.4in
7026-
7027-% This is the definition that ^^M gets inside @lisp, @example, and other
7028-% such environments. \null is better than a space, since it doesn't
7029-% have any width.
7030-\def\lisppar{\null\endgraf}
7031-
7032-% This space is always present above and below environments.
7033-\newskip\envskipamount \envskipamount = 0pt
7034-
7035-% Make spacing and below environment symmetrical. We use \parskip here
7036-% to help in doing that, since in @example-like environments \parskip
7037-% is reset to zero; thus the \afterenvbreak inserts no space -- but the
7038-% start of the next paragraph will insert \parskip.
7039-%
7040-\def\aboveenvbreak{{%
7041- % =10000 instead of <10000 because of a special case in \itemzzz and
7042- % \sectionheading, q.v.
7043- \ifnum \lastpenalty=10000 \else
7044- \advance\envskipamount by \parskip
7045- \endgraf
7046- \ifdim\lastskip<\envskipamount
7047- \removelastskip
7048- \ifnum\lastpenalty<10000
7049- % Penalize breaking before the environment, because preceding text
7050- % often leads into it.
7051- \penalty100
7052- \fi
7053- \vskip\envskipamount
7054- \fi
7055- \fi
7056-}}
7057-
7058-\def\afterenvbreak{{%
7059- % =10000 instead of <10000 because of a special case in \itemzzz and
7060- % \sectionheading, q.v.
7061- \ifnum \lastpenalty=10000 \else
7062- \advance\envskipamount by \parskip
7063- \endgraf
7064- \ifdim\lastskip<\envskipamount
7065- \removelastskip
7066- % it's not a good place to break if the last penalty was \nobreak
7067- % or better ...
7068- \ifnum\lastpenalty<10000 \penalty-50 \fi
7069- \vskip\envskipamount
7070- \fi
7071- \fi
7072-}}
7073-
7074-% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7075-% also clear it, so that its embedded environments do the narrowing again.
7076-\let\nonarrowing=\relax
7077-
7078-% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7079-% environment contents.
7080-
7081-%
7082-\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7083-\def\ctr{{\hskip 6pt\circle\char'010}}
7084-\def\cbl{{\circle\char'012\hskip -6pt}}
7085-\def\cbr{{\hskip 6pt\circle\char'011}}
7086-\def\carttop{\hbox to \cartouter{\hskip\lskip
7087- \ctl\leaders\hrule height\circthick\hfil\ctr
7088- \hskip\rskip}}
7089-\def\cartbot{\hbox to \cartouter{\hskip\lskip
7090- \cbl\leaders\hrule height\circthick\hfil\cbr
7091- \hskip\rskip}}
7092-%
7093-\newskip\lskip\newskip\rskip
7094-
7095-% only require the font if @cartouche is actually used
7096-\def\cartouchefontdefs{%
7097- \font\circle=lcircle10\relax
7098- \circthick=\fontdimen8\circle
7099-}
7100-\newdimen\circthick
7101-\newdimen\cartouter\newdimen\cartinner
7102-\newskip\normbskip\newskip\normpskip\newskip\normlskip
7103-
7104-
7105-\envdef\cartouche{%
7106- \cartouchefontdefs
7107- \ifhmode\par\fi % can't be in the midst of a paragraph.
7108- \startsavinginserts
7109- \lskip=\leftskip \rskip=\rightskip
7110- \leftskip=0pt\rightskip=0pt % we want these *outside*.
7111- \cartinner=\hsize \advance\cartinner by-\lskip
7112- \advance\cartinner by-\rskip
7113- \cartouter=\hsize
7114- \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7115- % side, and for 6pt waste from
7116- % each corner char, and rule thickness
7117- \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7118- %
7119- % If this cartouche directly follows a sectioning command, we need the
7120- % \parskip glue (backspaced over by default) or the cartouche can
7121- % collide with the section heading.
7122- \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7123- %
7124- \setbox\groupbox=\vbox\bgroup
7125- \baselineskip=0pt\parskip=0pt\lineskip=0pt
7126- \carttop
7127- \hbox\bgroup
7128- \hskip\lskip
7129- \vrule\kern3pt
7130- \vbox\bgroup
7131- \kern3pt
7132- \hsize=\cartinner
7133- \baselineskip=\normbskip
7134- \lineskip=\normlskip
7135- \parskip=\normpskip
7136- \vskip -\parskip
7137- \comment % For explanation, see the end of def\group.
7138-}
7139-\def\Ecartouche{%
7140- \ifhmode\par\fi
7141- \kern3pt
7142- \egroup
7143- \kern3pt\vrule
7144- \hskip\rskip
7145- \egroup
7146- \cartbot
7147- \egroup
7148- \addgroupbox
7149- \checkinserts
7150-}
7151-
7152-
7153-% This macro is called at the beginning of all the @example variants,
7154-% inside a group.
7155-\newdimen\nonfillparindent
7156-\def\nonfillstart{%
7157- \aboveenvbreak
7158- \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7159- \sepspaces % Make spaces be word-separators rather than space tokens.
7160- \let\par = \lisppar % don't ignore blank lines
7161- \obeylines % each line of input is a line of output
7162- \parskip = 0pt
7163- % Turn off paragraph indentation but redefine \indent to emulate
7164- % the normal \indent.
7165- \nonfillparindent=\parindent
7166- \parindent = 0pt
7167- \let\indent\nonfillindent
7168- %
7169- \emergencystretch = 0pt % don't try to avoid overfull boxes
7170- \ifx\nonarrowing\relax
7171- \advance \leftskip by \lispnarrowing
7172- \exdentamount=\lispnarrowing
7173- \else
7174- \let\nonarrowing = \relax
7175- \fi
7176- \let\exdent=\nofillexdent
7177-}
7178-
7179-\begingroup
7180-\obeyspaces
7181-% We want to swallow spaces (but not other tokens) after the fake
7182-% @indent in our nonfill-environments, where spaces are normally
7183-% active and set to @tie, resulting in them not being ignored after
7184-% @indent.
7185-\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7186-\gdef\nonfillindentcheck{%
7187-\ifx\temp %
7188-\expandafter\nonfillindentgobble%
7189-\else%
7190-\leavevmode\nonfillindentbox%
7191-\fi%
7192-}%
7193-\endgroup
7194-\def\nonfillindentgobble#1{\nonfillindent}
7195-\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7196-
7197-% If you want all examples etc. small: @set dispenvsize small.
7198-% If you want even small examples the full size: @set dispenvsize nosmall.
7199-% This affects the following displayed environments:
7200-% @example, @display, @format, @lisp, @verbatim
7201-%
7202-\def\smallword{small}
7203-\def\nosmallword{nosmall}
7204-\let\SETdispenvsize\relax
7205-\def\setnormaldispenv{%
7206- \ifx\SETdispenvsize\smallword
7207- % end paragraph for sake of leading, in case document has no blank
7208- % line. This is redundant with what happens in \aboveenvbreak, but
7209- % we need to do it before changing the fonts, and it's inconvenient
7210- % to change the fonts afterward.
7211- \ifnum \lastpenalty=10000 \else \endgraf \fi
7212- \smallexamplefonts \rm
7213- \fi
7214-}
7215-\def\setsmalldispenv{%
7216- \ifx\SETdispenvsize\nosmallword
7217- \else
7218- \ifnum \lastpenalty=10000 \else \endgraf \fi
7219- \smallexamplefonts \rm
7220- \fi
7221-}
7222-
7223-% We often define two environments, @foo and @smallfoo.
7224-% Let's do it in one command. #1 is the env name, #2 the definition.
7225-\def\makedispenvdef#1#2{%
7226- \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7227- \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7228- \expandafter\let\csname E#1\endcsname \afterenvbreak
7229- \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7230-}
7231-
7232-% Define two environment synonyms (#1 and #2) for an environment.
7233-\def\maketwodispenvdef#1#2#3{%
7234- \makedispenvdef{#1}{#3}%
7235- \makedispenvdef{#2}{#3}%
7236-}
7237-%
7238-% @lisp: indented, narrowed, typewriter font;
7239-% @example: same as @lisp.
7240-%
7241-% @smallexample and @smalllisp: use smaller fonts.
7242-% Originally contributed by Pavel@xerox.
7243-%
7244-\maketwodispenvdef{lisp}{example}{%
7245- \nonfillstart
7246- \tt\setcodequotes
7247- \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7248- \parsearg\gobble
7249-}
7250-% @display/@smalldisplay: same as @lisp except keep current font.
7251-%
7252-\makedispenvdef{display}{%
7253- \nonfillstart
7254- \gobble
7255-}
7256-
7257-% @format/@smallformat: same as @display except don't narrow margins.
7258-%
7259-\makedispenvdef{format}{%
7260- \let\nonarrowing = t%
7261- \nonfillstart
7262- \gobble
7263-}
7264-
7265-% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7266-\envdef\flushleft{%
7267- \let\nonarrowing = t%
7268- \nonfillstart
7269- \gobble
7270-}
7271-\let\Eflushleft = \afterenvbreak
7272-
7273-% @flushright.
7274-%
7275-\envdef\flushright{%
7276- \let\nonarrowing = t%
7277- \nonfillstart
7278- \advance\leftskip by 0pt plus 1fill\relax
7279- \gobble
7280-}
7281-\let\Eflushright = \afterenvbreak
7282-
7283-
7284-% @raggedright does more-or-less normal line breaking but no right
7285-% justification. From plain.tex.
7286-\envdef\raggedright{%
7287- \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7288-}
7289-\let\Eraggedright\par
7290-
7291-\envdef\raggedleft{%
7292- \parindent=0pt \leftskip0pt plus2em
7293- \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7294- \hbadness=10000 % Last line will usually be underfull, so turn off
7295- % badness reporting.
7296-}
7297-\let\Eraggedleft\par
7298-
7299-\envdef\raggedcenter{%
7300- \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7301- \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7302- \hbadness=10000 % Last line will usually be underfull, so turn off
7303- % badness reporting.
7304-}
7305-\let\Eraggedcenter\par
7306-
7307-
7308-% @quotation does normal linebreaking (hence we can't use \nonfillstart)
7309-% and narrows the margins. We keep \parskip nonzero in general, since
7310-% we're doing normal filling. So, when using \aboveenvbreak and
7311-% \afterenvbreak, temporarily make \parskip 0.
7312-%
7313-\makedispenvdef{quotation}{\quotationstart}
7314-%
7315-\def\quotationstart{%
7316- \indentedblockstart % same as \indentedblock, but increase right margin too.
7317- \ifx\nonarrowing\relax
7318- \advance\rightskip by \lispnarrowing
7319- \fi
7320- \parsearg\quotationlabel
7321-}
7322-
7323-% We have retained a nonzero parskip for the environment, since we're
7324-% doing normal filling.
7325-%
7326-\def\Equotation{%
7327- \par
7328- \ifx\quotationauthor\thisisundefined\else
7329- % indent a bit.
7330- \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7331- \fi
7332- {\parskip=0pt \afterenvbreak}%
7333-}
7334-\def\Esmallquotation{\Equotation}
7335-
7336-% If we're given an argument, typeset it in bold with a colon after.
7337-\def\quotationlabel#1{%
7338- \def\temp{#1}%
7339- \ifx\temp\empty \else
7340- {\bf #1: }%
7341- \fi
7342-}
7343-
7344-% @indentedblock is like @quotation, but indents only on the left and
7345-% has no optional argument.
7346-%
7347-\makedispenvdef{indentedblock}{\indentedblockstart}
7348-%
7349-\def\indentedblockstart{%
7350- {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7351- \parindent=0pt
7352- %
7353- % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7354- \ifx\nonarrowing\relax
7355- \advance\leftskip by \lispnarrowing
7356- \exdentamount = \lispnarrowing
7357- \else
7358- \let\nonarrowing = \relax
7359- \fi
7360-}
7361-
7362-% Keep a nonzero parskip for the environment, since we're doing normal filling.
7363-%
7364-\def\Eindentedblock{%
7365- \par
7366- {\parskip=0pt \afterenvbreak}%
7367-}
7368-\def\Esmallindentedblock{\Eindentedblock}
7369-
7370-
7371-% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7372-% If we want to allow any <char> as delimiter,
7373-% we need the curly braces so that makeinfo sees the @verb command, eg:
7374-% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7375-%
7376-% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7377-%
7378-% [Knuth] p.344; only we need to do the other characters Texinfo sets
7379-% active too. Otherwise, they get lost as the first character on a
7380-% verbatim line.
7381-\def\dospecials{%
7382- \do\ \do\\\do\{\do\}\do\$\do\&%
7383- \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7384- \do\<\do\>\do\|\do\@\do+\do\"%
7385- % Don't do the quotes -- if we do, @set txicodequoteundirected and
7386- % @set txicodequotebacktick will not have effect on @verb and
7387- % @verbatim, and ?` and !` ligatures won't get disabled.
7388- %\do\`\do\'%
7389-}
7390-%
7391-% [Knuth] p. 380
7392-\def\uncatcodespecials{%
7393- \def\do##1{\catcode`##1=\other}\dospecials}
7394-%
7395-% Setup for the @verb command.
7396-%
7397-% Eight spaces for a tab
7398-\begingroup
7399- \catcode`\^^I=\active
7400- \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7401-\endgroup
7402-%
7403-\def\setupverb{%
7404- \tt % easiest (and conventionally used) font for verbatim
7405- \def\par{\leavevmode\endgraf}%
7406- \setcodequotes
7407- \tabeightspaces
7408- % Respect line breaks,
7409- % print special symbols as themselves, and
7410- % make each space count
7411- % must do in this order:
7412- \obeylines \uncatcodespecials \sepspaces
7413-}
7414-
7415-% Setup for the @verbatim environment
7416-%
7417-% Real tab expansion.
7418-\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7419-%
7420-% We typeset each line of the verbatim in an \hbox, so we can handle
7421-% tabs.
7422-\newbox\verbbox
7423-\def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7424-%
7425-\begingroup
7426- \catcode`\^^I=\active
7427- \gdef\tabexpand{%
7428- \catcode`\^^I=\active
7429- \def^^I{\leavevmode\egroup
7430- \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7431- \divide\dimen\verbbox by\tabw
7432- \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7433- \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7434- \wd\verbbox=\dimen\verbbox
7435- \leavevmode\box\verbbox \starttabbox
7436- }%
7437- }
7438-\endgroup
7439-
7440-% start the verbatim environment.
7441-\def\setupverbatim{%
7442- \let\nonarrowing = t%
7443- \nonfillstart
7444- \tt % easiest (and conventionally used) font for verbatim
7445- \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7446- \tabexpand
7447- \setcodequotes
7448- % Respect line breaks,
7449- % print special symbols as themselves, and
7450- % make each space count.
7451- % Must do in this order:
7452- \obeylines \uncatcodespecials \sepspaces
7453-}
7454-
7455-% Do the @verb magic: verbatim text is quoted by unique
7456-% delimiter characters. Before first delimiter expect a
7457-% right brace, after last delimiter expect closing brace:
7458-%
7459-% \def\doverb'{'<char>#1<char>'}'{#1}
7460-%
7461-% [Knuth] p. 382; only eat outer {}
7462-\begingroup
7463- \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7464- \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7465-\endgroup
7466-%
7467-\def\verb{\begingroup\setupverb\doverb}
7468-%
7469-%
7470-% Do the @verbatim magic: define the macro \doverbatim so that
7471-% the (first) argument ends when '@end verbatim' is reached, ie:
7472-%
7473-% \def\doverbatim#1@end verbatim{#1}
7474-%
7475-% For Texinfo it's a lot easier than for LaTeX,
7476-% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7477-% we need not redefine '\', '{' and '}'.
7478-%
7479-% Inspired by LaTeX's verbatim command set [latex.ltx]
7480-%
7481-\begingroup
7482- \catcode`\ =\active
7483- \obeylines %
7484- % ignore everything up to the first ^^M, that's the newline at the end
7485- % of the @verbatim input line itself. Otherwise we get an extra blank
7486- % line in the output.
7487- \xdef\doverbatim#1^^M#2@end verbatim{%
7488- \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7489- % We really want {...\end verbatim} in the body of the macro, but
7490- % without the active space; thus we have to use \xdef and \gobble.
7491- % The \egroup ends the \verbbox started at the end of the last line in
7492- % the block.
7493-\endgroup
7494-%
7495-\envdef\verbatim{%
7496- \setnormaldispenv\setupverbatim\doverbatim
7497-}
7498-\let\Everbatim = \afterenvbreak
7499-
7500-
7501-% @verbatiminclude FILE - insert text of file in verbatim environment.
7502-%
7503-\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7504-%
7505-\def\doverbatiminclude#1{%
7506- {%
7507- \makevalueexpandable
7508- \setupverbatim
7509- {%
7510- \indexnofonts % Allow `@@' and other weird things in file names.
7511- \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7512- \edef\tmp{\noexpand\input #1 }
7513- \expandafter
7514- }\expandafter\starttabbox\tmp\egroup
7515- \afterenvbreak
7516- }%
7517-}
7518-
7519-% @copying ... @end copying.
7520-% Save the text away for @insertcopying later.
7521-%
7522-% We save the uninterpreted tokens, rather than creating a box.
7523-% Saving the text in a box would be much easier, but then all the
7524-% typesetting commands (@smallbook, font changes, etc.) have to be done
7525-% beforehand -- and a) we want @copying to be done first in the source
7526-% file; b) letting users define the frontmatter in as flexible order as
7527-% possible is desirable.
7528-%
7529-\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7530-\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7531-%
7532-\def\insertcopying{%
7533- \begingroup
7534- \parindent = 0pt % paragraph indentation looks wrong on title page
7535- \scanexp\copyingtext
7536- \endgroup
7537-}
7538-
7539-
7540-\message{defuns,}
7541-% @defun etc.
7542-
7543-\newskip\defbodyindent \defbodyindent=.4in
7544-\newskip\defargsindent \defargsindent=50pt
7545-\newskip\deflastargmargin \deflastargmargin=18pt
7546-\newcount\defunpenalty
7547-
7548-% Start the processing of @deffn:
7549-\def\startdefun{%
7550- \ifnum\lastpenalty<10000
7551- \medbreak
7552- \defunpenalty=10003 % Will keep this @deffn together with the
7553- % following @def command, see below.
7554- \else
7555- % If there are two @def commands in a row, we'll have a \nobreak,
7556- % which is there to keep the function description together with its
7557- % header. But if there's nothing but headers, we need to allow a
7558- % break somewhere. Check specifically for penalty 10002, inserted
7559- % by \printdefunline, instead of 10000, since the sectioning
7560- % commands also insert a nobreak penalty, and we don't want to allow
7561- % a break between a section heading and a defun.
7562- %
7563- % As a further refinement, we avoid "club" headers by signalling
7564- % with penalty of 10003 after the very first @deffn in the
7565- % sequence (see above), and penalty of 10002 after any following
7566- % @def command.
7567- \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7568- %
7569- % Similarly, after a section heading, do not allow a break.
7570- % But do insert the glue.
7571- \medskip % preceded by discardable penalty, so not a breakpoint
7572- \fi
7573- %
7574- \parindent=0in
7575- \advance\leftskip by \defbodyindent
7576- \exdentamount=\defbodyindent
7577-}
7578-
7579-\def\dodefunx#1{%
7580- % First, check whether we are in the right environment:
7581- \checkenv#1%
7582- %
7583- % As above, allow line break if we have multiple x headers in a row.
7584- % It's not a great place, though.
7585- \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7586- %
7587- % And now, it's time to reuse the body of the original defun:
7588- \expandafter\gobbledefun#1%
7589-}
7590-\def\gobbledefun#1\startdefun{}
7591-
7592-% \printdefunline \deffnheader{text}
7593-%
7594-\def\printdefunline#1#2{%
7595- \begingroup
7596- % call \deffnheader:
7597- #1#2 \endheader
7598- % common ending:
7599- \interlinepenalty = 10000
7600- \advance\rightskip by 0pt plus 1fil\relax
7601- \endgraf
7602- \nobreak\vskip -\parskip
7603- \penalty\defunpenalty % signal to \startdefun and \dodefunx
7604- % Some of the @defun-type tags do not enable magic parentheses,
7605- % rendering the following check redundant. But we don't optimize.
7606- \checkparencounts
7607- \endgroup
7608-}
7609-
7610-\def\Edefun{\endgraf\medbreak}
7611-
7612-% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7613-% the only thing remaining is to define \deffnheader.
7614-%
7615-\def\makedefun#1{%
7616- \expandafter\let\csname E#1\endcsname = \Edefun
7617- \edef\temp{\noexpand\domakedefun
7618- \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7619- \temp
7620-}
7621-
7622-% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7623-%
7624-% Define \deffn and \deffnx, without parameters.
7625-% \deffnheader has to be defined explicitly.
7626-%
7627-\def\domakedefun#1#2#3{%
7628- \envdef#1{%
7629- \startdefun
7630- \doingtypefnfalse % distinguish typed functions from all else
7631- \parseargusing\activeparens{\printdefunline#3}%
7632- }%
7633- \def#2{\dodefunx#1}%
7634- \def#3%
7635-}
7636-
7637-\newif\ifdoingtypefn % doing typed function?
7638-\newif\ifrettypeownline % typeset return type on its own line?
7639-
7640-% @deftypefnnewline on|off says whether the return type of typed functions
7641-% are printed on their own line. This affects @deftypefn, @deftypefun,
7642-% @deftypeop, and @deftypemethod.
7643-%
7644-\parseargdef\deftypefnnewline{%
7645- \def\temp{#1}%
7646- \ifx\temp\onword
7647- \expandafter\let\csname SETtxideftypefnnl\endcsname
7648- = \empty
7649- \else\ifx\temp\offword
7650- \expandafter\let\csname SETtxideftypefnnl\endcsname
7651- = \relax
7652- \else
7653- \errhelp = \EMsimple
7654- \errmessage{Unknown @txideftypefnnl value `\temp',
7655- must be on|off}%
7656- \fi\fi
7657-}
7658-
7659-% \dosubind {index}{topic}{subtopic}
7660-%
7661-% If SUBTOPIC is present, precede it with a space, and call \doind.
7662-% (At some time during the 20th century, this made a two-level entry in an
7663-% index such as the operation index. Nobody seemed to notice the change in
7664-% behaviour though.)
7665-\def\dosubind#1#2#3{%
7666- \def\thirdarg{#3}%
7667- \ifx\thirdarg\empty
7668- \doind{#1}{#2}%
7669- \else
7670- \doind{#1}{#2\space#3}%
7671- \fi
7672-}
7673-
7674-% Untyped functions:
7675-
7676-% @deffn category name args
7677-\makedefun{deffn}{\deffngeneral{}}
7678-
7679-% @deffn category class name args
7680-\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7681-
7682-% \defopon {category on}class name args
7683-\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7684-
7685-% \deffngeneral {subind}category name args
7686-%
7687-\def\deffngeneral#1#2 #3 #4\endheader{%
7688- \dosubind{fn}{\code{#3}}{#1}%
7689- \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7690-}
7691-
7692-% Typed functions:
7693-
7694-% @deftypefn category type name args
7695-\makedefun{deftypefn}{\deftypefngeneral{}}
7696-
7697-% @deftypeop category class type name args
7698-\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7699-
7700-% \deftypeopon {category on}class type name args
7701-\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7702-
7703-% \deftypefngeneral {subind}category type name args
7704-%
7705-\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7706- \dosubind{fn}{\code{#4}}{#1}%
7707- \doingtypefntrue
7708- \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7709-}
7710-
7711-% Typed variables:
7712-
7713-% @deftypevr category type var args
7714-\makedefun{deftypevr}{\deftypecvgeneral{}}
7715-
7716-% @deftypecv category class type var args
7717-\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7718-
7719-% \deftypecvof {category of}class type var args
7720-\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7721-
7722-% \deftypecvgeneral {subind}category type var args
7723-%
7724-\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7725- \dosubind{vr}{\code{#4}}{#1}%
7726- \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7727-}
7728-
7729-% Untyped variables:
7730-
7731-% @defvr category var args
7732-\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7733-
7734-% @defcv category class var args
7735-\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7736-
7737-% \defcvof {category of}class var args
7738-\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7739-
7740-% Types:
7741-
7742-% @deftp category name args
7743-\makedefun{deftp}#1 #2 #3\endheader{%
7744- \doind{tp}{\code{#2}}%
7745- \defname{#1}{}{#2}\defunargs{#3\unskip}%
7746-}
7747-
7748-% Remaining @defun-like shortcuts:
7749-\makedefun{defun}{\deffnheader{\putwordDeffunc} }
7750-\makedefun{defmac}{\deffnheader{\putwordDefmac} }
7751-\makedefun{defspec}{\deffnheader{\putwordDefspec} }
7752-\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7753-\makedefun{defvar}{\defvrheader{\putwordDefvar} }
7754-\makedefun{defopt}{\defvrheader{\putwordDefopt} }
7755-\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7756-\makedefun{defmethod}{\defopon\putwordMethodon}
7757-\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7758-\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7759-\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7760-
7761-% \defname, which formats the name of the @def (not the args).
7762-% #1 is the category, such as "Function".
7763-% #2 is the return type, if any.
7764-% #3 is the function name.
7765-%
7766-% We are followed by (but not passed) the arguments, if any.
7767-%
7768-\def\defname#1#2#3{%
7769- \par
7770- % Get the values of \leftskip and \rightskip as they were outside the @def...
7771- \advance\leftskip by -\defbodyindent
7772- %
7773- % Determine if we are typesetting the return type of a typed function
7774- % on a line by itself.
7775- \rettypeownlinefalse
7776- \ifdoingtypefn % doing a typed function specifically?
7777- % then check user option for putting return type on its own line:
7778- \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7779- \rettypeownlinetrue
7780- \fi
7781- \fi
7782- %
7783- % How we'll format the category name. Putting it in brackets helps
7784- % distinguish it from the body text that may end up on the next line
7785- % just below it.
7786- \def\temp{#1}%
7787- \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7788- %
7789- % Figure out line sizes for the paragraph shape. We'll always have at
7790- % least two.
7791- \tempnum = 2
7792- %
7793- % The first line needs space for \box0; but if \rightskip is nonzero,
7794- % we need only space for the part of \box0 which exceeds it:
7795- \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7796- %
7797- % If doing a return type on its own line, we'll have another line.
7798- \ifrettypeownline
7799- \advance\tempnum by 1
7800- \def\maybeshapeline{0in \hsize}%
7801- \else
7802- \def\maybeshapeline{}%
7803- \fi
7804- %
7805- % The continuations:
7806- \dimen2=\hsize \advance\dimen2 by -\defargsindent
7807- %
7808- % The final paragraph shape:
7809- \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7810- %
7811- % Put the category name at the right margin.
7812- \noindent
7813- \hbox to 0pt{%
7814- \hfil\box0 \kern-\hsize
7815- % \hsize has to be shortened this way:
7816- \kern\leftskip
7817- % Intentionally do not respect \rightskip, since we need the space.
7818- }%
7819- %
7820- % Allow all lines to be underfull without complaint:
7821- \tolerance=10000 \hbadness=10000
7822- \exdentamount=\defbodyindent
7823- {%
7824- % defun fonts. We use typewriter by default (used to be bold) because:
7825- % . we're printing identifiers, they should be in tt in principle.
7826- % . in languages with many accents, such as Czech or French, it's
7827- % common to leave accents off identifiers. The result looks ok in
7828- % tt, but exceedingly strange in rm.
7829- % . we don't want -- and --- to be treated as ligatures.
7830- % . this still does not fix the ?` and !` ligatures, but so far no
7831- % one has made identifiers using them :).
7832- \df \tt
7833- \def\temp{#2}% text of the return type
7834- \ifx\temp\empty\else
7835- \tclose{\temp}% typeset the return type
7836- \ifrettypeownline
7837- % put return type on its own line; prohibit line break following:
7838- \hfil\vadjust{\nobreak}\break
7839- \else
7840- \space % type on same line, so just followed by a space
7841- \fi
7842- \fi % no return type
7843- #3% output function name
7844- }%
7845- {\rm\enskip}% hskip 0.5 em of \rmfont
7846- %
7847- \boldbrax
7848- % arguments will be output next, if any.
7849-}
7850-
7851-% Print arguments in slanted roman (not ttsl), inconsistently with using
7852-% tt for the name. This is because literal text is sometimes needed in
7853-% the argument list (groff manual), and ttsl and tt are not very
7854-% distinguishable. Prevent hyphenation at `-' chars.
7855-%
7856-\def\defunargs#1{%
7857- % use sl by default (not ttsl),
7858- % tt for the names.
7859- \df \sl \hyphenchar\font=0
7860- %
7861- % On the other hand, if an argument has two dashes (for instance), we
7862- % want a way to get ttsl. We used to recommend @var for that, so
7863- % leave the code in, but it's strange for @var to lead to typewriter.
7864- % Nowadays we recommend @code, since the difference between a ttsl hyphen
7865- % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7866- \def\var##1{{\setregularquotes\ttslanted{##1}}}%
7867- #1%
7868- \sl\hyphenchar\font=45
7869-}
7870-
7871-% We want ()&[] to print specially on the defun line.
7872-%
7873-\def\activeparens{%
7874- \catcode`\(=\active \catcode`\)=\active
7875- \catcode`\[=\active \catcode`\]=\active
7876- \catcode`\&=\active
7877-}
7878-
7879-% Make control sequences which act like normal parenthesis chars.
7880-\let\lparen = ( \let\rparen = )
7881-
7882-% Be sure that we always have a definition for `(', etc. For example,
7883-% if the fn name has parens in it, \boldbrax will not be in effect yet,
7884-% so TeX would otherwise complain about undefined control sequence.
7885-{
7886- \activeparens
7887- \global\let(=\lparen \global\let)=\rparen
7888- \global\let[=\lbrack \global\let]=\rbrack
7889- \global\let& = \&
7890-
7891- \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7892- \gdef\magicamp{\let&=\amprm}
7893-}
7894-\let\ampchar\&
7895-
7896-\newcount\parencount
7897-
7898-% If we encounter &foo, then turn on ()-hacking afterwards
7899-\newif\ifampseen
7900-\def\amprm#1 {\ampseentrue{\bf\&#1 }}
7901-
7902-\def\parenfont{%
7903- \ifampseen
7904- % At the first level, print parens in roman,
7905- % otherwise use the default font.
7906- \ifnum \parencount=1 \rm \fi
7907- \else
7908- % The \sf parens (in \boldbrax) actually are a little bolder than
7909- % the contained text. This is especially needed for [ and ] .
7910- \sf
7911- \fi
7912-}
7913-\def\infirstlevel#1{%
7914- \ifampseen
7915- \ifnum\parencount=1
7916- #1%
7917- \fi
7918- \fi
7919-}
7920-\def\bfafterword#1 {#1 \bf}
7921-
7922-\def\opnr{%
7923- \global\advance\parencount by 1
7924- {\parenfont(}%
7925- \infirstlevel \bfafterword
7926-}
7927-\def\clnr{%
7928- {\parenfont)}%
7929- \infirstlevel \sl
7930- \global\advance\parencount by -1
7931-}
7932-
7933-\newcount\brackcount
7934-\def\lbrb{%
7935- \global\advance\brackcount by 1
7936- {\bf[}%
7937-}
7938-\def\rbrb{%
7939- {\bf]}%
7940- \global\advance\brackcount by -1
7941-}
7942-
7943-\def\checkparencounts{%
7944- \ifnum\parencount=0 \else \badparencount \fi
7945- \ifnum\brackcount=0 \else \badbrackcount \fi
7946-}
7947-% these should not use \errmessage; the glibc manual, at least, actually
7948-% has such constructs (when documenting function pointers).
7949-\def\badparencount{%
7950- \message{Warning: unbalanced parentheses in @def...}%
7951- \global\parencount=0
7952-}
7953-\def\badbrackcount{%
7954- \message{Warning: unbalanced square brackets in @def...}%
7955- \global\brackcount=0
7956-}
7957-
7958-
7959-\message{macros,}
7960-% @macro.
7961-
7962-% To do this right we need a feature of e-TeX, \scantokens,
7963-% which we arrange to emulate with a temporary file in ordinary TeX.
7964-\ifx\eTeXversion\thisisundefined
7965- \newwrite\macscribble
7966- \def\scantokens#1{%
7967- \toks0={#1}%
7968- \immediate\openout\macscribble=\jobname.tmp
7969- \immediate\write\macscribble{\the\toks0}%
7970- \immediate\closeout\macscribble
7971- \input \jobname.tmp
7972- }
7973-\fi
7974-
7975-\let\E=\expandafter
7976-
7977-% Used at the time of macro expansion.
7978-% Argument is macro body with arguments substituted
7979-\def\scanmacro#1{%
7980- \newlinechar`\^^M
7981- % expand the expansion of \eatleadingcr twice to maybe remove a leading
7982- % newline (and \else and \fi tokens), then call \eatspaces on the result.
7983- \def\xeatspaces##1{%
7984- \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7985- }}%
7986- \def\xempty##1{}%
7987- %
7988- % Process the macro body under the current catcode regime.
7989- \scantokens{#1@comment}%
7990- %
7991- % The \comment is to remove the \newlinechar added by \scantokens, and
7992- % can be noticed by \parsearg. Note \c isn't used because this means cedilla
7993- % in math mode.
7994-}
7995-
7996-% Used for copying and captions
7997-\def\scanexp#1{%
7998- \expandafter\scanmacro\expandafter{#1}%
7999-}
8000-
8001-\newcount\paramno % Count of parameters
8002-\newtoks\macname % Macro name
8003-\newif\ifrecursive % Is it recursive?
8004-
8005-% List of all defined macros in the form
8006-% \commondummyword\macro1\commondummyword\macro2...
8007-% Currently is also contains all @aliases; the list can be split
8008-% if there is a need.
8009-\def\macrolist{}
8010-
8011-% Add the macro to \macrolist
8012-\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8013-\def\addtomacrolistxxx#1{%
8014- \toks0 = \expandafter{\macrolist\commondummyword#1}%
8015- \xdef\macrolist{\the\toks0}%
8016-}
8017-
8018-% Utility routines.
8019-% This does \let #1 = #2, with \csnames; that is,
8020-% \let \csname#1\endcsname = \csname#2\endcsname
8021-% (except of course we have to play expansion games).
8022-%
8023-\def\cslet#1#2{%
8024- \expandafter\let
8025- \csname#1\expandafter\endcsname
8026- \csname#2\endcsname
8027-}
8028-
8029-% Trim leading and trailing spaces off a string.
8030-% Concepts from aro-bend problem 15 (see CTAN).
8031-{\catcode`\@=11
8032-\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8033-\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8034-\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8035-\def\unbrace#1{#1}
8036-\unbrace{\gdef\trim@@@ #1 } #2@{#1}
8037-}
8038-
8039-{\catcode`\^^M=\other%
8040-\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\f