%% xyweb.tex from $Id: xyweb.doc,v 3.7 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``Lattice and web'' feature.
%% Copyright (c) 1994-1996 Ross Moore <ross.moore@mq.edu.au>
%%
%% 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/.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{web}{Lattice and web feature}{\stripRCS$Revision: 3.7 $}%
 {Ross Moore}{ross.moore@mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\message{lattices,}
\xynew@{count}\lattice@A
\xynew@{count}\lattice@B
\xydef@\latticeA{\lattice@A}
\xydef@\latticeB{\lattice@B}
\xydef@\xylattice#1#2#3#4{\xy@{LATTICE}{\xylattice@{#1}{#2}{#3}{#4}}}%
\xydef@\xylattice@#1#2#3#4{%
 \lattice@A=#1\relax
 \loop \bgroup\lattice@B=#3\relax
 \innerlatticeloop@{#4}%
 \edef\tmp@{\egroup
 \X@min=\the\X@min \X@max=\the\X@max
 \Y@min=\the\Y@min \Y@max=\the\Y@max 
 }\tmp@ \ifnum\lattice@A<#2\relax \advance\lattice@A\@ne
 \repeat }
\xydef@\innerlatticeloop@#1{%
 \loop \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ \the\lattice@A,\the\lattice@B @%
 \edef\latticeX{\expandafter\removePT@\the\X@c}%
 \edef\latticeY{\expandafter\removePT@\the\Y@c}%
 \leave@ \latticebody \leave@
 \ifnum\lattice@B<#1\relax \advance\lattice@B\@ne
 \repeat }
\xydef@\croplattice#1#2#3#4#5#6#7#8{\xy@{LATTICE}%
 {\xycroplattice@{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}%
\xydef@\xycroplattice@#1#2#3#4#5#6#7#8{%
 \enter@{\X@min=\the\X@min \X@max=\the\X@max 
 \Y@min=\the\Y@min \Y@max=\the\Y@max}%
 \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ #5,0 @\leave@ \X@min=\X@c \leave@
 \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ #6,0 @\leave@ \X@max=\X@c \leave@
 \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ 0,#7 @\leave@ \Y@min=\Y@c \leave@
 \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ 0,#8 @\leave@ \Y@max=\Y@c \leave@
 \lattice@A=#1\relax
 \loop
 \bgroup\lattice@B=#3\relax
 \enter@{\cfromthec@}\innercroplatticeloop@{#4}\leave@
 \egroup
 \ifnum\lattice@A<#2\relax \advance\lattice@A\@ne
 \repeat \mergecropextents@ }
\xydef@\innercroplatticeloop@#1{%
 \loop 
 \enter@{\cfromthec@}\enter@{\cplusthec@}%
 \vfromcartesian@@ \the\lattice@A,\the\lattice@B @%
 \edef\latticeX{\expandafter\removePT@\the\X@c}%
 \edef\latticeY{\expandafter\removePT@\the\Y@c}%
 \leave@ \DN@{\latticebody}%
 \ifdim\X@c<\X@min\DN@{}%
 \else\ifdim\X@c>\X@max\DN@{}%
 \else\ifdim\Y@c<\Y@min\DN@{}%
 \else\ifdim\Y@c>\Y@max\DN@{}%
 \fi\fi\fi\fi \next@ \leave@
 \ifnum\lattice@B<#1\relax \advance\lattice@B\@ne
 \repeat }
\xydef@\mergecropextents@{%
 \edef\tmp@{%
 \noexpand\ifdim\X@min>\the\X@min \X@min=\the\X@min\noexpand\fi
 \noexpand\ifdim\X@max<\the\X@max \X@max=\the\X@max\noexpand\fi
 \noexpand\ifdim\Y@min>\the\Y@min \Y@min=\the\Y@min\noexpand\fi
 \noexpand\ifdim\Y@max<\the\Y@max \Y@max=\the\Y@max\noexpand\fi}%
 \leave@ \tmp@ }
\xydef@\deflatticebody@{\def\latticebody{\drop{\bullet}}}
\xydef@\defaultlatticebody{\deflatticebody@}
\deflatticebody@
\xyendinput
