%%
%% This is file `amscdx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% amscdx.dtx 
%% 
%% Copyright 1995, 1999 American Mathematical Society.
%% Copyright 2016 LaTeX3 Project and American Mathematical Society.
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Vermeer.
%% 
\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
[1994/12/01]% LaTeX date must December 1994 or later
\ProvidesPackage{amscdx}[2019/07/02 v2.2x AMS Commutative Diagrams]

\newif\iflyx\lyxfalse
\DeclareOption{lyx}{\lyxtrue}

\DeclareOption*{}
\ProcessOptions*\relax

\RequirePackage{amsgen}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\@ifundefined{math@cr}{%
  \def\math@cr{{\ifnum0=`}\fi
    \@ifstar{\global\@eqpen\@M\math@cr@}%
          {\global\@eqpen\interdisplaylinepenalty \math@cr@}}
  \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}}
  \def\math@cr@@[#1]{\ifnum0=`{\fi}\math@cr@@@
    \noalign{\vskip#1\relax}}
  \def\restore@math@cr{\def\math@cr@@@{\cr}}
}{}
\restore@math@cr
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\newif\ifCDfat
\newif\ifCDash
\def\dye@{black}
\def\CDlor#1{\gdef\dye@{#1}} % must be gdef
\@ifundefined{rightarrowfill@}{
  \def\rightarrowfill@#1{%
    \m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\copy\z@\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\mathord\rightarrow$}
  \def\leftarrowfill@#1{%
    \m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\mathord\leftarrow\mkern-6mu\cleaders%
    \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill
    \mkern-6mu\box\z@$}
  \def\leftrightarrowfill@#1{%
    \m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\mathord\leftarrow\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\mathord\rightarrow$}
}{}
  \def\Rightarrowfill@#1{%
    \m@th\setboxz@h{$#1\Relbar$}\ht\z@\z@
    $#1\copy\z@\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\mathord\Rightarrow$}
  \def\Leftarrowfill@#1{%
    \m@th\setboxz@h{$#1\Relbar$}\ht\z@\z@
    $#1\mathord\Leftarrow\mkern-6mu\cleaders%
    \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill
    \mkern-6mu\box\z@$}
  \def\Leftrightarrowfill@#1{%
    \m@th\setboxz@h{$#1\Relbar$}\ht\z@\z@
    $#1\mathord\Leftarrow\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\mathord\Rightarrow$}
\def\rightdasharrowfill@#1{%
    \m@th\setboxz@h{$#1\:\relbar\:$}\ht\z@\z@
    $#1\copy\z@\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-2mu\mathord\rightarrow$}
\def\leftdasharrowfill@#1{%
    \m@th\setboxz@h{$#1\:\relbar\:$}\ht\z@\z@
    $#1\mathord\leftarrow\mkern-2mu\cleaders%
    \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill
    \mkern-6mu\box\z@$}
  \def\leftrightdasharrowfill@#1{%
    \m@th\setboxz@h{$#1\:\relbar\:$}\ht\z@\z@
    $#1\mathord\leftarrow\mkern-2mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-2mu\mathord\rightarrow$}
\def\atdef@#1{\expandafter\def\csname\space @\string#1\endcsname}
\@ifundefined{Iat}{%
  \DeclareRobustCommand{\Iat}{\FN@\at@}
}{}
\begingroup \catcode`\@=\active
\csname if\string @compatibility\endcsname
\else \fam=\mathcode`\@
  \xdef @{\mathchar\number\fam\space }
\fi
\gdef\CDat{\let @=\Iat}
\endgroup
\mathcode`\@="8000 % make @ pseudo-active in math
\def\at@{\let\next@\at@@
 \ifcat\noexpand\next a\else
 \ifcat\noexpand\next0\else
 \ifcat\noexpand\next\relax\else
 \let\next@\at@@@\fi\fi\fi\next@}
\def\at@@#1{\expandafter
  \ifx\csname\space @\string#1\endcsname\relax
    \DN@{\at@@@#1}%
  \else
    \DN@{\csname\space @\string#1\endcsname}%
  \fi\next@}%
\@ifundefined{default@tag}{%
  \def\default@tag{%
    \def\tag{\PackageError{amscdx}{\protect\tag\space not allowed
      here}\@eha}}%
}{}%
\@ifundefined{at@@@}{%
  \def\at@@@{\PackageError{amscdx}{\Invalid@@ @}{\the\athelp@}\char64\relax}
}{}
\@ifundefined{athelp@}{\csname newhelp\endcsname\athelp@
{Only certain combinations beginning with @ make sense to me.^^J%
I'll assume you wanted @@ for a printed @.}}{}
\@ifundefined{minaw@}{\newdimen\minaw@}{}
\@ifundefined{bigaw@}{\newdimen\bigaw@}{}
\minaw@11.111pt
\newdimen\minCDarrowwidth
\minCDarrowwidth2.5pc
\newif\ifCD@
\let\ampersand@\relax
\iflyx\else\newenvironment{CD}{}{}\fi
\renewenvironment{CD}{%
  \CDat
  \bgroup\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi
  \CD@true\vcenter\bgroup\let\\\math@cr\restore@math@cr\default@tag
  \tabskip\z@skip\baselineskip20\ex@
  \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup
  &\hfill$\m@th##$\hfill\crcr
}{%
  \crcr\egroup\egroup\egroup
}
\def\CD@check#1#2{\ifCD@\DN@{#2}\else
  \DN@{\PackageError{amscdx}{@\protect#1 not
    allowed outside of the CD environment}\@eha}%
  \fi\next@}
\atdef@>#1>#2>{%
  \ifCDfat\gdef\ar@{\Rightarrowfill@}\else\ifCDash\gdef\ar@{\rightdasharrowfill@}\else\gdef\ar@{\rightarrowfill@}\fi\fi 
  \gdef\before@{\dye@}
  \ampersand@
  \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi
  \setboxz@h{$\m@th\scriptstyle\;{#1}\;\;$}%
  \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi
  \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;{#2}\;\;$}%
    \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi}%
  \ifCD@\enskip\fi
\color{\before@}\mathrel{\mathop{\hbox to\bigaw@{\ar@\displaystyle}}%
      \limits^{#1}\@ifnotempty{#2}{_{#2}}}%
 \ifCD@\enskip\fi \ampersand@}
\atdef@<#1<#2<{%
  \ifCDfat\gdef\ar@{\Leftarrowfill@}\else\ifCDash\gdef\ar@{\leftdasharrowfill@}\else\gdef\ar@{\leftarrowfill@}\fi\fi 
  \gdef\before@{\dye@}
  \ampersand@
  \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi
  \setboxz@h{$\m@th\scriptstyle\;\;{#1}\;$}%
  \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi
  \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;\;{#2}\;$}%
    \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}%
  \ifCD@\enskip\fi
    \color{\before@}\mathrel{\mathop{\hbox to\bigaw@{\ar@\displaystyle}}%
      \limits^{#1}\@ifnotempty{#2}{_{#2}}}%
  \ifCD@\enskip\fi \ampersand@}
\atdef@ Z#1Z#2Z{\CD@check{x..x..x}{%
  \ifCDfat\gdef\ar@{\Leftrightarrowfill@}\else\ifCDash\gdef\ar@{\leftrightdasharrowfill@}\else\gdef\ar@{\leftrightarrowfill@}\fi\fi 
  \gdef\before@{\dye@}
  \ampersand@
  \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi
  \setboxz@h{$\m@th\scriptstyle\;\;{#1}\;$}%
  \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi
  \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;\;{#2}\;$}%
    \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}%
  \ifCD@\enskip\fi
    \color{\before@}\mathrel{\mathop{\hbox to\bigaw@{\ar@\displaystyle}}%
      \limits^{#1}\@ifnotempty{#2}{_{#2}}}%
\ifCD@\enskip\fi \ampersand@}}
\begingroup \catcode`\~=\active \lccode`\~=`\@
\lowercase{%
  \global\atdef@)#1)#2){~>#1>#2>}
  \global\atdef@(#1(#2({~<#1<#2<}
}% end lowercase
\endgroup
\atdef@ A#1A#2A{\CD@check{A..A..A}{\color{\dye@}\llap{$\m@th\vcenter{\hbox
  {$\scriptstyle#1$}}$}
  \ifCDfat \Big\Uparrow \else
  \ifCDash \vphantom{\Bigg\Updownarrow}\text{\rotatebox{90}{\clap{$\mkern8mu\relbar\:\relbar\mkern-2mu\rightarrow$}}}
  \else \Big\uparrow \fi \fi
  \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}}
\atdef@ V#1V#2V{\CD@check{V..V..V}{\color{\dye@}\llap{$\m@th\vcenter{\hbox
  {$\scriptstyle#1$}}$}
  \ifCDfat \Big\Downarrow \else
  \ifCDash \vphantom{\Bigg\Updownarrow}\text{\rotatebox{270}{\clap{$\mkern-8mu\relbar\:-\mkern-2mu\rightarrow$}}}
  \else \Big\downarrow \fi \fi
  \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}}
\atdef@ X#1X#2X{\CD@check{X..X..X}{\color{\dye@}\llap{$\m@th\vcenter{\hbox
  {$\scriptstyle#1$}}$}
  \ifCDfat \Big\Updownarrow \else
  \ifCDash \vphantom{\Bigg\Updownarrow}\text{\rotatebox{90}{\clap{$\mkern8mu\leftarrow\mkern-2mu\relbar\mkern-2mu\rightarrow$}}}
  \else \Big\updownarrow \fi \fi
  \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}}
\atdef@={\CD@check={\gdef\before@{\dye@}&\color{\before@}\enskip\mathrel
  {\vbox{\hrule\@width\minCDarrowwidth\vskip2\ex@\hrule\@width
  \minCDarrowwidth}}\enskip&}}
\atdef@|{\CD@check|{\color{\dye@}\Big\Vert&&}}
\atdef@\vert{\CD@check\vert{\color{\dye@}\Big\Vert&&}}
\atdef@.{\CD@check.{&&}}
\endinput
%%
%% End of file `amscdx.sty'.
