1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%
3%A  gapmacro.tex                GAP manual                       Frank Celler
4%A                                                             Heiko Theissen
5%A                                                           Alexander Hulpke
6%A                                                           Burkhard Höfling
7%%
8%%
9%%  DO NOT RELY ON MACRO DEFINITIONS IN THIS FILE!
10%%  The official definition of the manual style is to be found in the file
11%%  `gapmacrodoc.tex'.
12%%
13%%  The following macros are defined in this file.
14%%
15%%  `text'   set text in typewriter style (use `\<' instead of `<')
16%%  <text>   set text in italics (use $\<$ instead of $<$ for less than)
17%%  *text*   set text in emphasized style (i.e. slanted)
18%%  $a.b$    same as $a \cdot b$ (use $\.$ instead of $.$ for full stop)
19%%  "ref"    refer to a label (like "function!for category")
20%%  \pif     sets a single '
21%%  \cite{.} make a citation
22%%  \index{.} \indextt{.} make index entry (\indextt in typewriter style)
23%%
24%%  \beginitems         produce itemized texts with 3pc hanging indentation
25%%    item & text
26%%
27%%    item & text ...
28%%  \enditems
29%%
30%%  \begintt            verbatim text in typewriter style
31%%    verbatim material
32%%  \endtt
33%%  \beginexample     verbatim text in typewriter style
34%%    verbatim material
35%%  \endexample
36%%
37%%  \Input{file}  includes file `file.tex'
38%%  \Chapter{title} followed by a blank line
39%%  \Section{title} followed by a blank line
40%%      make  chapter  or section   title. Automatically  generates  table of
41%%      contents. \null after \Section{...} inhibits indexing.
42%%  \>function( arguments )!{ index subentry }
43%%  \>`a binop b'{binary operation}!{ index subentry }
44%%      make a  heading for a subsection   explaining a function  or a binary
45%%      operation. This automatically generates   a label and an  index entry
46%%      (with optional subentry).
47%%  \){\fmark ...}
48%%      the same without label and index entry
49%%
50%%  \URL{url}
51%%  \Mailto{}
52%%
53%%  \BeginningOfBook
54%%  \FrontMatter, \Chapters, \Appendices, \EndMatter     parts of the book
55%%  \Bibliography, \Index, \TableOfContents  make these chapters (w/o head)
56%%  \EndOfBook
57%%
58%%  The following macros can be used just after inputting gapmacro.tex to control
59%%  the layout.
60%%    \casesensitivetrue makes labels case sensitive (this is still experimental
61%%     and not currently supported by the html converter)
62%%  \casesensitivefalse & (default) labels are case insensitive
63%%
64%%  \addlinks (default) This inserts pdf links within the document, so
65%%    that you can click on a reference or citation. This will only work
66%%    with pdftex, otherwise this has no effect.
67%%
68%%  \nolinks This switches off additional pdf links within the document.
69%%
70%%  \citebookstrue References to external books will be
71%%     "GAP Reference Manual, 2.7.12" instead of just "2.7.12", similarly
72%%     for the GAP tutorial. If you cite other books, you have to define
73%%     macros \xxxManual which must expand to the text which you want to
74%%     be inserted before the number for package xxx (lower case).
75%%  \citebooksfalse (default) just print the number
76%%
77%%  \usepsfonts (default) use the standard Postscript fonts for typesetting
78%%  \usecmfonts use the TeX standard fonts
79%%
80%%  \biblitemfalse (default) In the bibliography, print abbreviations for
81%%    papers right-aligned (as in gapmacro.tex)
82%%  \biblitemtrue print abbreviations left-aligned
83%%  \bibindent (default: 3 pc) indentation used in the bibliography -
84%%    depending
85%%    on the abbreviations you use, you may need more (this is not very
86%%    obvious if you use \biblitemfalse because long abbreviations will
87%%    protrude into the left margin only, but will cause overfull hboxes
88%%    when using \biblitemtrue
89
90\input amssym.tex
91
92\catcode`@=11
93
94% Page dimensions and double column output.
95\hsize 39pc
96\vsize 52pc
97
98\gdef\nolinks{
99    \gdef\nameddest##1{}%
100    \gdef\startlink##1{}%
101    \gdef\endlink{}%
102}
103
104\gdef\addlinks{
105    \gdef\nameddest##1{%
106      \ifx\debuglabels\undefined\else\immediate\write16{nameddest ##1 defined}\fi
107       \ifvmode \pdfdest name{##1} xyz%
108      \else\vbox to 0pt{\vss\pdfdest name{##1} xyz%
109      \vskip\baselineskip}\fi}%
110    \gdef\startlink##1{\begingroup{%
111      \ifx\debuglabels\undefined\else\immediate\write16{link ##1 inserted}\fi
112      \pdfstartlink attr{/Border [0 0 0]} goto name{##1}}\pdfliteral{\linkcolor}}%
113    \gdef\endlink{\pdfliteral{0 0 0 rg}\pdfendlink\endgroup}%
114}
115
116% do we run pdftex?
117\ifx\pdfdest\undefined
118    \immediate\write16{Running TeX}
119    % no: define dummy bookmarking functions
120    \global\def\setbookmarkind#1#2{}
121    \global\def\setbookmark#1#2{}
122    \global\def\indexbookmark#1#2{}
123    \nolinks
124    \let\addlinks\relax
125\else
126    \def\linkcolor{0 0.1 0.6 rg}
127    \immediate\write16{Running PDFTeX}
128    % yes: define macros to do pdf stuff and set some parameters
129    \global\def\setbookmarkind#1#2{%
130      \setindent{\chapterlen{\the\chapno}}
131      \pdfoutline goto name{#1} count -\indentno {#2}}
132    \global\def\setbookmark#1#2{%
133      \setindent{\chapterlen{\the\chapno}}
134      \pdfoutline goto name{#1} count 0 {#2}}
135    % special treatment for the index to get proper indention
136    \global\def\indexbookmark#1#2{%
137      \pdfoutline goto name{#1} count -27 {#2}}
138    \addlinks
139    \pdfinfo{
140    /Subject (GAP Manual)
141    /Author (The GAP Group)
142    }
143    \pdfcatalog{
144    /URI (https://www.gap-system.org)
145%    /PageMode /UseOutlines}
146    /PageMode /UseNone}
147    \pdfcompresslevel 9
148\fi
149
150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151%
152%  Generic double column output.
153%
154%    Modified from a routine written by Donald Knuth (The TeXBook, App. E)
155%
156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157%
158%  The user may modify the following to his tastes:
159%
160%      \pagewidth     vertical length of page.
161%      \pageheight    horizontal width of page.
162%      \colwidth      column width
163%      \separator     macro to generate column separator. Default is nothing.
164%                     \rulesep sets it to \vrule. \norulesep doesn't.
165%      \makepage      default is what is contained in plain.
166% Create and initialize new dimensions.
167\newdimen\pagewidth  \newdimen\pageheight  \newdimen\colwidth
168\pagewidth=\hsize    \pageheight=\vsize    \colwidth=3.2truein
169
170\def\draft{\hsize 42pc\vsize 63pc\pagewidth=\hsize \pageheight=\vsize}
171
172\def\pif{\char39}
173
174\def\tron{\tracingmacros 1\tracingcommands 1\tracingonline 1}
175
176% This routine is used by \output ; this is different from
177%   the one found in App. E.
178\def\onepageout#1{{\setbox255=\vbox{#1}
179  \hsize=\pagewidth \vsize=\pageheight \plainoutput}}
180\def\normaloutput{\onepageout{\unvbox255}}
181\maxdeadcycles=100 % \output is called quite often
182
183\output={\normaloutput}
184\newbox\partialpage \newdimen\origvsize \newif\ifrigid
185\def\begindoublecolumns{\global\origvsize=\vsize \begingroup
186  \output={\global\setbox\partialpage=\vbox{\unvbox255\kern0pt}}\eject
187  \output={\doublecolumnout} \hsize=\colwidth \dimen@=\pageheight
188  \advance\dimen@ by-\ht\partialpage \multiply\dimen@ by2
189  \ifdim\dimen@<2\baselineskip \dimen@=2\baselineskip\fi
190  \vsize=\dimen@}
191\def\enddoublecolumns{\output={\balancecolumns}\eject
192  \endgroup \global\vsize=\origvsize \pagegoal=\vsize}
193\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
194  \setbox0=\vsplit255 to.46\vsize \setbox2=\vsplit255 to.46\vsize
195  %\setbox0=\vbox{A\unvbox0B\vfill}\setbox2=\vbox{C\unvbox2D\vfill}%
196  \onepageout\pagesofar \global\vsize=2\pageheight
197  \unvbox255 \penalty\outputpenalty}
198\def\pagesofar{\unvbox\partialpage
199  \wd0=\hsize \wd2=\hsize
200  %\hbox to\pagewidth{\box0\hfil\separator\hfil\box2}}
201  \hbox to\pagewidth{\valign{##\vfill\cr%
202  \vbox{\unvbox0}\cr\noalign{\hfil\separator\hfil}\vbox{\unvbox2}\cr}}}
203\def\norulesep{\let\separator=\relax}
204\def\rulesep{\let\separator=\vrule}
205\let\separator=\relax
206\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
207  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
208  \divide\dimen@ by2 \splittopskip=\topskip
209  {\vbadness=10000 \loop \global\setbox3=\copy0
210    \global\setbox1=\vsplit3 to\dimen@
211    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
212  \ifrigid
213    \setbox0=\vtop{\unvbox1}
214    \setbox2=\vtop{\unvbox3}
215  \else
216    \setbox0=\vbox to\dimen@{\unvbox1}
217    \setbox2=\vbox to\dimen@{\dimen2=\dp3 \unvbox3\kern-\dimen2 \vfil}
218  \fi
219  \global\vsize=\origvsize \pagesofar}
220
221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222
223\colwidth 19pc
224\newdimen\manindent      \manindent 3pc
225\newdimen\smallmanindent \smallmanindent 1pc
226\parskip 1ex plus 0.5ex minus 0.5ex
227\parindent 0pt
228
229\outer\def\usepsfonts{%
230    % change standard TeX fonts, from plain.tex
231    \font\tenrm=ptmr7t at 10pt % roman text
232    \font\sevenrm=ptmr7t at 7pt
233    \font\fiverm=ptmr7t at 5pt
234    \font\tenr=zptmcm7t at 10pt % math roman
235    \font\sevenr=zptmcm7t at 7pt
236    \font\fiver=zptmcm7t at 5pt
237    \font\teni=zptmcm7m at 10pt % math italic
238    \font\seveni=zptmcm7m at 7pt
239    \font\fivei=zptmcm7m at 5pt
240    \font\tensy=zptmcm7y at 10pt % math symbols
241    \font\sevensy=zptmcm7y at 7pt
242    \font\fivesy=zptmcm7y at 5pt
243    \font\tenex=zptmcm7v at 10pt % math extension
244    \font\tenbf=ptmb7t at 10pt % boldface extended
245    \font\sevenbf=ptmb7t at 7pt
246    \font\fivebf=ptmb7t at 5pt
247    % additonal fonts needed by gapmacro.tex
248    \font\tentt=cmtt10 % typewriter
249    \font\tensl=ptmro7t at 10pt
250    \font\tenit=ptmri7t at 10pt % text italic
251    % Additional fonts needed by gapmacro.tex
252    \font\inchhigh=phvb7t at 96pt
253    \font\titlefont=phvb7t at 36pt
254    \font\subtitlefont=phvb7t at 20pt
255    \font\secfont=phvb7t at 13pt
256    \font\sf=phvr7t at 10 pt
257    \font\bsf=phvb7t at 10 pt
258    \font\smallrom=ptmr7t at 8pt
259    \font\sevenit=ptmri7t at 7pt
260    \font\fiveit=ptmri7t at 5pt
261    \inst@allfonts
262}
263\outer\def\usecmfonts{
264    % standard TeX fonts, from plain.tex
265    \font\tenrm=cmr10 % roman text
266    \font\sevenrm=cmr7
267    \font\fiverm=cmr5
268    \font\tenr=cmr10 % math roman
269    \font\sevenr=cmr7
270    \font\fiver=cmr5
271    \font\teni=cmmi10 % math italic
272    \font\seveni=cmmi7
273    \font\fivei=cmmi5
274    \font\tensy=cmsy10 % math symbols
275    \font\sevensy=cmsy7
276    \font\fivesy=cmsy5
277    \font\tenex=cmex10 % math extension
278    \font\tenbf=cmbx10 % boldface extended
279    \font\sevenbf=cmbx7
280    \font\fivebf=cmbx5
281    \font\tentt=cmtt10 % typewriter
282    \font\tensl=cmsl10 % slanted roman
283    \font\tenit=cmti10 % text italic
284    % Additional fonts needed by gapmacro.tex
285    \font\inchhigh=cminch
286    \font\titlefont=cmssdc10 at 40pt
287    \font\subtitlefont=cmssdc10 at 24pt
288    \font\secfont=cmssdc10 at 14pt
289    \font\sf=cmss10
290    \font\bsf=cmssdc10
291    \font\smallrom=cmr8
292    \font\sevenit=cmti10 at 7pt
293    \font\fiveit=cmti10 at 5pt
294    \inst@allfonts
295}
296
297\def\inst@allfonts{
298    \skewchar\teni='177 \skewchar\seveni='177 \skewchar\fivei='177
299    \skewchar\tensy='60 \skewchar\sevensy='60 \skewchar\fivesy='60
300
301    \textfont0=\tenr \scriptfont0=\sevenr \scriptscriptfont0=\fiver
302    \textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
303    \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
304    \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
305    \textfont\itfam=\tenit \scriptfont\itfam=\sevenit \scriptscriptfont\itfam=\fiveit
306    \textfont\slfam=\tensl
307    \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
308    \scriptscriptfont\bffam=\fivebf
309    \textfont\ttfam=\tentt
310    \tenrm
311}
312\def\rm{\fam0\tenrm}
313\def\mit{\fam1} \def\oldstyle{\fam\@ne\teni}
314\def\cal{\fam2}
315% fam 3 contains the large symbols, cannot be used for ordinary math
316\newfam\itfam \def\it{\fam\itfam\tenit} % \it is family 4
317\newfam\slfam \def\sl{\fam\slfam\tensl} % \sl is family 5
318\newfam\bffam \def\bf{\fam\bffam\tenbf} % \bf is family 6
319\newfam\ttfam \def\tt{\fam\ttfam\tentt} % \tt is family 7
320
321% If you don't have `msb' fonts, replace the next 4 lines by `\let\Bbb=\bf'.
322\newfam\msbfam \def\Bbb{\fam\msbfam}
323\font\tenmsb=msbm10         \textfont\msbfam=\tenmsb
324\font\sevenmsb=msbm7        \scriptfont\msbfam=\sevenmsb
325\font\fivemsb=msbm5         \scriptscriptfont\msbfam=\fivemsb
326\font\sevenmsa=msam7
327
328% the dark triangle
329\def\darktriangleright{\raise.4ex\hbox{\sevenmsa\char"49}}
330
331% Math mode should use text italic.
332{\count0=\itfam \advance\count0 by-1 \multiply\count0 by"100
333 \count1=`A
334 \loop \count2=\mathcode\count1 \advance\count2 by\count0
335       \global\mathcode\count1=\count2
336      {\advance\count1 by'040
337       \count2=\mathcode\count1 \advance\count2 by\count0
338       \global\mathcode\count1=\count2}
339 \ifnum\count1<`Z \advance\count1 by1\repeat}
340
341\usepsfonts
342
343% macros for verbatim scanning (almost copied from `The TeXbook')
344\chardef\other=12
345\def\undocatcodespecials{\catcode`\\=\other     \catcode`\{=\other
346  \catcode`\}=\other     \catcode`\<=\other     \catcode`\$=\other
347  \catcode`\%=\other     \catcode`\~=\other     \catcode`\^=\other
348  \catcode`\_=\other     \catcode`\*=\other     \catcode`\`=\other
349  \catcode`\!=\other     \catcode`\"=\other     \catcode`\&=\other
350  \catcode`\#=\other     \catcode`\|=\other}
351\newdimen\ttindent \ttindent=5mm % indentation amount of verbatim examples
352\def\kernttindent{\hskip\ttindent\relax} % for use in %\begintt
353{\obeyspaces\global\let =\ }
354{\obeylines\gdef\obeylines{\catcode`^^M=\active}\gdef^^M{\par}%
355\catcode`#=\active \catcode`&=6 \gdef#{\char35}%
356%\catcode`#=\active \catcode`&=6 \gdef#&1^^M{\hbox{\char35 &1}^^M}%
357 \gdef\ttverbatim{\begingroup\undocatcodespecials \catcode`\#=\active%
358   \parindent 0pt \def\_^^M{\allowbreak}\def\${$}\def\`{`}%
359   \def\par{\ifvmode\allowbreak\vskip 1pc plus 1pt\else\endgraf\penalty100\relax\fi}%
360   \obeyspaces \obeylines \tt}}
361\outer\def\begintt{\par
362  \begingroup\advance\leftskip by \ttindent
363  \ttverbatim \parskip=0pt \catcode`\|=0 \rightskip-5pc \ttfinish}
364{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
365  |obeylines % end of line is active
366  |gdef||{|char124} %
367  |gdef|ttfinish^^M#1\endtt{|medskip{#1}|endgroup %
368  |endgroup%
369  |vskip-|parskip|medskip|noindent|ignorespaces}}
370\def\unstableoutput{}
371\outer\def\beginexample{\par
372  \begingroup\advance\leftskip by \ttindent
373  \ttverbatim \parskip=0pt \catcode`\|=0 \rightskip-5pc \catcode`\#=\other\examplefinish}
374{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
375  |obeylines % end of line is active
376  |gdef||{|char124} %
377  |gdef|examplefinish^^M#1^^M\endexample{%
378      |iftestexample%
379         |ifexamplefileopen%
380         |else|immediate|openout|exampleout=|jobname.example-|the|chapno.tst%
381         |global|examplefileopentrue%
382         |fi%
383        {|def^^M{^^J}|immediate|write|exampleout{#1}}%
384      |fi%
385      |global|testexampletrue%
386      |medskip{#1}|endgroup%
387  |vskip-|parskip|medskip|endgroup%
388  |noindent|ignorespaces}}
389
390% Input/output streams. Chapter and section counters.
391\newwrite\labelout \newwrite\indexout \newwrite\secindout
392\newwrite\tocout   \newwrite\citeout  \newwrite\ans
393\newwrite\exampleout
394\newif\ifexamplefileopen
395\newif\iftestexample\global\testexampletrue
396\newread \labelin  \newread \indexin  \newread \tocin  \newread \citein
397\countdef\chapno=1 \newcount\secno    \newcount\subsecno \newcount\exno
398\newcount\indentno
399\newcount\chapnum  %GG \chapnum is a numerical \chapno for the .six file
400\def\chapterno{{\edef\tempa{\thechapter}\tempa}}
401%\def\folio{\ifnum\pageno<0 \romannumeral-\pageno \else
402%  \chapterno\ifx\thechapter\emptychapter\else--\fi \number\pageno\fi}
403%\def\doindex#1#2#3{\write\indexout{\noexpand\indexentry{#1#2#3}%
404%  {\ifnum\pageno<0 \romannumeral-\pageno \else
405%   \thechapter\ifx\thechapter\emptychapter\else--\fi \number\pageno\fi}}%
406%  \ifvmode\nobreak\fi}
407
408%AH
409\def\folio{\ifnum\pageno<0 \romannumeral-\pageno \else
410  \number\pageno\fi}
411
412%\def\doindex#1#2#3{\protectedwrite\indexout{\noexpand\indexentry{#1#2#3}%
413%  {\ifnum\pageno<0\romannumeral-\pageno\else%
414%   \number\pageno\fi}}%
415%  \ifvmode\nobreak\else\unskip\fi}
416
417{\catcode`<=\active \catcode`_=\active \catcode`!=\active \catcode`*=\active
418\catcode``=\active
419
420\global\let\n@exp\noexpand
421
422\gdef\doindex#1#2#3{\begingroup
423  %\let_\underscore\let`\lq\let<\<\let!\excl
424  \def\noexpand{}% this kills noexpands from some index entries
425  \def\protect{\n@exp\n@exp\n@exp}%
426  \def_{\protect_}\def*{\protect*}\def`{\protect `}\def<{\protect <}\def!{\protect!}%
427  \edef\tmp{\n@exp\n@exp\n@exp\indexentry{#1#2#3}}%
428  \expandafter\write\expandafter\indexout\expandafter{\tmp{\folio}}%
429  %{\scrollmode\errorcontextlines 1\show\tmp\errorstopmode}%
430  \ifvmode\nobreak\else\unskip\fi\endgroup}%
431}
432
433% Additional active characters and their default meanings.
434\mathcode`.="2201 \mathchardef\.="702E
435\def\undoquotes{\catcode`'=12 \catcode``=12 \def\"##1{{\accent127 ##1}}}
436\def\excl{!} \chardef\lqq=`\\ \let\underscore=\_
437\chardef\<=`<
438\catcode`!=\active \let!=\excl
439\catcode`^=\active \def^{\ifmmode\sp\else{\char`\^}\fi}
440\catcode`_=\active \def\activeusc{\ifmmode\sb\else\_\fi}
441                   \let_=\activeusc                     \let\_=\underscore
442\catcode`*=\active \def*{\ifmmode\let\next=\*\else\let\next=\bold\fi\next}
443                   \def\bold#1*{{\bf #1\/}}             \chardef\*=`*
444\catcode`<=\active \def<#1>{{\chardef*=`*\let_=\_\it#1\/}}
445
446\catcode`"=\active \def"{\begingroup\undoquotes\doref}  \chardef\"=`"
447                                                        \chardef\\=`\\
448
449\def\refManual{{\GAP} Reference Manual}
450\def\tutManual{{\GAP} Tutorial}
451
452{\catcode`|=0 \catcode`\\=12 |gdef|bs{\}}
453% Labels (which are automatically generated by ``\Section'' and ``\>'').
454%\newif\iflabmultdef
455\newif\iflabundef
456\newif\iflabchanged
457\newif\ifcasesensitive
458\newif\ifcitebooks
459
460\def\doref#1"{\bookref#1:"}
461\def\bookref#1:#2"{\def\tempa{#2}\ifx\tempa\empty\printref{\book:#1}\else
462  \printbookref#1:#2"\fi}
463\def\printbookref#1:#2:"{\printref{#1:#2}}
464
465% Macros which write labels, citations and index entries on auxiliary files.
466%
467% 1. Some code was moved around so that all the labels and indexing stuff
468%    would be together.
469% 2. Modified \makelabel, \printref and \label to be more like the LaTeX
470%    commands \newlabel, \ref and \label, respectively. The commands:
471%    \@xp, \@firstoftwo, \@secondoftwo, \namedef, \@ifundefined
472%    \protectedwrite are adapted pieces of LaTeX code (\@xp is actually
473%    AmSLaTeX's abbreviation of \expandafter).
474% 3. The upshot of 2. is that now underscore is allowed in labels and
475%    index-entries and that the \makelabel commands written to the
476%    manual.lab files have arguments that are no longer put in lowercase.
477%    The labels formed inside TeX from the \makelabel commands maps
478%    underscores to | (needed to be a non-active character) and then
479%    converts to lowercase.
480% 4. Since GapDoc uses < and > in some of its labels a temporary re-defintion
481%    of <#1> was necessary, inside \@xplowr.
482% - GG 2001/06/11, 2001/09/02
483
484\let\@xp\expandafter
485\long\def\@firstoftwo#1#2{#1}
486\long\def\@secondoftwo#1#2{#2}
487\def\namedef#1{\expandafter\def\csname #1\endcsname}
488\def\@ifundefined#1{\@xplowr{#1}%
489  \@xp\ifx\csname \xpandlowr\endcsname\relax%
490    \@xp\@firstoftwo%
491  \else%
492    \@xp\@secondoftwo%
493  \fi}
494\def\protectedwrite#1#2{\begingroup\let_\relax\immediate\write#1{#2}\endgroup}
495\def\@xplowr#1{\begingroup\def_{|}\def<##1>{|##1|}\let\next=\relax%
496  \expandafter\edef\next{\gdef\noexpand\xpandlowr{#1}}%
497  \ifcasesensitive\next\else\lowercase\expandafter{\next}\fi\endgroup}
498\def\m@kelabel#1#2#3{\@xplowr{r@#1}%
499  \@ifundefined{\xpandlowr}%
500    \relax%
501    {\let_\activeusc}%\protectedwrite{16}{Label `#1' multiply defined.}}%
502  \let_\activeusc%\protectedwrite{16}{Defined label `#1'.}%
503  \begingroup\edef_{|}\global\namedef{\xpandlowr}{#2}\endgroup}
504\let\makelabel\undefined
505\gdef\printref#1{\@xplowr{#1}%
506  \@xp\ifx\csname r@\xpandlowr\endcsname\relax\lqq\xpandlowr''%
507  \protectedwrite{16}{Label `#1' undefined.}\global\labundeftrue%
508  \else\expandafter\printpdflink\xpandlowr\relax\fi\endgroup\let_\activeusc}
509\gdef\printpdflink#1:#2\relax{\edef\next{#1}\ifx\next\book
510       \startlink{#2}\csname r@\xpandlowr\endcsname\endlink\else
511       \ifcitebooks\expandafter\csname\next Manual\endcsname,\space\fi
512       \csname r@\xpandlowr\endcsname\fi}
513
514\newif\ifnewlab
515
516% Macros which write labels, citations and index entries on auxiliary files.
517\gdef\label#1{\@xplowr{#1}%
518  \ifnum\secno=0 \edef\@currentlabel{\thechapter}\else
519  \ifnum\subsecno=0 \edef\@currentlabel{\thechapter.\the\secno}\else
520  \edef\@currentlabel{\thechapter.\the\secno.\the\subsecno}\fi\fi
521  \@xp\ifx\csname r@\book:\xpandlowr\endcsname\@currentlabel\else%
522  %\immediate\write16{Label `\book:#1' has changed.}%
523  \global\labchangedtrue\fi%
524  \expandafter\ifx\csname pdfdest@\xpandlowr\endcsname\relax
525  \nameddest{\xpandlowr}%
526  \expandafter\gdef\csname pdfdest@\xpandlowr\endcsname{#1}%
527  \fi%
528  \ifnewlab\def\next{{\xpandlowr}}%
529  \else
530  \def\next{}%
531  \fi
532  \protectedwrite\labelout{\string\makelabel{\book:#1}{\@currentlabel}\next}%
533  \let_\activeusc}
534
535\def\litem#1{% left aligned item
536 \par\hang\noindent\hbox to \parindent{#1\enspace\hfill}}
537
538\newif\ifbiblitem
539
540 \gdef\sigel#1{[\expandafter\ifx\csname c@#1\endcsname\relax
541  \immediate\write16{Reference `#1' undefined.}\global\labundeftrue
542  #1\else \csname c@#1\endcsname\fi]}
543 \gdef\bibitem[#1]#2{\expandafter\gdef\csname c@#2\endcsname{#1}%
544  \nameddest{citation@#2}\ifbiblitem\litem{\sigel{#2}}\else\item{\sigel{#2}}\fi
545  \immediate\write\labelout{\noexpand\setcitlab{#2}\noexpand{#1}}\ignorespaces}
546 \gdef\setcitlab#1#2{\expandafter\gdef\csname c@#1\endcsname{#2}}
547
548\def\cite#1{\write\citeout{\bs citation{#1}}\startlink{citation@#1}\sigel{#1}\endlink}
549\def\dosecindex#1#2#3{\ifchapter{\let\ =\space%
550   \protectedwrite\secindout{#1 \the\chapno.\the\secno. #2#3}}\fi}
551\def\bothindex#1#2#3#4{\doindex{#2}{#3}{#4}\dosecindex{#1}{#2}{#4}}
552\def\index#1{\bothindex I{#1}{}{}}
553\def\atindex#1#2{\doindex{\scrubafterexcl#1!\end}{#2}{}\dosecindex I{#1}{}}
554{\catcode64=12
555\gdef\indextt#1{\doindex{\scrubafterexcl#1!\end}%
556   {@`\scrubafterexcl#1!\end'\scrubbeforeexcl#1!\end}{}\dosecindex I{#1}{}}
557}
558%\def\indextt#1{\atindex{#1}{@`#1'}}
559\def\indexit#1{{\it #1}}
560
561% Macros for generating the table of contents.
562\newif\iffirstsec \firstsectrue
563\def\dotsfill{\leaders\hbox to12pt{\hss.\hss}\hfill}
564
565\def\appcontents#1#2#3{}
566
567\def\chapcontents#1#2#3{%
568   %\iffirstsec\firstsecfalse\else\line{}\fi% empty line
569   \par\penalty-5\medskip
570   \line{\@xplowr{#2}\startlink{\xpandlowr}\bf\kern\manindent\vbox{\advance\hsize by-\manindent
571   \advance\hsize by-1.5em
572   \rightskip 0pt plus1fil \emergencystretch 3em
573   \noindent\llap{\hbox to\manindent{\hss #1\kern\smallmanindent}}\strut
574   #2~\hfill \strut\rlap{\hbox to1.5em{\hss #3}}}\hfil\endlink}}
575
576\def\seccontents#1#2#3{
577   \par\penalty-5\medskip
578   \setchapterlen#1.
579   \line{\@xplowr{#2}\startlink{\xpandlowr}\kern\manindent\vbox{\advance\hsize by-\manindent
580   \advance\hsize by-1.5em
581   \rightskip 0pt plus1fil \emergencystretch 3em
582   \noindent\llap{\hbox to\manindent{\hss #1\kern\smallmanindent}}\strut
583   #2~\dotsfill \strut\rlap{\hbox to1.5em{\hss #3}}}\hfil\endlink}}
584
585% GG ... the idea of \ors is to put the right no. of \or s in the \appno
586%        macro so that for an appendix:
587%         1. \the\chapno gives the number needed in the .six file, and
588%         2. \appno\chapno gives the right letter A, B, ... for the .lab file
589\newtoks\ortoks
590\long\def\addor{\begingroup\ortoks\expandafter{\ors\or}
591   \xdef\ors{\the\ortoks}\endgroup}
592\def\setors{{\xdef\ors{} \count0=\chapno
593   \loop\ifnum\count0>0 \addor \advance\count0 by -1\repeat}}
594\def\appno#1{\expandafter\ifcase\expandafter#1\ors\or A\or B\or C\or D\or E\or
595   F\or G\or H\or I\or J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or
596   U\or V\or W\or X\or Y\or Z\else\immediate\write16{Counter too large} \fi}
597
598% Macros for chapter and section headings.
599\def\filename{appendix}
600\def\tocstrut{{\setbox0=\hbox{1}\vrule width 0pt height\ht0}}
601\outer\def\Input#1{\def\filename{#1.tex}\input #1}
602\def\emptychapter{\noexpand\tocstrut}
603\def\normalchapter{\the\chapno}
604% GG
605\def\appendixchapter{\appno\chapno} % \appno behaves like LaTeX's \Alph
606\newif\ifchapter           % set to true when \thechapter = \normalchapter
607                           % ... or ...  when \thechapter = \appendixchapter
608
609{
610%
611\gdef\setchapterlen#1.#2.{\expandafter\gdef\csname ch@#1\endcsname{#2}}
612\gdef\chapterlen#1{%
613\ifchapter
614\expandafter\ifx\csname ch@#1\endcsname\relax%
6150%
616\else\csname ch@#1\endcsname\fi
617\else 0\fi}%
618}
619\def\setindent#1{\indentno=#1}
620
621\outer\def\Chapter#1 \par{\doChapter{#1}{}}
622
623\def\doChapter#1#2{\vfill\supereject \headlinefalse
624%  \ifodd\pageno\else\null\vfill\eject\headlinefalse\fi
625  \ifexamplefileopen\immediate\closeout\exampleout\examplefileopenfalse\fi
626  \advance\chapno by1 \secno=0\subsecno=0\exno=0%\ifnum\pageno>0 \pageno=1 \fi
627  \def\chapname{#1#2}\label{#1}\ifx\relax#2\relax\else\label{#1#2}\fi%
628  \immediate\write16{Chapter `#1' .}%
629  \write\tocout{\noexpand\chapcontents{\thechapter}{#1#2}{\the\pageno}}%
630  \ifchapter
631    \immediate\write\secindout{C \filename\space\the\chapno. \chapname}\fi
632  \@xplowr{#1}\setbookmarkind{\xpandlowr}{#1#2}%
633  \setbox0=\hbox{\inchhigh\kern-.075em \chapterno}%
634  \setbox1=\vbox{\titlefont \advance\hsize by-\wd0 \advance\hsize by-1em
635%    \hyphenpenalty=10000 \linepenalty=10000
636    \leftskip 0pt plus\hsize \parfillskip 0pt \baselineskip 44pt\relax #1#2}%
637  \line{\box0\hfil\box1}\nobreak \mark{}\vskip 40pt}
638
639% start hack added by TB
640\outer\def\PreliminaryChapter#1 \par{\doChapter{#1}{ (preliminary)}}
641
642\outer\def\Section#1#2\par{\bigbreak \advance\secno by1
643  \subsecno=0
644  \ifx\thechapter\emptychapter
645    \edef\tempa{\the\secno}
646  \else
647    \edef\tempa{\thechapter.\the\secno}%
648  \fi%
649  \@xplowr{#1}\setbookmark{\xpandlowr}{#1}
650  \expandafter\writesecline\tempa\\{#1}
651  \dosecindex S{#1}{}
652  \ifx#2\nolabel\nameddest{\xpandlowr}\else{\let\ =\space\label{#1}}\fi
653  \ifx#2\null\else \edef\tempb{{#1@#1}}
654    \expandafter\doindex\tempb{|indexit}{}\fi
655  \noindent{\baselineskip 18pt\let!=\space \mark{Section \the\secno. #1}%
656  \secfont \tempa \enspace #1}\par\nobreak\medskip}
657
658\def\writesecline#1\\#2{\write\tocout{\noexpand\seccontents{#1}{#2}
659  {\the\pageno}}}
660\def\letter#1{%
661  \edef\tempa{LeTtEr#1}%
662  \nameddest{\tempa}%
663  \setbookmark{\tempa}{#1}%
664  \medskip{\secfont #1}\endgraf\nobreak}
665
666% Macros for generating paragraph headings (e.g., function descriptions).
667\def\fmark{\noindent\llap{\darktriangleright\rm\enspace}}
668\def\moveup#1{\leavevmode \raise.16ex\hbox{\rm #1}}
669\def\fpar{\endgraf\endgroup\nobreak\smallskip\noindent\ignorespaces}
670\def\>{\begingroup\undoquotes\obeylines\angle}
671\def\){\begingroup\obeylines\cloparen}
672{\obeylines\catcode64=12
673\gdef\angle#1
674  {\endgroup \ifx\par\fpar \global\def\susemarker{\fmark}\else%
675  \global\advance\subsecno by1%
676  \global\def\susemarker{\noindent\llap{\smallrom\the\subsecno\kern.5ex%
677  \darktriangleright\rm\enspace}}%
678    \ifvmode \vskip -\lastskip \fi \medskip%
679    \begingroup\let\par=\fpar \parskip 0pt \fi%
680  \endgraf\nobreak\oporfunc#1\end}%
681\gdef\cloparen#1
682  {\endgroup \ifx\par\fpar \else%
683    \ifvmode \vskip -\lastskip \fi \medskip%
684    \begingroup\let\par=\fpar \parskip 0pt \fi%
685  \endgraf{\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}\def\|{\vrule\relax}%
686  \noindent\typewriter#1'}}%
687\gdef\scanparen#1(#2\end{\def\tempa{#2}\ifx\tempa\empty%
688  \def\next{\begingroup\cloparen\susemarker#1%
689  \label{#1}\bothindex F{#1}{@`#1'}{}}%
690  \else\def\next{\delparen#1(#2\end}\fi \next}%
691\gdef\delparen#1(\end{\function#1}%
692\gdef\oporfunc#1#2\end{\ifx#1`\def\next{\oporvalue#1#2}\else%
693                             \def\next{\scanparen#1#2(\end}\fi \next}%
694\long\gdef\oporvalue`#1'#2{\ifx#2V\def\next{\operation`#1'{#1}@{`#1'} V}\else%
695                                 \def\next{\operation`#1'{#2}}\fi \next}%
696\long\gdef\operation`#1'#2#3{{\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}%
697  \def\|{\vrule\relax}}%
698  \susemarker\typewriter#1'%
699  \ifx#3!\def\next{\suboperation{#2}}%
700    \else\ifx#3@\def\next{\subatoperation{#2}}%
701    \else\endheaderline \label{#2}%
702    \bothindex F{#2}{}{}\let\next=#3\fi\fi\next}%
703\long\gdef\function#1(#2)#3{{\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}%
704  \def\|{\vrule\relax}%
705  \susemarker\typewriter#1(#2)'}%
706  \ifx#3!\def\next{\subfunction{#1}}\else%
707    \endheaderline\label{#1}\bothindex F{#1}{@`#1'}{}%
708    \let\next=#3\fi\next}%
709\gdef\subfunction#1#2{\endheaderline\label{#1!#2}%
710  \bothindex F{#1}{@`#1'}{!#2}}%
711\gdef\suboperation#1#2{\endheaderline\label{#1!#2}%
712  \bothindex F{#1}{}{!#2}}%
713\gdef\subatoperation#1#2{\endheaderline\label{#1}%
714  \doindex{\scrubafterexcl#1!\end}{@#2}{}%
715  \dosecindex F{#1}{}}%
716\gdef\scrubafterexcl#1!#2\end{#1}%
717\gdef\scrubbeforeexcl#1!#2\end{\if\relax#2\else!\removeendexcl#2\fi}%
718\gdef\removeendexcl#1!{#1}%
719\gdef\endheaderline{\hskip 0pt plus 1filll}%
720}
721
722% Macro for item lists.
723\catcode`&=\active
724\def\beginitems{%
725  \smallskip
726  \begingroup
727    \advance\ttindent\manindent
728    \def&{\par \nobreak \hangindent\manindent \hangafter 0
729      {\parskip 0pt\noindent}\ignorespaces}
730    \parindent 0pt
731    \catcode`&=\active
732}
733\def\enditems{\par \endgroup \smallskip \noindent \ignorespaces}
734
735% Macro for item lists.
736\def\beginlist{%
737  \smallskip
738  \begingroup
739    \parindent=2em
740}
741\def\endlist{\par \endgroup \smallskip \noindent \ignorespaces}
742\catcode`&=4
743
744% Macros for exercises.
745\outer\def\exercise{\advance\exno by1\begingroup
746  \def\par{\endgraf\endgroup\medskip\noindent}
747  \medskip\noindent{\bf Exercise \chapterno.\the\exno.}\quad}
748\outer\def\answer{\immediate\write\ans{}%
749  \immediate\write\ans{\noexpand\answerto{\thechapter.\the\exno.}}%
750  \copytoblankline}
751\def\answerto#1{{\noindent\bf #1}}
752\def\copytoblankline{\begingroup\setupcopy\copyans}
753{\undoquotes
754\gdef\setupcopy{\undocatcodespecials \obeylines \obeyspaces}
755\obeylines \gdef\copyans#1
756  {\def\next{#1}%
757  \ifx\next\empty\let\next=\endgroup %
758  \else\immediate\write\ans{\next}\let\next=\copyans\fi\next}}
759
760% Macros for the active backquote character (`).
761{\catcode`.=\active \gdef.{\char'056 \penalty0}}
762\def\writetyper{\catcode`.=\active \chardef\{ =`{ \chardef\}=`}
763                      \chardef*=`* \chardef"=`"   \chardef~=`~}
764\catcode``=\active
765\def`{\futurelet\next\backquote}
766\def\typewriter#1'{\leavevmode{\writetyper \chardef`=96 \tt #1}}
767\def\backquote{\ifx\next`\let\next=\doublebackquote
768                    \else\let\next=\typewriter \fi \next}
769\def\doublebackquote`{\lqq}
770
771% The \Package command for argument <pkg> defines a macro \<pkg> that
772% sets the text <pkg> in sans-serif i.e. a share package author should
773% put a \Package{<pkg>} in their manual.tex file and then use {\<pkg>}
774% when they refer to package <pkg>.
775
776\def\Package#1{\namedef{#1}{{\sf #1}}}
777\Package{GAP}
778\Package{MOC}
779\Package{ATLAS}
780
781% For one-off references to a share package there is the following:
782
783\def\package#1{{\sf #1}}
784
785% The day
786
787\def\Day{\number\day}
788
789% The month in words
790
791\def\Month{\ifcase\month\or January\or February\or March\or April\or May\or
792  June\or July\or August\or September\or October\or November\or December\fi}
793
794% The year
795
796\def\Year{\number\year}
797
798% The date
799
800\def\Today{{\Day} {\Month} {\Year}}
801
802% Miscellaneous macros.
803\def\N{{\Bbb N}} \def\Z{{\Bbb Z}} \def\Q{{\Bbb Q}} \def\R{{\Bbb R}}
804\def\C{{\Bbb C}} \def\F{{\Bbb F}} \def\calR{{\cal R}}
805
806%T do we want these
807%\def\stars{\bigskip\centerline{\*\qquad\*\qquad\*}\bigskip}
808
809% Page numbers and running heads.
810\newif\ifheadline
811\nopagenumbers
812\def\makeheadline{\vbox to0pt{\vskip-22.5pt\hbox to\pagewidth{\vbox to8.5pt
813  {}\the\headline}\vss}\nointerlineskip}
814\headline={\ifheadline\ifodd\pageno \righthead\hfil{\rm\folio}\else
815                                    {\rm\folio}\hfil\lefthead \fi
816  \else\global\headlinetrue \hfil\fi}
817
818% Macro for inputting an auxiliary file.
819\def\inputaux#1#2{\immediate\openin#1=#2
820  \ifeof#1\immediate\write16{No file #2.}\else
821  \immediate\closein#1 \input#2\fi}
822
823% Macros for the parts of the manual.
824\outer\def\FrontMatter{%
825  \let\thechapter=\emptychapter
826  \def\lefthead{\it\chapname} \let\righthead=\lefthead
827
828  \begingroup
829  \def\makelabel##1##2{\m@kelabel{##1}{##2}{}}%
830  \undoquotes
831  \inputaux\labelin{\jobname.lab}
832  %\setbox0=\vbox{\Bibliography}
833  \endgroup
834  \labchangedfalse
835
836  % Open the auxiliary files for output.
837  \immediate\openout\tocout   =\jobname.toc
838  \immediate\openout\labelout =\jobname.lab
839  \immediate\openout\indexout =\jobname.idx
840  \immediate\openout\secindout=\jobname.six
841  \immediate\openout\citeout  =\jobname.aux
842%  \immediate\openout\ans=answers
843  \immediate\write\citeout{\bs bibstyle{alpha}}
844
845  \ifodd\pageno\else\headlinefalse\null\vfill\eject\fi
846%  \pageno=1
847}
848
849\outer\def\Chapters{\vfill\eject
850  \chapno=0 \let\thechapter=\normalchapter \chaptertrue
851  \def\lefthead{{\it Chapter \the\chapno. \chapname}}
852  \def\righthead{\ifx\botmark\empty\lefthead\else{\it \botmark}\fi}}
853
854% GG
855% Rather than reset \chapno in \Appendices, for the .six file (which GAP's
856% help uses), we number appendices as if they were chapters (via \the\chapno)
857% i.e. if the last chapter was numbered 7 then for the .six file the first
858% appendix would be numbered 8.
859% The \setors macro puts (\number\chapno - 1) \or s in the \ors macro so that
860% \appno\chapno (= \appendixchapter) numbers the appendices sequentially from A
861% for the .lab file (which TeX uses).
862\outer\def\Appendices{\vfill\eject
863  \ifexamplefileopen\immediate\closeout\exampleout\examplefileopenfalse\fi
864  \setors \let\thechapter=\appendixchapter \chaptertrue
865  \def\lefthead{{\it Appendix \thechapter. \chapname}}
866  \def\righthead{\ifx\botmark\empty\lefthead\else{\it \botmark}\fi}}
867
868\def\EndMatter{\vfill\eject
869  \def\thechapter{} \chapterfalse
870  \def\lefthead{{\it \chapname}}
871  \let\righthead=\lefthead
872  \hbadness=5000\relax
873  \gdef\EndMatter{}}
874
875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
876%%
877%F  \BeginningOfBook  . . . . . . . . . . . . . . . . . . . .  start the book
878%%
879\outer\def\BeginningOfBook#1{%
880  \def\book{#1}%
881  \pageno=-1%
882  \pageno=1%
883  \headlinefalse%
884  \let\thechapter=\emptychapter%
885  \def\lefthead{\it\chapname}%
886  \let\righthead=\lefthead%
887}
888%
889%
890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
891%%
892%F  \UseReferences{<book-path>}	. . . use references from book in <book-path>
893%%
894\outer\def\UseReferences#1{\begingroup\def\makelabel##1##2{\m@kelabel{##1}{##2}{}}\undoquotes
895    \inputaux\labelin{#1/manual.lab}\endgroup
896}
897\outer\def\UseGapDocReferences#1{\begingroup\def\makelabel##1##2##3{\m@kelabel{##1}{##2}{##3}}\undoquotes
898    \inputaux\labelin{#1/manual.lab}\endgroup
899}
900\outer\def\GAPDocLabFile#1{\def\makelabel##1##2##3{\m@kelabel{##1}{##2}{##3}}}
901%
902%
903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904%%
905%F  \EndOfBook	. . . . . . . . . . . . . . . . . . . . . . . .  end the book
906%%
907\outer\def\EndOfBook{\vfill\supereject
908  \immediate\write16{##}
909  \immediate\closeout\citeout
910  \immediate\write16{## Citations for BibTeX written on \jobname.aux.}
911  \immediate\closeout\indexout
912  \immediate\write16{## Index entries for makeindex written on \jobname.idx.}
913  \immediate\closeout\secindout
914  \immediate\write16{## Section index entries written on \jobname.six.}
915  \immediate\closeout\labelout
916  \immediate\write16{## Label definitions written on \jobname.lab.}
917  \immediate\closeout\tocout
918  \immediate\write16{## Table of contents written on \jobname.toc.}
919  \immediate\write16{## Examples written to \jobname.example-XX.tst.}
920  %\iflabmultdef\immediate\write16{## There were multiply-defined labels.}\fi
921  \iflabundef\immediate\write16{## There were undefined labels or
922  references.}\fi
923  \iflabchanged\immediate\write16{## Labels have changed, run again. (Or
924  they were multiply defined.)}\fi
925  \immediate\write16{##}
926  \end
927}
928%
929%
930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
931%%
932%F  \TableOfContents  . . . . . . . . . . . . . . produce a table of contents
933%%
934% name of the chapter containing the table of contents
935\def\TOCHeader{Contents}
936
937% explanation at the beginning of the table of contents
938\def\TOCMatter{%
939}
940
941% macros for generating the table of contents
942%\newif\iffirstsec\firstsectrue
943\def\dotsfill{\leaders\hbox to12pt{\hss.\hss}\hfill}
944
945% produce the chapter "Contents"
946\outer\def\TableOfContents{\doChapter\TOCHeader{}%
947\TOCMatter
948\vskip 20pt
949\begingroup
950\rigidfalse
951\let!=\space
952\begindoublecolumns
953\inputaux\tocin{\jobname.toc}\vfill\eject
954\enddoublecolumns
955\endgroup
956}
957
958% a one column version of \TableOfContents for short manuals
959\outer\def\OneColumnTableOfContents{\doChapter\TOCHeader{}%
960\TOCMatter
961\vskip 20pt
962\begingroup
963\rigidfalse
964\let!=\space
965\inputaux\tocin{\jobname.toc}\vfill\eject
966\endgroup
967}
968
969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
970%%
971%F  \TitlePage{<text>}	. . . . . . . . . . . . . . . . generate a title page
972%%
973\outer\long\def\TitlePage#1{%
974  \null\vfill#1\null\vfill\eject
975}
976
977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
978%%
979%F  \Colophon{<text>}	. . . . . . . . . . . . . . generate a colophon page
980%%
981\outer\long\def\Colophon#1{\doChapter{}{}%
982#1\null\vfill\eject
983}
984
985
986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987%%
988%F  \Answers  . . . . . . . . . . . . .  produce the answers to the exercises
989%%
990% header for the answers
991\def\AnswersHeader{Answers to the Exercises}
992%
993% produce the chapter "Answers"
994\outer\def\Answers{\doChapter\AnswersHeader{}%
995  \parindent\manindent
996  \parskip 1ex plus 0.5ex minus 0.5ex
997  \immediate\closeout\ans
998  \input answers
999}
1000
1001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1002%%
1003%F  \Bibliography . . . . . . . . . . . .  produce the chapter "Bibliography"
1004%%
1005% header for the bibliography
1006\def\BibHeader{Bibliography}
1007\newdimen\bibindent \bibindent=\manindent
1008
1009% produce the chapter bibliography
1010\outer\def\Bibliography{\EndMatter\doChapter\BibHeader{}%
1011  \begingroup\undoquotes\frenchspacing
1012  \parindent\bibindent
1013  \pretolerance=5000 %badness allowed for hypenation
1014  \tolerance=5000    %badness allowed before overfull boxes appear
1015  \parskip 1ex plus 0.5ex minus 0.5ex
1016  \def\begin##1##2{} \def\end##1{}
1017  \let\newblock=\relax \let\em=\sl
1018  \inputaux\citein{\jobname.bbl}
1019  \endgroup
1020}
1021
1022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1023%%
1024%F  \Index  . . . . . . . . . . . . . . . . . .   produce the chapter "Index"
1025%%
1026% header for the index
1027\def\IndexHeader{Index}
1028
1029% explanation at the beginning of the index
1030\def\IndexMatter{%
1031This index covers only this manual.
1032A page number in {\it italics} refers to a whole section which is devoted to
1033the indexed subject.  Keywords are sorted with case and spaces ignored,
1034e.g., ```PermutationCharacter''' comes before ``permutation group''.%
1035}
1036
1037% kerning in full index after letter
1038\def\idxkern{\kern.3em}
1039
1040% produce the chapter index
1041\outer\def\Index{\EndMatter%
1042  % get the proper bookmarking function
1043  \global\let\setbookmarkind=\indexbookmark%
1044  \doChapter\IndexHeader{}%
1045  \IndexMatter
1046  \bigskip
1047  \begindoublecolumns
1048  \pretolerance=5000 %badness allowed for hypenation
1049  \tolerance=5000    %badness allowed before overfull boxes appear
1050  \parindent 0pt \parskip 0pt \rightskip 0pt plus2em \emergencystretch 2em
1051  \everypar{\hangindent\smallmanindent}
1052  \def\par{\endgraf\leftskip 0pt}
1053  \def\sub{\advance\leftskip by\smallmanindent}
1054  \def\subsub{\advance\leftskip by2\smallmanindent}
1055  \obeylines
1056  \inputaux\indexin{\jobname.ind}
1057  \enddoublecolumns
1058}
1059
1060% pseudo chapters used for authors, preface, copyright &c.
1061\def\PseudoInput#1#2#3{%
1062\vfill\eject% to ensure the pseudo-chapter no. doesn't get into headline
1063\advance\chapno by1\secno=0\subsecno=0
1064\immediate\write\secindout{C #1.tex \thechapter. #2}
1065\label{#2}\label{#3}} % we do this for the benefit of the HTML manuals
1066
1067% some often-used LaTeX functions
1068\def\frac#1#2{{{#1}\over{#2}}}
1069
1070% as the etalchar gets written out in manual.lab, better make it nonfancy
1071% (otherwise something breaks).
1072\def\etalchar#1{$^{#1}$}
1073\def\etalchar#1{#1}
1074
1075% nasty trick to cope with the `newcommand' created by bibtex
1076\def\newcommand#1#2#3#4#5{}
1077
1078% URL stuff
1079\def\URL#1{\par\kernttindent\hbox{`#1'}\ifx\EndMatter\empty\else\qquad\fi}
1080\def\Mailto#1{\penalty-1000\hskip 0pt plus10cm\hbox{`#1'}}
1081
1082% ragged bottom will avoid large blank spaces
1083\raggedbottom
1084\frenchspacing
1085\vfuzz=2pt
1086
1087\catcode64=12% catcode of @
1088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1089%%
1090%E
1091%%
1092