%% $Id: xypicman.def,v 2.6 1992/06/24 01:23:34 kris Exp $ -*-tex-*-
%%
%% Definitions for XY-pic: The User's Manual.
%% Copyright (c) 1991,1992  Kristoffer H. Rose  <kris@diku.dk>
%%
%% This file is part of the XY-pic macro package.
%%
%% The XY-pic macro package is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The XY-pic macro package is distributed in the hope that it will be
%% useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
%% Public License for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this macro package; if not, write to the Free Software Foundation,
%% Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

% XPPT extract...
%
\immediate\write16{XPPT document style extensions - Version beta (for XY-pic)}%
\count255=\the\catcode`\@ \catcode`\@=11 \edef\catcode@{\the\count255}
\def\Err@@#1{\errhelp\defaulthelp@\errmessage{AMS-TeX XPPT error: #1}}
\message{AUX-file support,}
\newread\saferead@
\def\inputsafe@#1#2 {\openin\saferead@=#2 %
 \ifeof\saferead@\DN@{#1}\else \DN@{\closein\saferead@\input#2 }\fi
 \next@}
\newtoks\topmatter@ \topmatter@={}
\let\@ldtopmatter=\topmatter
\def\topmatter{\@ldtopmatter \let\@ldtopmatter\relax \relaxnext@
 \the\topmatter@ \topmatter@={}\relax}
\newwrite\auxout@
\newif\ifinhibitupdate@
\let\writeaux@\eat@
\def\writeaux#1{{\DN@{#1}\DNii@##1:->##2<-:{\writeaux@{##2}}%
 \expandafter\nextii@\meaning\next@<-:}}
\def\xwriteaux#1{\edef\next{{#1}}\expandafter\writeaux@\next}
\let\InhibitUpdate=\inhibitupdate@true
\addto\topmatter{%
 \inputsafe@{\W@{! Initialising \jobname.aux.}}\jobname.aux %
 \ifinhibitupdate@\else
  \openout\auxout@=\jobname.aux %
  \gdef\writeaux@{\write\auxout@}%
  \xwriteaux{\commentcharacter\space\jobname.aux created \today, \now.}%
 \fi}
\message{cross references,}
\def\xlabel#1#2{\writeaux{\xxlabel{#1}{#2}}}
\def\xxlabel#1#2{%
 \expandafter\ifx\csname x@#1\endcsname\relax
  \expandafter\gdef\csname x@#1\endcsname{#2}%
 \else\W@{! Reference {#1} defined twice}\fi}
\def\xref{\FN@\xref@}
\def\xref@{%
 \ifx "\next \DN@"##1"{\DN@####1{##1}\xref@@}%
 \else \DN@{\DN@####1{\W@{! Undefined reference: ####1.}}\xref@@}%
 \fi \next@}
\def\xref@@#1{%
 \expandafter\ifx\csname x@#1\endcsname\relax \next@{#1}%
 \else{\csname x@#1\endcsname}\fi}
\message{automatic numbering,}
\def\level#1{\csname level#1@\endcsname}
\def\nolevel@#1{\ignorespaces}
\expandafter\def\csname level0@\endcsname{\nolevel@}
\newif\ifautodone@
\def\thepageno@{\ifnum\pageno<\z@\romannumeral-\pageno\else\number\pageno\fi}
\outer\def\NumberHead#1{%
 \DN@##1{\expandafter\def\csname no#1\endcsname{%
   \writeaux{\intocentry{#1}{{} ##1}}}}%
 \expandafter\next@\csname end#1\endcsname
 \DN@##1{\Number@{#1}{##1}{%
   \DN@################1################2{%
    \writeaux{\intocentry{#1}{{################1} %
      ########1\page{################2}##1}}}%
   \xdef\nextii@{{\thenumber@.}{\thepageno@}}\expandafter\next@\nextii@
  \csname#1y@\endcsname
   \thenumber@{.\enspace}\ignorespaces########1##1\autodone@false}}%
 \expandafter\next@\csname end#1\endcsname}
\outer\def\NumberFirst#1{\Number@{#1}{}{%
  \csname#1y@\endcsname{%
   \thenumber@{.\enspace}\ignorespaces####1%
   \expandafter\global\autodone@false}}}
\outer\def\NumberLast#1{\Number@{#1}{}{%
  \csname#1y@\endcsname{####1~\thenumber@{}%
   \expandafter\global\autodone@false}}}
\def\NumberClear@#1{%
 \if#1.\else \if#10\else\global\count#1=\z@ \noexpand\NumberClear@@{#1}\fi
  \expandafter\NumberClear@\fi}
\def\NumberClear@@#1{%
 \expandafter\xdef\csname level#1@\endcsname{\number\count#1}}
\def\Number@#1#2#3#4#5#6{%
 \expandafter\ifx\csname #1y@\endcsname\relax
  \DN@{\expandafter\let\csname#1y@\endcsname}%
  \expandafter\next@\csname#1\endcsname
 \else \Err@@{\expandafter\string\csname#1\endcsname\space already
   automatically numbered.}\fi
 \edef\next@{\NumberClear@#4#5.}\next@
 \edef\next@##1{\expandafter\def\csname#1x@\endcsname{\NumberClear@#5.##1}}%
 \next@{\def\autox@####1#2{#3}\auto@{#4}{#6}}
 \expandafter\let\csname#1\endcsname=\relax
 \expandafter\def\csname#1\endcsname{%
  \ifautodone@\DN@{\csname#1y@\endcsname}\else\DN@{\csname#1x@\endcsname}\fi
  \autodone@true \next@}}
\def\auto@#1#2{\DN@{\auto@@{#1}{#2}}\FN@\next@}
\def\auto@@#1#2{%
 \ifx "\next
  \DN@"##1"{\DN@{##1}%
   \ifx\next@\empty \expandafter\def\csname level#1@\endcsname{\nolevel@}%
   \else \expandafter\def\csname level#1@\endcsname{##1}\fi
   \def\thenumber@{\csname level#1@\endcsname}%
   \FN@\auto@@@}%
 \else\ifx [\next
  \DN@[##1]{\ifx#10\else\global\count#1=##1\relax
   \expandafter\xdef\csname level#1@\endcsname{\number\count#1}\fi
   \def\thenumber@{#2}\FN@\auto@@@}%
 \else
  \DN@{\ifx#10\else\global\advance\count#1by\@ne
    \expandafter\xdef\csname level#1@\endcsname{\number\count#1}\fi
   \def\thenumber@{#2}\FN@\auto@@@}%
 \fi\fi \next@}
\def\auto@@@{%
 \ifx \space@\next \expandafter\DN@\space{\FN@\auto@@@}%
 \else\ifx =\next \DN@=##1{%
   \edef\next@{\noexpand\xlabel{##1}{\thenumber@{}}}\next@\FN@\auto@@@@}%
 \else \let\next@=\auto@@@@\fi\fi \next@}
\def\auto@@@@{%
 \ifx \space@\next \expandafter\DN@\space{\FN@\auto@@@@}%
 \else \let\next@=\autox@ \fi \next@}
\message{automatic table of contents,}
\def\autotoc{\the\autotoc@}
\newtoks\autotoc@ \autotoc@={}
\def\intocentry#1#2{\addto\autotoc{\csname#1\endcsname#2}}
\def\intocwidestnumber#1#2{\addto\autotoc{%
 \expandafter\widestnumber\csname#1\endcsname{#2}}}
\def\tocwidestnumber#1#2{\writeaux{\intocwidestnumber{#1}{#2}}}
\def\tocvspace#1{\writeaux{\intocentry{vskip}{ #1\relax}}}
\message{Bib-TeX bibliographies,}
\newif\ifBibsmissing@
\newtoks\citetoks@
\newif\ifbibrefs
\def\biband{ and~}
\def\bibchapter{ch.~}
\def\bibno{no.~}
\def\bibcross{\rom{in}~}
\def\bibmonth#1{\ifcase#1\or January\or February\or March\or April\or
  May\or June\or July\or August\or September\or October\or November\or
  December\fi}
\def\citeextra#1{{\count@=97\advance\count@#1\relax\char\count@}}
\refstyle{C}
\def\bibstyle@{xypicman}%
\def\citesep@{,\,\allowbreak}%
\def\citepretext@#1{#1 }%
\def\bibwidestlabel#1{\widestnumber\no{#1\enspace}}%
\def\bibref#1#2#3\endref{\ifbibrefs \csname ref\endcsname \no#2 #3\endref
  \else \xxlabel{(BIB)#1}{#2}\fi}%
\outer\def\UseBibRefs#1{\addto\topmatter{%
  \bibrefsfalse \inputsafe@{\global\Bibsmissing@true}\jobname.bbl %
  \let\cite=\cite@ \let\incite=\incite@
  \xwriteaux{\string\bibstyle{\bibstyle@}}%
  \xwriteaux{\string\bibdata{#1}}}}
\let\citeformat=\cite
\def\cite@{\DN@{%
 \ifx \space@\next \expandafter\DN@\space{\FN@\cite@}%
 \else \ifx "\next
  \DN@"####1"{\begingroup\citepretext@{####1}\FN@\cite@@}%
 \else \DN@{\begingroup\FN@\cite@@}%
 \fi\fi \next@}\FN@\next@}
\def\cite@@{\DN@{%
 \ifx \space@\next \expandafter\DN@\space{\FN@\cite@@}%
 \else \ifx [\next
  \DN@[####1]####2{\FN@\cite@@@####2, ####1,@}%
 \else
  \DN@####1{\FN@\cite@@@####1,@}%
 \fi\fi \next@}\FN@\next@}
\def\cite@@@{%
 \ifx @\next \DN@ @{\citeformat{\the\citetoks@}\endgroup}%
 \else \ifx \space@\next
  \DN@##1,@{\citeformat{\the\citetoks@,##1}\endgroup}%
 \else \let\next@=\cite@@@@ \fi\fi \next@}
\def\cite@@@@#1,{\xwriteaux{\string\citation{#1}}%
 \edef\nextii@{\the\citetoks@}\ifx\nextii@\empty\else
  \citetoks@=\expandafter{\the\citetoks@\citesep@}\fi
 \edef\nextii@##1{\the\citetoks@
  \noexpand\xref"##1{\fiverm #1\W@{! Undefined citation: #1.}}"{(BIB)#1}}%
 \citetoks@=\expandafter{\nextii@{\global\Bibsmissing@true}}%
 \FN@\cite@@@}
\let\incite@=\cite@
\def\nocite#1{\xwriteaux{\string\citation{#1}}}
\def\bibrefs{\bibrefstrue \inputsafe@{}\jobname.bbl
  \ifBibsmissing@
   \W@{! Undefined citations: maybe you need to run `bibtex \jobname?'}\fi
  \ignorespaces}
\let\bibstyle\eat@
\let\bibdata\eat@
\let\citation\eat@
\message{miscellaneous}
\edef\today{\ifcase\month\or January\or February\or March\or April\or
  May\or June\or July\or August\or September\or October\or November\or
  December\fi\space\number\day, \number\year}
\count@=\time \divide\count@ by 60\relax
\count@@=\count@ \multiply\count@@ by -60 \advance\count@@ by \time
\edef\now{\number\count@:\ifnum 10>\count@@ 0\fi \number\count@@}
\begingroup
 \catcode`\|=\z@ \catcode`\<=\@ne \catcode`\>=\tw@
 |catcode`|%=12 |gdef|commentcharacter<%>
 |catcode`|\=12 |gdef|escapecharacter<\>
 |catcode`|{=12 |gdef|bgroupcharacter<{>
 |catcode`|}=12 |gdef|egroupcharacter<}>
|endgroup
\def\inputsafe{%
 \DN@{%
  \ifx"\next
   \DN@"####1"{\ifx"####1"\DNii@{}\else\DNii@{\W@{! ####1}}\fi
    \inputsafe@\nextii@}%
  \else
   \DN@####1 {\inputsafe@{\W@{! No file ####1.}}####1 }%
  \fi\next@}%
 \FN@\next@}

% XPPT xfixed option:
%
\newdimen\spacew@ \newdimen\tabw@
\newdimen\fflength@
\def^^L{\par}
{\catcode`\^^L=\active\catcode`\^^I=\active%
\catcode`\^^M=\active\catcode`\ \active%
\gdef\obeyspacing{\begingroup\parskip=\z@ plus\ex@\frenchspacing%
\catcode`\^^M=\active\def^^M{\CR@}\catcode`\ \active\def {\SP@}%
\catcode`\^^L=\active\def^^L{\FF@}\catcode`\^^I=\active\def^^I{\TAB@}%
\setboxz@h\bgroup}}
\def\endobeyspacing{\egroup\ifdim\z@<\wdz@\leavevmode\boxz@\fi\endgroup}
\def\CR@{\egroup \leavevmode\boxz@\par \setboxz@h\bgroup}
\def\SP@{\kern\spacew@}
\def\FF@{\egroup
 \dimen@=\fflength@ \advance\dimen@-\wdz@
 \leavevmode\boxz@ \raise.7ex\hbox to\dimen@{\hrulefill}\setboxz@h\bgroup}
\def\TAB@{\egroup \dimen@=\wdz@
 \divide\dimen@\tabw@ \multiply\dimen@\tabw@ \advance\dimen@\tabw@
 \wdz@=\dimen@ \leavevmode\boxz@ \setboxz@h\bgroup}
\newcount\lineno@
\outer\def\lines{\ifmmode\expandafter\vcenter\fi\bgroup \lines@{}}
\outer\def\numberedlines{\ifmmode\expandafter\vcenter\fi\bgroup \lineno@=\z@
 \lines@{\advance\lineno@\@ne \llap{$\ssize\the\lineno@$\enspace}}}
\def\lines@#1{\parindent=\z@\parskip=\z@\everypar{#1}%
 \setboxz@h{0}\spacew@=\wdz@ \setboxz@h{NNNNNNNN}\tabw@=\wdz@
 \fflength@=\hsize \tabw@=0.1\hsize
 \def\CR@{\egroup \ifdim\z@<\wdz@ \noindent\boxz@\par \fi
  \let\CR@=\CRii@ \setboxz@h\bgroup}%
 \def\CRii@{\egroup \noindent\boxz@\par \setboxz@h\bgroup}%
 \obeyspacing}
\def\endlines{\endobeyspacing\egroup}
{\catcode`\^^M=\active \gdef\verbdummy@{^^M}}
\def\verb#1{\ifmmode\expandafter\hbox\fi\bgroup\kern\z@
 \count@=`#1\relax \catcode\count@=\active
 \uccode`\^^M=\count@
 \expandafter\uppercase\expandafter{\expandafter\def\verbdummy@
  {\egroup}}%
 \uccode`\^^M=\z@
 \verb@}
\def\verb@{\tt \frenchspacing \setboxz@h{0}\spacew@=\wdz@
 \catcode`\\=12 \catcode`\{=12 \catcode`\}=12 %
 \catcode`\$=12 \catcode`\_=12 \catcode`\^=12 %
 \catcode`\&=12 \catcode`\#=12 \catcode`\%=12 %
 \catcode`\~=12 \catcode`\@=12 }
\outer\def\verbatim{\ifmmode\expandafter\vcenter\fi\bgroup
 \verbatim@{\hbox to\parindent{\hss}}}
\outer\def\numberedverbatim{\ifmmode\expandafter\vcenter\fi\bgroup \lineno@=\z@
 \verbatim@{\advance\lineno@\@ne
  \hbox to\parindent{\hss$\ssize\the\lineno@$\enspace}}}
\def\verbatim@#1#2{%
 \setboxz@h{\tt00000000}\tabw@=\wdz@\setboxz@h{0}\spacew@=\wdz@
 \fflength@=\hsize \advance\fflength@-2\parindent
 \everypar{#1}%
 \def\CR@{\egroup \ifdim\z@<\wdz@ \leavevmode\boxz@\par \fi
  \let\CR@=\CRii@ \FN@\CR@@}%
 \def\CRii@{\egroup \leavevmode\boxz@\par \FN@\CR@@}%
 \def\CR@@{\ifx\next#2\relax\expandafter\CR@@@
  \else\setboxz@h\expandafter\bgroup\fi}%
 \def\CR@@@#2{\endgroup\egroup}\verb@\obeyspacing}
\def\endverbatim{}
\outer\def\verbatiminput#1 {%
 \ifhmode\par\fi \ifmmode\expandafter\vcenter\fi\bgroup
 \verbatim@{}\0\input#1 \relax\endobeyspacing\egroup }
\outer\def\numberedverbatiminput#1 {%
 \ifhmode\par\fi \ifmmode\expandafter\vcenter\fi\bgroup
 \lineno@=\z@
 \verbatim@{\advance\lineno@\@ne
  \hbox to\parindent{\hss$\ssize\the\lineno@$\enspace}}%
 \0\input#1 \relax\endobeyspacing\egroup }

% XPPT xrcs option...
%
\def\RCSdate$Date{%
 \DN@{\ifx\next$\let\nextii@\eat@\else\let\nextii@\RCSdate@\fi\nextii@}%
 \FN@\next@}
\def\RCSdate@: #1/#2/#3 #4 ${%
 \xdef\theyear{\ifnum#1<100\relax19\fi#1}%
 \xdef\thedate{%
  \ifcase#2\or January\or February\or March\or April\or
   May\or June\or July\or August\or September\or October\or November\or
   December\fi\space
  \eatzero@#3,\space\theyear}}
\def\eatzero@#1{\ifx0#1\else#1\fi}
\def\RCSrevision$Revision{%
 \DN@{\ifx\next$\let\nextii@\eat@\else\let\nextii@\RCSrevision@\fi\nextii@}%
 \FN@\next@}
\def\RCSrevision@: #1.#2 ${\xdef\therevision{#1.#2}\xdef\therelease{#1}}
\def\thedate{\today}
\def\theyear{\number\year}
\let\therevision\empty
\let\therelease\empty

% End of XPPT inclusions...also needs xypicman.bst.
%
\catcode`\@=\catcode@
\UseBibRefs{xypicman}
\NumberHead{head}{1}{2}{\level1{}}
\NumberHead{subhead}{2}{}{\level1.\level2{}}

% Logos:
%
% METAFONT logo uses the manfnt font (cf. app.E of The TeXbook).  We use
% \the\font to figure out which which variant of the logo to use; only the
% ones that make sense have been specified.
\font\manual=manfnt
\define\MF{\expandafter\expandafter\expandafter\MFx
 \expandafter\string\the\font!}
\define\MFx#1#2!{\csname MF#2\endcsname}
\define\MFtenrm{{\manual META}\-{\manual FONT}}
\let\MFtenbf=\MFtenrm
\define\MFtensl{{\manual 89:;}\-{\manual <=>:@,}}
\let\MFtenit=\MFtensl
\define\MFeightrm{{\manual opqr}\-{\manual stuq}}
\let\MFeightbf=\MFeightrm
\define\MFeightsl{{\manual \char'134 \char'135 \char'136 \char'137}\-%%
 {\manual efg\char'136\/}}
\let\MFeightit=\MFeightsl
%
\define\AMS{{\textfontii A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
\define\LaTeX{L\kern-.36em\raise.3ex\hbox{\small A}\kern-.15em\TeX}
\define\PiCTeX{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC\kern-.11em\TeX}
%
% The \small macro changes to a smaller version of \the\font.  Works only in
% text mode!  Uses the xppt \delay feature.
%
\define\small{\expandafter\expandafter\expandafter\smallx
   \expandafter\string\the\font!}
\define\smallx#1#2!{\csname small#2\endcsname}
\let\smallfourteenrm=\tenrm
\let\smallfourteensl=\tensl
\let\smallfourteensmc=\tensmc
\let\smallfourteenit=\tenit
\let\smallfourteenbf=\tenbf
\let\smalltenrm=\sevenrm
\let\smalltensl=\sevensl
\let\smalltensmc=\sevenrm
\let\smalltenit=\sevenit
\let\smalltenbf=\sevenbf
\let\smalleightrm=\sixrm
\let\smalleightsl=\sixrm
\let\smalleightsmc=\sixrm
\let\smalleightit=\sevenit
\let\smalleightbf=\sixbf
%
% Common abbreviations:
%
\define\eg{\text{{\it e}.{\it g}.}}	\define\Eg{\text{{\it E}.{\it g}.}}
\define\ie{\text{{\it i}.{\it e}.}}	\define\Ie{\text{{\it I}.{\it e}.}}
\define\cf{\text{{\it cf}.}}		\define\Cf{\text{{\it Cf}.}}
%
% `thing', :-), :-(, and `tick' as \items...
%
\define\thing{\item"${\bullet}$" }
\define\good{\item"$\ssize\ddot\smile$" }
\define\bad{\item"$\ssize\ddot\frown$" }
\define\tick{\item"\checkmark" }
%
% Handy macros:
%
\define\I#1{\relax\ifmmode\expandafter\text\fi{\it#1\/}}
\define\={\xref}
\define\pt{\,\text{pt}}
\define\ex{\,\text{ex}}
\define\pc{\,\text{pc}}
%
\redefine\and{\mskip 10mu minus 4mu\relax}	% wide space
\define\<#1>{\relax\ifmmode\expandafter\text\fi	% nonterminal
 {$\left<@!\text{\it#1\/}@!\right>$}}
\define\iss{\and{::=}\and}
\redefine\|{\and{|}\and}
%
\define\T#1{\relax\ifmmode\expandafter\text\fi{\tt#1}}
\define\cs#1{\relax\ifmmode\expandafter\text\fi{\tt\char92 #1}}
\redefine\{{\T{\char123 }}
\redefine\}{\T{\char125 }}
\redefine\~{\T{\char126 }}
\redefine\_{\T{\char95 }}
\redefine\^{\T{\char94 }}

% End and Log
%
\endinput
%
% $Log: xypicman.def,v $
% Revision 2.6  1992/06/24  01:23:34  kris
% Extract from the XPPT package.
