%% $Id: xy.sty,v 3.10 2011/03/14 20:14:00 krisrose Exp $
%%
%% ``Xy-pic as LaTeX 2.09 style option and LaTeX 2e package''.
%% Copyright (c) 1993-1996      Kristoffer H. Rose      <krisrose@tug.org>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-2011      Kristoffer H. Rose      <krisrose@tug.org>
%%
%% The Xy-pic 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 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 package; if not, see http://www.gnu.org/licenses/.

% Load Xy-pic with catcode of @ set as it will be in user text:
\count255=\the\catcode`\@ {\catcode`\@=11 \xdef\xystycatcode{\the\count255}}
\makeatletter

% REPAIR bug of the 2e version of AMS-LaTeX where \makeatother is broken...
\ifx\@ifpackageloaded\undefined \makeatother
\else \@ifpackageloaded{amstex}{\catcode`\@=\active}{\makeatother}\fi

\input xy

% That is all unless this is called as a LaTeX2e `native mode' package.  Is
% there an official way to check this?  Anyway, this seems to work:
\makeatletter
\ifx\if@compatibility\undefined \catcode`\@=\xystycatcode \endinput \fi

% Ensure that we are *really* running LaTeX2e...!
\NeedsTeXFormat{LaTeX2e}

% So we can check for pdfTeX.
\RequirePackage{ifpdf}

% This file provides the current version of Xy-pic!
\edef\next{%
 \noexpand\ProvidesPackage{xy}[\xydate\space Xy-pic version \xyversion]}\next

% Recognise some standard LaTeX2e class options (cf. old `LaTeX Companion' p.317):
\DeclareOption{cmactex}{\xyoption{dvips}} % Thomas Kiffe's CMacTeX uses dvips
\DeclareOption{dvips}{\xyoption{dvips}\xyoption{ps}}
\DeclareOption{dvitops}{\xyoption{dvitops}\xyoption{ps}}
\DeclareOption{emtex}{\xyoption{emtex}}
\DeclareOption{ln}{\xywarning@{`ln' DVI driver not yet fully supported}}
\DeclareOption{oztex}{\xyoption{oztex}}
\DeclareOption{textures}{\xyoption{textures}}
\DeclareOption{xdvi}{\xyoption{xdvi}}

% Recognise standard aliases for the pdf option.
\DeclareOption{pdftex}{\xyoption{pdf}}
\DeclareOption{dvipdfm}{\xyoption{pdf}}
\DeclareOption{dvipdfmx}{\xyoption{pdf}}

% This is special.
\DeclareOption{colour}{\xyoption{color}} % :-)

% This (obsolete) cmtip style option should be activated after loading:
\DeclareOption{cmtip}{\xyoption{cmtip}\UseComputerModernTips}

% Pass the desired tip size if defined
\DeclareOption{10pt}{\xywithoption{tips}{\def\tipsize@@{10}}}
\DeclareOption{11pt}{\xywithoption{tips}{\def\tipsize@@{11}}}
\DeclareOption{12pt}{\xywithoption{tips}{\def\tipsize@@{12}}}

% Other options are just loaded.
\DeclareOption*{\edef\next{\noexpand\xyoption{\CurrentOption}}\next}

% Reinstall catcode of @...
\catcode`\@=\xystycatcode

% ...and process the options.
\ProcessOptions\relax

% Now, if no backend is loaded but we can generate PDF, do.
\ifpdf\makeatletter
 \ifx\xydriversloaded@@\xydriversloaded@none
  \makeatother\xyoption{pdf}\fi\fi

% That's all.
\endinput

% $Log: xy.sty,v $
% Revision 3.10  2011/03/14 20:14:00  krisrose
% Preparing for release 3.8.6.
%
% Revision 3.9  2010/06/10 18:45:49  krisrose
% Reference to GPL by URL.
%
% Revision 3.8  2010/04/28 07:14:30  krisrose
% New Xy-pic home page installed.
%
% Revision 3.7  2010/04/26 01:45:23  krisrose
% First proper integration of xypdf into Xy-pic "make dist".
%
% Revision 3.6  2010/04/25 21:48:06  krisrose
% First proper integration of xypdf into Xy-pic "make dist".
%
% Revision 3.5  2010/04/20 20:36:43  krisrose
% Documentation updates.
%
% Revision 3.4  2010/04/16 06:06:52  krisrose
% Preparing for a new release...
%
% Revision 3.3  1996/12/19 03:31:56  krisrose
% Maintenance release
%
% Revision 3.1  1995/09/05  20:31:32  kris
% Releasing!
%
% Revision 3.0  1995/07/07  20:14:21  kris
% Major release w/new User's Guide!
%
% Revision 2.13  1995/07/04  15:11:17  kris
% Ready to release v3?
%
% Revision 2.12  1994/10/25  11:34:25  kris
% Interim release just before v3 [works with AMS-LaTeX 1.2]...
%
% Revision 2.9  1994/06/09  14:59:19  kris
% Release 3beta.
%
% Revision 2.8  1994/04/08  04:30:00  kris
% Second (bug fix) 3alpha release.
%
% Revision 2.7  1994/03/08  02:06:01  kris
% Release 3alpha.
%
% New for version 2.7.
