From 9f9467342aa8d5908460d4ced2213a521376f7b4 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 15 Jul 2006 20:49:34 +0000
Subject: galois update (23mar06)

git-svn-id: svn://tug.org/texlive/trunk@1847 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/galois/galois.dtx | 167 ++++++++++++++++-------
 1 file changed, 121 insertions(+), 46 deletions(-)

(limited to 'Master/texmf-dist/source/latex/galois/galois.dtx')

diff --git a/Master/texmf-dist/source/latex/galois/galois.dtx b/Master/texmf-dist/source/latex/galois/galois.dtx
index f80c8037acd..7d42cf52fc7 100644
--- a/Master/texmf-dist/source/latex/galois/galois.dtx
+++ b/Master/texmf-dist/source/latex/galois/galois.dtx
@@ -1,15 +1,15 @@
-\def\fileversion{1.04}
-\def\filedate{1999/05/01}
+\def\fileversion{1.05}
+\def\filedate{2005/03/19}
 % \iffalse meta-comment
 %
 % This file can be redistributed and/or modified under the terms of 
-% the LaTeX Project Public License from CTAN archives, as described in 
-% macros/latex/base/ lppl.txt in the base LaTeX distribution.  Either 
-% version 1.0 or, at your option, any later version.
+% the LaTeX Project Public License from CTAN archives, as described at
+% http://www.latex-project.org/lppl.txt.  Either LPPL Version 1.3 or, 
+% at your option, any later version.
 % 
 % \fi
 %
-% \CheckSum{388}
+% \CheckSum{423}
 %% \CharacterTable
 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -30,7 +30,7 @@
 % \iffalse
 %%
 %% Source File: galois.dtx 
-%% Copyright 1994 1998 1999 Patrick.Cousot@ens.fr
+%% Copyright 1994 1998 1999 2006 Patrick.Cousot@ens.fr
 %%
 %
 %<*dtx>
@@ -50,13 +50,13 @@
 \DoNotIndex{\DoNotIndex,\NeedsTeXFormat,\ifx,\else,\fi,\ifdim,\fi,\endtrivlist}
 \DoNotIndex{\addtolength,\divide,\circ,\cleaders,\ensuremath}
 \DoNotIndex{\begin,\end,\bgroup,\egroup,\begingroup,\endgroup}
-\DoNotIndex{\catcode,\noexpand,\protect,\string,\space}
-\DoNotIndex{\filedate,\filename,\fileversion}
-\DoNotIndex{\hbox,\raisebox,\rlap,\llap,\rule,\smash}
-\DoNotIndex{\let,\def,\newcommand,\newenvironment}
+\DoNotIndex{\catcode,\noexpand,\protect,\string,\space,\put,\equiv}
+\DoNotIndex{\filedate,\filename,\fileversion,\ProcessOptions}
+\DoNotIndex{\hbox,\raisebox,\rlap,\llap,\relax,\rule,\smash}
+\DoNotIndex{\let,\def,\newcommand,\newenvironment,\DeclareOption}
 \DoNotIndex{\m@th,\mathchoice,\mathord,\mathrel,\max,\mkern,\newlength}
 \DoNotIndex{\setlength,\settodepth,\settoheight,\settowidth}
-\DoNotIndex{\tiny,\scriptstyle,\scriptscriptstyle}
+\DoNotIndex{\tiny,\scriptstyle,\scriptscriptstyle,\undefined}
 \DoNotIndex{\leftarrow,\rightarrow,\longleftarrow,\longrightarrow}
 \makeatother
 %
@@ -65,7 +65,7 @@
 \EnableCrossrefs
 \RecordChanges
 %
-\usepackage{galois}
+\usepackage[color]{galois}
 \begin{document}
 \DocInput{galois.dtx}
 \PrintIndex
@@ -78,22 +78,24 @@
        [\filedate\space v\fileversion, Galois connections, Patrick.Cousot@ens.fr]
 %
 %
-% \changes{v0.00}{1996/11/25}
+% \changes{v0.00}{1996/11/25}%
 %    {Initial version for LaTeX 2.09}
-% \changes{v1.00}{1997/05/19}
+% \changes{v1.00}{1997/05/19}%
 %    {Adapted to LaTeX2e}
-% \changes{v1.01}{1998/10/19}
+% \changes{v1.01}{1998/10/19}%
 %    {Check "\textbackslash comp" is not already defined (as in "mathtime.sty")}
-% \changes{v1.02}{1998/11/13}
+% \changes{v1.02}{1998/11/13}%
 %    {Rewritting of extendable arrows using the TeX book left/right arrowfill 
 %     p. 357. Added and renamed style parameters ("\textbackslash GaloisSep" now 
 %     "\textbackslash GaloisArrowTagSep")}
-% \changes{v1.03}{1999/04/02}
+% \changes{v1.03}{1999/04/02}%
 %    {Renamed internal macros to avoid interferences with other packages
 %     "\textbackslash rightarrowfill" $\rightarrow$ "\textbackslash @GALOISrightarrowfill"
 %     "\textbackslash leftarrowfill"  $\rightarrow$ "\textbackslash @GALOISleftarrowfill"}
-% \changes{v1.04}{1999/05/01}
+% \changes{v1.04}{1999/05/01}%
 %    {\LaTeX{} package file documentation}
+% \changes{v1.05}{2005/03/19}%
+%    {Added color option}
 %
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -164,7 +166,7 @@
 % \quad{\rm and}\quad
 % (M,\,{\sqsubseteq})\galois{\alpha_2}{\gamma_2}(N,\,{\preceq})
 % \end{displaymath}
-% is a Galois connection (the composition $\comp$ o functions is
+% is a Galois connection (the composition $\comp$ of functions is
 % |\comp|):
 % \DescribeMacro{\comp}
 % \begin{displaymath}
@@ -181,6 +183,39 @@
 % x:\varphi(x)\preceq\phi(x)$.  Observe that the length of the arrows
 % stretches automatically to the appropriate width.
 %
+% \section{Package options}
+%
+%  \begin{macro}{color}
+%  The \texttt{color} option is required for colored Galois
+%  connections is in 
+%     \begin{center}
+%        \begin{tabular}{cc}
+%          |\galois[red]{\alpha}{\gamma}| &
+%          $\galois[red]{\alpha}{\gamma}$,\\[1ex]
+%          |\Galois{\alpha}[blue]{\gamma}| &
+%          $\Galois{\alpha}[blue]{\gamma}$,\\[1ex]
+%          |\GaloiS[red]{\alpha}[blue]{\gamma}| &
+%          $\GaloiS[red]{\alpha}[blue]{\gamma}$,\\[1ex]
+%          |\galoiSr[red]{\alpha}[blue]{\gamma}| &
+%          $\galoiSr[red]{\alpha}[blue]{\gamma}$, or\\[1ex]
+%         |\comp[red]| & $\comp[red]$\ .
+%       \end{tabular}
+%    \end{center}
+%  Without '|color|' option, these colors are ignored.
+%  \begin{macro}{\@GALOIScolor}
+% |\@GALOIScolor| is |\color| with the |color| option and later
+% defined as |\relax| in absence of |color| option.
+%    \begin{macrocode}
+\DeclareOption{color}{%
+  \def\@GALOIScolor{\color}}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\ProcessOptions
+%    \end{macrocode}
+%  \end{macro}
+%  \end{macro}
+%
 % \section{Style parameters}
 % 
 % You can use Galois connections in any size (footnotes, transparencies, 
@@ -249,23 +284,39 @@
 %<*package>
 %    \end{macrocode}
 %
+% Require |color| package for '|color|' option else coloring is ignored.
+%    \begin{macrocode}
+\ifx\@GALOIScolor\undefined
+\def\@GALOIScolor#1{\relax}%
+\else
+\RequirePackage{color}%
+\fi
+%    \end{macrocode}
+%
 % ^^A Reset style parameters to default
 % \renewcommand{\GaloisStyle}{\scriptstyle}%
 % \renewcommand{\GaloisArrowThickness}{0.1ex}%
 % \renewcommand{\GaloisArrowsSep}{0.2ex}%
 % \renewcommand{\GaloisArrowTagSep}{0.5ex}% 
 % \begin{macro}{\comp}
+% \begin{macro}{\@GALOIScomp}
 % Define functional composition $f\comp g(x)$ is $f(g(x))$ (if not 
-% already defined e.g.\ as in |mathtime.sty|):
+% already defined e.g.\ as in |mathtime.sty|). |\comp[color]| will
+% draw in color (black by default).
 %    \begin{macrocode}
 \@ifundefined{comp}{%
-\newcommand{\comp}{\mathchoice{\mathrel{\raisebox{0.2ex}{$\scriptstyle\circ$}}}%
-{\mathrel{\raisebox{0.2ex}{$\scriptstyle\circ$}}}%
-{\mathrel{\raisebox{0.1ex}{$\scriptscriptstyle\circ$}}}%
-{\mathrel{\raisebox{0.1ex}{$\scriptscriptstyle\circ$}}}}%
+% Scan the optional color argument
+\newcommand{\comp}{\@ifnextchar[{\@GALOIScomp}{\@GALOIScomp[black]}}%
+% Defined the colored functional composition \@GALOIScomp[color]
+\def\@GALOIScomp[#1]{\mathchoice
+{\mathrel{\raisebox{0.2ex}{$\@GALOIScolor{#1}\scriptstyle\circ$}}}%
+{\mathrel{\raisebox{0.2ex}{$\@GALOIScolor{#1}\scriptstyle\circ$}}}%
+{\mathrel{\raisebox{0.1ex}{$\@GALOIScolor{#1}\scriptscriptstyle\circ$}}}%
+{\mathrel{\raisebox{0.1ex}{$\@GALOIScolor{#1}\scriptscriptstyle\circ$}}}}%
 }{}%
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % Style commands:
 % \begin{macro}{\GaloisStyle}
@@ -367,15 +418,32 @@
 %
 % Stacking $a$, the arrows and $g$ in $\galois{a}{g}$:
 % \begin{macro}{\@GALOIS}
-% |\@GALOIS{a}{g}{-->}{<--}| constructs $\galois{a}{g}$:
+% \begin{macro}{\@GALOISca}
+% \begin{macro}{\@GALOISca}
+% |\@GALOIS{-->}{<--}{a}{g}| constructs $\galois{a}{g}$.
+% |\@GALOIS{-->}{<--}[colora]{a}{g}|,
+% |\@GALOIS{-->}{<--}{a}[colorg]{g}| and
+% |\@GALOIS{-->}{<--}[colora]{a}[colorg]{g}|
+% add colors |colora| for the $a$-arrow and |colorg| for
+% the$ g$ arrow.
 %    \begin{macrocode}
-\def\@GALOIS#1#2#3#4{%
+%    First, scan the alpha color optional argument (black
+%    otherwise)
+\def\@GALOIS#1#2{\@ifnextchar[{\@GALOISca{#1}{#2}}{\@GALOISca{#1}{#2}[black]}}%
+%    Second scan the gamma color optional argument (black
+%    otherwise)
+\def\@GALOISca#1#2[#3]#4{\@ifnextchar[{\@GALOIScacg{#1}{#2}[#3]{#4}}%
+                                      {\@GALOIScacg{#1}{#2}[#3]{#4}[black]}}%
+%    Finally \@GALOIScacg{-->}{<--}[colora]{a}[colorg]{g} stacks $a$,
+%    the arrows and $g$ in $\galois{a}{g}$, using colors with the
+%    'color' option.
+\def\@GALOIScacg#1#2[#3]#4[#5]#6{%
 \ensuremath{\mathrel{%
-\def\@GALOISalphatag{\ $\GaloisStyle#1$\ }%
-\def\@GALOISgammatag{\ $\GaloisStyle#2$\ }%
+\def\@GALOISalphatag{\ $\@GALOIScolor{#3}\GaloisStyle#4$\ }%
+\def\@GALOISgammatag{\ $\@GALOIScolor{#5}\GaloisStyle#6$\ }%
 % compute width of alpha/lower and gamma/upper arrows
-\settowidth{\@GALOISalphaarrowwidth}{$\mathord{#3}$}%
-\settowidth{\@GALOISgammaarrowwidth}{$\mathord{#4}$}%
+\settowidth{\@GALOISalphaarrowwidth}{$\mathord{#1}$}%
+\settowidth{\@GALOISgammaarrowwidth}{$\mathord{#2}$}%
 % compute width of the picture \@GALOISwidth
 \ifdim\@GALOISalphaarrowwidth>\@GALOISgammaarrowwidth%
 \settowidth{\@tempdima}{\hbox{\hspace*{\@GALOISalphaarrowwidth}\@GALOISalphatag}}%
@@ -389,20 +457,23 @@
 \else%
 \setlength{\@GALOISwidth}{\@tempdimb}%
 \fi%
-\def\@GALOISrightarrow{\hbox to\@GALOISwidth{\@GALOISrightarrowfill{#3}}}%
-\def\@GALOISleftarrow{\hbox to\@GALOISwidth{\@GALOISleftarrowfill{#4}}}%
+\def\@GALOISrightarrow{\hbox to\@GALOISwidth
+{\@GALOIScolor{#3}\@GALOISrightarrowfill{#1}}}%
+\def\@GALOISleftarrow{\hbox to\@GALOISwidth
+{\@GALOIScolor{#5}\@GALOISleftarrowfill{#2}}}%
 % compute half height of alpha/lower arrow
-\settodepth{\@GALOISalphaarrowhalfheight}{$\mathord{#3}$}%
-\settoheight{\@tempdima}{$\mathord{#3}$}%
+\settodepth{\@GALOISalphaarrowhalfheight}{$\mathord{#1}$}%
+\settoheight{\@tempdima}{$\mathord{#1}$}%
 \addtolength{\@GALOISalphaarrowhalfheight}{\@tempdima}%
 \divide \@GALOISalphaarrowhalfheight by 2%
 % compute half height of gamma/upper arrow
-\settodepth{\@GALOISgammaarrowhalfheight}{$\mathord{#4}$}%
-\settoheight{\@tempdima}{$\mathord{#4}$}%
+\settodepth{\@GALOISgammaarrowhalfheight}{$\mathord{#2}$}%
+\settoheight{\@tempdima}{$\mathord{#2}$}%
 \addtolength{\@GALOISgammaarrowhalfheight}{\@tempdima}%
 \divide \@GALOISgammaarrowhalfheight by 2%
 % compute the distance between the two arrows \@GALOISGap = 
-%   \max(\@GALOISalphaarrowhalfheight,\@GALOISgammaarrowhalfheight)+\GaloisArrowsSep
+%   \max(\@GALOISalphaarrowhalfheight,
+%        \@GALOISgammaarrowhalfheight)+\GaloisArrowsSep
 \ifdim\@GALOISalphaarrowhalfheight>\@GALOISgammaarrowhalfheight%
 \setlength{\@GALOISGap}{\@GALOISalphaarrowhalfheight}%
 \else%
@@ -418,12 +489,14 @@
 \settoheight{\@GALOISalphaheight}{\@GALOISalphatag}%
 \settodepth{\@GALOISgammadepth}{\@GALOISgammatag}%
 % compute depth \@GALOISdepth of the picture
-% \@GALOISdepth = \@GALOISalphadepth+\@GALOISalphaheight % vertical size of alpha tag
-%               + \GaloisArrowTagSep                 % between top of tag and arrow 
+% \@GALOISdepth = \@GALOISalphadepth
+%               + \@GALOISalphaheight % vertical size of alpha tag
+%               + \GaloisArrowTagSep  % between top of tag and arrow 
 \setlength{\@GALOISdepth}{\@GALOISalphadepth}%
 \addtolength{\@GALOISdepth}{\@GALOISalphaheight}%
 \addtolength{\@GALOISdepth}{\GaloisArrowTagSep}%
-\addtolength{\@GALOISdepth}{-\GaloisArrowThickness }% lift from the stem thickness
+%  lift from the stem thickness
+\addtolength{\@GALOISdepth}{-\GaloisArrowThickness }%
 % compute height \@GALOISheight of the picture
 \setlength{\@GALOISheight}{\@GALOISGap}%
 \addtolength{\@GALOISheight}{\GaloisArrowTagSep}%
@@ -461,11 +534,13 @@
 }}}%
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\galois}
 % |\galois{a}{g}| is $\galois{a}{g}$.
 %    \begin{macrocode}
-\newcommand{\galois}[2]{\@GALOIS{#1}{#2}{\rightarrow}{\leftarrow}}%
+\newcommand{\galois}{\@GALOIS{\rightarrow}{\leftarrow}}%
 %    \end{macrocode}
 % \end{macro}
 %
@@ -475,7 +550,7 @@
 %    \begin{macrocode}
 \def\@GALOISmytwoheadrightarrow{\rlap{$\:\,{\rightarrow}$}{\longrightarrow}}%
 \def\@GALOIStwoheadrightarrow{\protect\@GALOISmytwoheadrightarrow}%
-\newcommand{\galoiS}[2]{\@GALOIS{#1}{#2}{\@GALOIStwoheadrightarrow}{\leftarrow}}%
+\newcommand{\galoiS}{\@GALOIS{\@GALOIStwoheadrightarrow}{\leftarrow}}%
 %    \end{macrocode}
 % \end{macro}
 %
@@ -485,7 +560,7 @@
 \def\@GALOISmytwoheadrightarrowreduc{\rlap{\smash{\hskip1ex\raisebox{0.815ex}%
 {\tiny$\equiv$}}}\rlap{$\:\,{\rightarrow}$}{\longrightarrow}}%
 \def\@GALOIStwoheadrightarrowreduc{\protect\@GALOISmytwoheadrightarrowreduc}%
-\newcommand{\galoiSr}[2]{\@GALOIS{#1}{#2}{\@GALOIStwoheadrightarrowreduc}{\leftarrow}}%
+\newcommand{\galoiSr}{\@GALOIS{\@GALOIStwoheadrightarrowreduc}{\leftarrow}}%
 %    \end{macrocode}
 % \end{macro}
 %
@@ -495,14 +570,14 @@
 %    \begin{macrocode}
 \def\@GALOISmytwoheadleftarrow{\rlap{$\:{\leftarrow}$}{\longleftarrow}}%
 \def\@GALOIStwoheadleftarrow{\protect\@GALOISmytwoheadleftarrow}%
-\newcommand{\Galois}[2]{\@GALOIS{#1}{#2}{\rightarrow}{\@GALOIStwoheadleftarrow}}%
+\newcommand{\Galois}{\@GALOIS{\rightarrow}{\@GALOIStwoheadleftarrow}}%
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\GaloiS}
 % |\GaloiS{a}{g}| is $\GaloiS{a}{g}$ ($a$ bijective with inverse $g$).
 %    \begin{macrocode}
-\newcommand{\GaloiS}[2]{\@GALOIS{#1}{#2}%
+\newcommand{\GaloiS}{\@GALOIS%
 {\@GALOIStwoheadrightarrow}{\@GALOISmytwoheadleftarrow}}%
 %    \end{macrocode}
 % \end{macro}
-- 
cgit v1.2.3

