%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%A  gapmacro.tex                GAP manual       Frank Celler, Heiko Theissen
%%
%%  @(#)$Id: gapmacro.tex,v 1.1.1.1 2000/02/21 15:59:03 hetzi Exp $
%%
%%  The following macros are defined in this file.
%%
%%  `text'   set text in typewriter style (use `\<' instead of `<')
%%  <text>   set text in italics (use $\<$ instead of $<$ for less than)
%%  *text*   set text in emphasized style (i.e. slanted)
%%  $a.b$    same as $a \cdot b$ (use $\.$ instead of $.$ for full stop)
%%  "ref"    refer to a label (like "function!for category")
%%  \cite{.} make a citation
%%  \index{.} \indextt{.} make index entry (\indextt in typewriter style)
%%
%%  \beginitems         produce itemized texts with 3pc hanging indentation
%%    item & text
%%
%%    item & text ...
%%  \enditems
%%
%%  \begintt            verbatim text in typewriter style (`|' is
%%    verbatim material   temporary escape character, a line
%%  \endtt                `|_' allows a page break)
%%  \beginexamplett     verbatim text in typewriter style (`|' is
%%    verbatim material   temporary escape character, a line
%%  \endtt                `|_' allows a page break)
%%
%%  \Input{file}  includes file `file.tex' (not recommended for appendices)
%%  \Chapter title \par
%%  \Section{title} \par
%%      make  chapter  or section   title. Automatically  generates  table of
%%      contents. \null after \Section{...} inhibits indexing.
%%  \>function( arguments )!{ index subentry }
%%  \>`a binop b'{binary operation}!{ index subentry }
%%      make a  heading for a subsection   explaining a function  or a binary
%%      operation. This automatically generates   a label and an  index entry
%%      (with optional subentry).
%%  \){\fmark ...}
%%      the same without label and index entry
%%
%%  \BeginningOfBook
%%  \FrontMatter, \Chapters, \Appendices     parts of the book
%%  \Bibliography, \Index, \TableOfContents  make these chapters (w/o head)
%%  \EndOfBook
%%

% Page dimensions and double column output.
\hsize 39pc
\vsize 52pc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%  Generic double column output.
%
%    Modified from a routine written by Donald Knuth (The TeXBook, App. E)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  The user may modify the following to his tastes:
%
%      \pagewidth     vertical length of page.
%      \pageheight    horizontal width of page.
%      \colwidth      column width
%      \separator     macro to generate column separator. Default is nothing.
%                     \rulesep sets it to \vrule. \norulesep doesn't.
%      \makepage      default is what is contained in plain.
\catcode`@=11 % from plain.tex
% Create and initialize new dimensions.
\newdimen\pagewidth  \newdimen\pageheight  \newdimen\colwidth
\pagewidth=\hsize    \pageheight=\vsize    \colwidth=3.2truein

% This routine is used by \output ; this is different from
%   the one found in App. E.
\def\onepageout#1{{\setbox255=\vbox{#1}
  \hsize=\pagewidth \vsize=\pageheight \plainoutput}}
     
\output{\onepageout{\unvbox255}}
\newbox\partialpage
\def\begindoublecolumns{\begingroup
  \output={\global\setbox\partialpage=\vbox{\unvbox255}}\eject
  \output={\doublecolumnout} \hsize=\colwidth \vsize=2\pageheight}
\def\enddoublecolumns{\output={\balancecolumns}\eject
  \endgroup \pagegoal=\vsize}
\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  \onepageout\pagesofar
  \unvbox255 \penalty\outputpenalty}
\def\pagesofar{\unvbox\partialpage
  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\separator\hfil\box2}}
\def\norulesep{\let\separator=\relax}
\def\rulesep{\let\separator=\vrule}
\let\separator=\relax
\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  \divide\dimen@ by2 \splittopskip=\topskip
  {\vbadness=10000 \loop \global\setbox3=\copy0
    \global\setbox1=\vsplit3 to\dimen@
    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  \setbox0=\vbox to\dimen@{\unvbox1}
  \setbox2=\vbox to\dimen@{\dimen2=\dp3 \unvbox3\kern-\dimen2 \vfil}
  \pagesofar}
\catcode`@=12
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\colwidth 19pc
\newdimen\manindent      \manindent 3pc
\newdimen\smallmanindent \smallmanindent 1pc
\parskip 1ex plus 0.5ex minus 0.5ex
\parindent 0pt

% Additional fonts.
\font\inchhigh=cminch
\font\titlefont=cmssdc10 at 40pt
\font\secfont=cmssdc10 at 14pt
\font\manual=manfnt
\font\sf=cmss10
\font\sevenit=cmti10 at 7pt \scriptfont\itfam=\sevenit
\font\fiveit=cmti10 at 5pt  \scriptscriptfont\itfam=\fiveit

% If you don't have `msb' fonts, replace the next 4 lines by `\let\Bbb=\bf'.
\newfam\msbfam \def\Bbb{\fam\msbfam}
\font\tenmsb=msbm10         \textfont\msbfam=\tenmsb
\font\sevenmsb=msbm7        \scriptfont\msbfam=\sevenmsb
\font\fivemsb=msbm5         \scriptscriptfont\msbfam=\fivemsb

% Math mode should use text italic.
{\count0=\itfam \advance\count0 by-1 \multiply\count0 by"100
 \count1=`A
 \loop \count2=\mathcode\count1 \advance\count2 by\count0
       \global\mathcode\count1=\count2
      {\advance\count1 by'040
       \count2=\mathcode\count1 \advance\count2 by\count0
       \global\mathcode\count1=\count2}
 \ifnum\count1<`Z \advance\count1 by1\repeat}

% macros for verbatim scanning (almost copied from `The TeXbook')
\chardef\other=12
\def\undocatcodespecials{\catcode`\\=\other     \catcode`\{=\other
  \catcode`\}=\other     \catcode`\<=\other     \catcode`\$=\other
  \catcode`\%=\other     \catcode`\~=\other     \catcode`\^=\other
  \catcode`\_=\other     \catcode`\*=\other     \catcode`\`=\other
  \catcode`\!=\other     \catcode`\"=\other     \catcode`\&=\other
  \catcode`\#=\other     \catcode`\|=\other}
{\obeyspaces\global\let =\ }
{\obeylines\gdef\obeylines{\catcode`^^M=\active}\gdef^^M{\par}%
 \catcode`#=\active \catcode`&=6 \gdef#&1^^M{\hbox{\rm\char35 &1}\par}%
 \gdef\ttverbatim{\begingroup\undocatcodespecials \catcode`\#=\active%
   \parindent 0pt \def\_^^M{\allowbreak}%
   \def\par{\ifvmode\allowbreak\vskip 1pc plus 1pt\else\endgraf\nobreak\fi}%
   \obeyspaces \obeylines \tt}}
\outer\def\begintt{\par
  \ttverbatim \parskip=0pt \catcode`\|=0 \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|medskip{#2}|endgroup %
  |vskip-|parskip|medskip|noindent|ignorespaces}}
\outer\def\beginexample{\par
  \ttverbatim \parskip=0pt \catcode`\|=0 \rightskip-5pc \examplefinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|examplefinish#1^^M#2\endexample{#1|medskip{#2}|endgroup %
  |vskip-|parskip|medskip|noindent|ignorespaces}}

% Input/output streams. Chapter and section counters.
\newwrite\labelout \newwrite\indexout \newwrite\secindout
\newwrite\tocout   \newwrite\citeout  \newwrite\ans
\newread \labelin  \newread \indexin  \newread \tocin  \newread \citein
\countdef\chapno=1 \newcount\secno    \newcount\exno
\def\chapterno{{\edef\tempa{\thechapter}\tempa}}
\def\folio{\ifnum\pageno<0 \romannumeral-\pageno \else
  \chapterno\ifx\thechapter\emptychapter\else--\fi \number\pageno\fi}
\def\doindex#1#2#3{\write\indexout{\noexpand\indexentry{#1#2#3}%
  {\ifnum\pageno<0 \romannumeral-\pageno \else
   \thechapter\ifx\thechapter\emptychapter\else--\fi \number\pageno\fi}}%
  \ifvmode\nobreak\fi}

% Additional active characters and their default meanings.
\mathcode`.="2201 \mathchardef\.="702E
\def\undoquotes{\catcode`'=12 \catcode``=12 \def\"##1{{\accent127 ##1}}}
\def\excl{!} \chardef\lqq=`\\ \let\underscore=\_
\catcode`!=\active \let!=\excl
\catcode`^=\active \def^{\ifmmode\sp\else{\char`\^}\fi}
\catcode`_=\active \def_{\ifmmode\sb\else\_\fi}         \let\_=\underscore
\catcode`*=\active \def*{\ifmmode\let\next=\*\else\let\next=\bold\fi\next}
                   \def\bold#1*{{\sl #1\/}}             \chardef\*=`*
\catcode`<=\active \def<#1>{{\chardef*=`*\let_=\_\it#1\/}}
                                                        \chardef\<=`<
\catcode`"=\active \def"{\begingroup\undoquotes\doref}  \chardef\"=`"
                                                        \chardef\\=`\\

% Labels (which are automatically generated by ``\Section'' and ``\>'').
\newif\iflabundef
\def\doref#1"{\bookref#1:"}
\def\bookref#1:#2"{\def\tempa{#2}\ifx\tempa\empty\printref{\book:#1}\else
  \printbookref#1:#2"\fi}
\def\printbookref#1:#2:"{\printref{#1:#2}}
{\catcode`@=11
\gdef\makelabel#1#2{\expandafter\gdef\csname r@#1\endcsname{#2}}
\gdef\printref#1{\expandafter\ifx\csname r@#1\endcsname\relax\lqq#1''%
  \immediate\write16{Label `#1' undefined.}\global\labundeftrue
  \else \csname r@#1\endcsname \fi\endgroup}
\gdef\ov#1#2#3#4{\def\tempa{#2}\def\tempb{for #3}\ifx\tempa\tempb\else
  \expandafter\ifx\csname r@#1!for #3\endcsname \relax
  \else \allowbreak\null\nobreak\hskip.5em plus 1fill
    \hbox{#4$\,\to\,$\csname r@#1!for #3\endcsname.}\fi \fi}}

% Macros for generating the table of contents.
\newif\iffirstsec \firstsectrue
\def\dotsfill{\leaders\hbox to12pt{\hss.\hss}\hfill}
\def\chapcontents#1#2#3{\iffirstsec\else \enddoublecolumns\firstsectrue\fi
  \medbreak \leftline{\bf\hbox to\manindent{\hss #1\kern\smallmanindent}#2}}
\def\seccontents#1#2#3{\iffirstsec\nobreak\smallskip\firstsecfalse
  \begindoublecolumns\fi
   \line{\kern\manindent\vbox{\advance\hsize by-\manindent
   \advance\hsize by-1.5em
   \rightskip 0pt plus1fil \emergencystretch 3em
   \noindent\llap{\hbox to\manindent{\hss #1\kern\smallmanindent}}\strut
   #2~\dotsfill \strut\rlap{\hbox to1.5em{\hss #3}}}\hfil}}
\def\appno#1{{\count0=#1\advance\count0 by64 \char\count0}}

% Macros which write labels, citations and index entries on auxiliary files.
\newif\iflabchanged
{\catcode`|=0 \catcode`\\=12 |gdef|bs{\}}
{\catcode`@=11
 \gdef\label#1{{\ifnum\secno=0 \edef\next{\the\chapno}\else
  \edef\next{\the\chapno.\the\secno}
  \expandafter\ifx\csname r@\book:#1\endcsname\next\else
  \immediate\write16{Label `\book:#1' has changed.}
  \global\labchangedtrue\fi\fi
  \immediate\write\labelout{\noexpand\makelabel{\book:#1}{\next}}}}
 \gdef\sigel#1{[\expandafter\ifx\csname c@#1\endcsname\relax
  \immediate\write16{Reference `#1' undefined.}\global\labundeftrue
  #1\else \csname c@#1\endcsname\fi]}
 \gdef\bibitem[#1]#2{\expandafter\gdef\csname c@#2\endcsname{#1}%
  \item{\sigel{#2}}}}
\def\cite#1{\write\citeout{\bs citation{#1}}\sigel{#1}}
\def\dosecindex#1#2#3{\ifx\thechapter\normalchapter\let\ =\space
  \immediate\write\secindout{#1 \thechapter.\the\secno. #2#3}\fi}
\def\bothindex#1#2#3#4{\doindex{#2}{#3}{#4}\dosecindex{#1}{#2}{#4}}
\def\index#1{\bothindex I{#1}{}{}}
\def\atindex#1#2{\bothindex I{#1}{#2}{}}
\def\indextt#1{\atindex{#1}{@`#1'}}
\def\indexit#1{{\it #1}}

% Macros for chapter and section headings.
\def\filename{appendix}
\def\tocstrut{{\setbox0=\hbox{1}\vrule width 0pt height\ht0}}
\outer\def\Input#1{\def\filename{#1.tex}\input #1}
\def\emptychapter{\noexpand\tocstrut}
\def\normalchapter{\the\chapno}

\long\def\Chapter#1 \par{\vfill\supereject \headlinefalse
  \ifodd\pageno\else\null\vfill\eject\headlinefalse\fi
  \advance\chapno by1 \secno=0 \exno=0 \ifnum\pageno>0 \pageno=1 \fi
  \def\chapname{#1} \label{chapter #1}
  \write\tocout{\noexpand\chapcontents{\thechapter}{#1}{\the\pageno}}
  \ifx\thechapter\normalchapter
    \immediate\write\secindout{C \filename\space\thechapter. \chapname}\fi
  \setbox0=\hbox{\inchhigh\kern-.075em \chapterno}
  \setbox1=\vbox{\titlefont \advance\hsize by-\wd0 \advance\hsize by-2em
    \leftskip 0pt plus 1fil \parfillskip 0pt \baselineskip 44pt\relax #1}
  \line{\box0\hfil\box1}\nobreak \vskip 40pt \noindent}

\outer\long\def\Section#1#2\par{\medskip \advance\secno by1
  {\let!=\space \mark{Section \the\secno. #1}}
  \ifx\thechapter\emptychapter
    \edef\tempa{\the\secno}
  \else
    \edef\tempa{\thechapter.\the\secno}%
  \fi%
  \expandafter\writesecline\tempa\\{#1}
  \dosecindex S{#1}{}{\let\ =\space\label{#1}}
  \ifx#2\null\else \edef\tempb{{#1}}
    \expandafter\doindex\tempb{|indexit}{}\fi
  {\baselineskip 18pt\let!=\space \noindent\secfont
   \tempa \enspace #1\par}\nobreak\medskip\noindent}

\def\writesecline#1\\#2{\write\tocout{\noexpand\seccontents{#1}{#2}
  {\the\pageno}}}
\def\letter#1{\medskip{\secfont #1}\endgraf\nobreak}

% Macros for generating paragraph headings (e.g., function descriptions).
\def\danger{\hang\hangafter=-2 \clubpenalty=10000 \noindent
  \llap{\smash{\manual\char127}\enspace}\ignorespaces}
\def\fmark{\noindent\llap{\manual\char120\rm\enspace}}
\def\moveup#1{\leavevmode \raise.16ex\hbox{\rm #1}}
\def\fpar{\endgraf\endgroup\nobreak\smallskip\noindent\ignorespaces}
\def\>{\begingroup\undoquotes\obeylines\angle}
\def\){\begingroup\obeylines\cloparen}
{\obeylines
\gdef\angle#1
  {\endgroup \ifx\par\fpar \else%
    \ifvmode \vskip -\lastskip \fi \medskip%
    \begingroup\let\par=\fpar \parskip 0pt \fi%
  \endgraf\nobreak\oporfunc#1\end}%
\gdef\cloparen#1
  {\endgroup \ifx\par\fpar \else%
    \ifvmode \vskip -\lastskip \fi \medskip \begingroup\let\par=\fpar\fi%
  \endgraf {\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}\def\|{\vrule\relax}%
  \noindent\typewriter#1'}}%
\gdef\scanparen#1(#2\end{\def\tempa{#2}\ifx\tempa\empty%
  \def\next{\begingroup\cloparen\fmark#1
  \label{#1}\bothindex F{#1}{@`#1'}{}}%
  \else\def\next{\delparen#1(#2\end}\fi \next}}
\def\delparen#1(\end{\function#1}
\def\oporfunc#1#2\end{\ifx#1`\def\next{\operation#1#2}\else
                             \def\next{\scanparen#1#2(\end}\fi \next}
\long\def\operation`#1'#2#3{{\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}%
  \def\|{\vrule\relax}}\fmark\typewriter#1'%
  \ifx#3!\def\next{\suboperation{#2}}
    \else\overlay{#2}\null \label{#2}%
    \bothindex F{#2}{}{}\let\next=#3\fi\next}
\long\def\function#1(#2)#3{{\def\[{\moveup\lbrack}\def\]{\moveup\rbrack}%
  \def\|{\vrule\relax}\fmark\typewriter#1(#2)'}%
  \ifx#3!\def\next{\subfunction{#1}}\else
    \overlay{#1}\null\label{#1}\bothindex F{#1}{@`#1'}{}%
    \let\next=#3\fi\next}
\def\subfunction#1#2{\overlay{#1}{#2}\label{#1!#2}%
  \bothindex F{#1}{@`#1'}{!#2}}
\def\suboperation#1#2{\overlay{#1}{#2}\label{#1!#2}%
  \bothindex F{#1}{}{!#2}}
\def\overlay#1#2{\hskip 0pt plus 1filll{\it
  \ov{#1}{#2}{groups}{groups}%
  \ov{#1}{#2}{solvable groups}{solv\thinspace gps}%
  \ov{#1}{#2}{permutation groups}{perm\thinspace gps}%
  \ov{#1}{#2}{solvable permutation groups}{solv\thinspace perm\thinspace gps}}}

% Macro for item lists.
\catcode`&=\active
\def\beginitems{%
  \smallskip
  \begingroup
    \def&{%
      \par
      \nobreak
      \hangindent
      \manindent
      \hangafter 0
      {\parskip 0pt\noindent}
      \ignorespaces
     }
    \parindent 0pt
    \catcode`&=\active
}
\def\enditems{%
  \par
  \endgroup
  \smallskip
  \noindent
  \ignorespaces
}

% Macro for item lists.
\catcode`&=\active
\def\beginlist{%
  \smallskip
  \begingroup
    \parindent=2em
}
\def\endlist{%
  \par
  \endgroup
  \smallskip
  \noindent
  \ignorespaces
}
\catcode`&=4

% Macros for exercises.
\outer\def\exercise{\advance\exno by1\begingroup
  \def\par{\endgraf\endgroup\medskip\noindent}
  \medskip\noindent{\bf Exercise \chapterno.\the\exno.}\quad}
\outer\def\answer{\immediate\write\ans{}%
  \immediate\write\ans{\noexpand\answerto{\thechapter.\the\exno.}}%
  \copytoblankline}
\def\answerto#1{{\noindent\bf #1}}
\def\copytoblankline{\begingroup\setupcopy\copyans}
{\undoquotes
\gdef\setupcopy{\undocatcodespecials \obeylines \obeyspaces}
\obeylines \gdef\copyans#1
  {\def\next{#1}%
  \ifx\next\empty\let\next=\endgroup %
  \else\immediate\write\ans{\next}\let\next=\copyans\fi\next}}

% Macros for the active backquote character (`).
{\catcode`.=\active \gdef.{\char'056 \penalty0}}
\def\writetyper{\catcode`.=\active \chardef\{ =`{ \chardef\}=`}
                      \chardef*=`* \chardef"=`"   \chardef~=`~}
\catcode``=\active
\def`{\futurelet\next\backquote}
\def\typewriter#1'{\leavevmode{\writetyper \chardef`=96 \tt #1}}
\def\backquote{\ifx\next`\let\next=\doublebackquote
                    \else\let\next=\typewriter \fi \next}
\def\doublebackquote`{\lqq}

% Miscellaneous macros.
\def\GAP{{\sf GAP}}
\def\stars{\bigskip\centerline{\*\qquad\*\qquad\*}\bigskip}
\def\N{{\Bbb N}} \def\Z{{\Bbb Z}} \def\Q{{\Bbb Q}} \def\R{{\Bbb R}}
\def\C{{\Bbb C}} \def\F{{\Bbb F}}

% Page numbers and running heads.
\newif\ifheadline
\nopagenumbers
\def\makeheadline{\vbox to0pt{\vskip-22.5pt\hbox to\pagewidth{\vbox to8.5pt
  {}\the\headline}\vss}\nointerlineskip}
\headline={\ifheadline\ifodd\pageno \righthead\hfil{\rm\folio}\else
                                    {\rm\folio}\hfil\lefthead \fi
  \else\global\headlinetrue \hfil\fi}

% Macro for inputting an auxiliary file.
\def\inputaux#1#2#3{\immediate\openin#1=#2\jobname.#3
  \ifeof#1\immediate\write16{No file #2\jobname.#3.}\else
  \immediate\closein#1 \input#2\jobname.#3 \fi}

% Macros for the parts of the manual.
\outer\def\FrontMatter{\iffirstsec\else\enddoublecolumns\fi
  \let\thechapter=\emptychapter
  \def\lefthead{\it\chapname} \let\righthead=\lefthead

  \begingroup
  \undoquotes
  \inputaux\labelin{}{lab}
  \setbox0=\vbox{\Bibliography}
  \endgroup
  \labchangedfalse
  
  % Open the auxiliary files for output.
  \immediate\openout\tocout   =\jobname.toc
  \immediate\openout\labelout =\jobname.lab
  \immediate\openout\indexout =\jobname.idx
  \immediate\openout\secindout=\jobname.six
  \immediate\openout\citeout  =\jobname.aux
  \immediate\openout\ans=answers
  \immediate\write\citeout{\bs bibstyle{alpha}}

  \ifodd\pageno\else\headlinefalse\null\vfill\eject\fi
  \pageno=1 }
  
\outer\def\Chapters{\vfill\eject
  \chapno=0 \let\thechapter=\normalchapter
  \def\lefthead{{\it Chapter \the\chapno. \chapname}}
  \def\righthead{\ifx\botmark\empty\lefthead\else{\it \botmark}\fi}}

\outer\def\Appendices{\vfill\eject
  \def\filename{appendix}
  \chapno=0 \def\thechapter{\noexpand\appno{\the\chapno}}
  \def\lefthead{{\it Appendix \appno{\the\chapno}. \chapname}}
  \let\righthead=\lefthead}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \BeginningOfBook  . . . . . . . . . . . . . . . . . . . .  start the book
%%
\def\BeginningOfBook#1{%
  \def\book{#1}%
  \pageno=-1%
  \headlinefalse%
  \let\thechapter=\emptychapter%
  \def\lefthead{\it\chapname}%
  \let\righthead=\lefthead%
}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \UseReferences{<book-path>}	. . . use references from book in <book-path>
%%
\def\UseReferences#1{{\undoquotes
    \inputaux\labelin{#1/}{lab}}
}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \EndOfBook	. . . . . . . . . . . . . . . . . . . . . . . .  end the book
%%
\def\EndOfBook{\vfill\supereject
  \immediate\write16{##}
  \immediate\closeout\citeout
  \immediate\write16{## Citations for BibTeX written on \jobname.aux.}
  \immediate\closeout\indexout
  \immediate\write16{## Index entries for makeindex written on \jobname.idx.}
  \immediate\closeout\secindout
  \immediate\write16{## Section index entries written on \jobname.six.}
  \immediate\closeout\labelout
  \immediate\write16{## Label definitions written on \jobname.lab.}
  \immediate\closeout\tocout
  \immediate\write16{## Table of contents written on \jobname.toc.}
  \iflabundef\immediate\write16{## There were undefined labels or
  references.}\fi
  \iflabchanged\immediate\write16{## Labels have changed, run again. (Or
  they were multiply defined.)}\fi
  \immediate\write16{##}
  \end
}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \TableOfContents  . . . . . . . . . . . . . . produce a table of contents
%%
% name of the chapter containing the table of contents
\def\TOCHeader{Contents}

% explanation at the beginning of the table of contents
\def\TOCMatter{%
  \rightline{The pages are numbered chapterwise. This table of contents}
  \rightline{gives for each section the page number within the chapter.}}

% macros for generating the table of contents
\newif\iffirstsec\firstsectrue
\def\dotsfill{\leaders\hbox to12pt{\hss.\hss}\hfill}

% produce the chapter "Contents"
\outer\def\TableOfContents{\Chapter{\TOCHeader}

  \TOCMatter
  \vskip 20pt
  \begingroup
  \let!=\space
  \inputaux\tocin{}{toc}\vfill\eject
  \endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \TitlePage{<text>}	. . . . . . . . . . . . . . . . generate a title page
%%
\long\def\TitlePage#1{%
  \null\vfill#1\null\vfill
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \Answers  . . . . . . . . . . . . .  produce the answers to the exercises
%%
% header for the answers
\def\AnswersHeader{Answers to the Exercises}
%
% produce the chapter "Answers"
\def\Answers{\Chapter{\AnswersHeader}

  \parindent\manindent
  \parskip 1ex plus 0.5ex minus 0.5ex
  \immediate\closeout\ans
  \input answers
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \Bibliography . . . . . . . . . . . .  produce the chapter "Bibliography"
%%
% header for the bibliography
\def\BibHeader{Bibliography}

% produce the chapter bibliography
\def\Bibliography{\Chapter{\BibHeader}

  \begingroup\undoquotes\frenchspacing
  \parindent\manindent
  \parskip 1ex plus 0.5ex minus 0.5ex
  \def\begin##1##2{} \def\end##1{}
  \let\newblock=\relax \let\em=\sl
  \inputaux\citein{}{bbl}
  \endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%F  \Index  . . . . . . . . . . . . . . . . . .   produce the chapter "Index"
%%
% header for the index
\def\IndexHeader{Index}

% explanation at the beginning of the index
\def\IndexMatter{%
  Page numbers are given in the form <chapter>--<page_within_chapter>. A page
  number in {\it italics} refers to a whole section which is devoted to the
  indexed subject. Some index entries refer to exercises, whose answers in
  appendix~A should then also be read. Keywords are sorted with case and
  spaces ignored, e.g., ```PermutationCharacter''' comes before ``permutation
  group''.%
}

% produce the chapter index
\def\Index{\Chapter{\IndexHeader}

  \IndexMatter
  \bigskip
  \begindoublecolumns
  \parindent 0pt \parskip 0pt \rightskip 0pt plus2em \emergencystretch 2em
  \everypar{\hangindent\smallmanindent}
  \def\par{\endgraf\leftskip 0pt}
  \def\sub{\advance\leftskip by\smallmanindent}
  \def\subsub{\advance\leftskip by2\smallmanindent}
  \obeylines
  \inputaux\indexin{}{ind}
  \enddoublecolumns
}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%E  gapmacro.tex  . . . . . . . . . . . . . . . . . . . . . . . ends here
