summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pb-diagram/pb-lams.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/pb-diagram/pb-lams.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/pb-diagram/pb-lams.sty')
-rw-r--r--macros/latex/contrib/pb-diagram/pb-lams.sty142
1 files changed, 142 insertions, 0 deletions
diff --git a/macros/latex/contrib/pb-diagram/pb-lams.sty b/macros/latex/contrib/pb-diagram/pb-lams.sty
new file mode 100644
index 0000000000..33d802966f
--- /dev/null
+++ b/macros/latex/contrib/pb-diagram/pb-lams.sty
@@ -0,0 +1,142 @@
+% pb-lams.sty: LAMS-TeX font enhancements for pb-diagram.sty
+% Author: Paul Burchard <burchard@pobox.com>
+% Version Number: 5.0
+% Version Date: 20 Oct 1998
+%
+% Copyright (c) 1997, 1998 by Paul Burchard
+%
+% This program 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.
+%
+% This program 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 program; if not, write to the Free Software
+% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%
+% This style file should be loaded *AFTER* pb-diagram.sty and
+% lamsarrow.sty. It should be loaded as follows:
+% \usepackage{pb-diagram,lamsarrow,pb-lams}
+%
+% This code adds to the "diagram" environment the use of
+% fancy arrow heads and tails, as well as additional arrow
+% directions. Most of the options defined here can be
+% combined arbitrarily.
+%
+
+\@ifundefined{diagram}{%
+ \@latexerr{The pb-lams style option requires pb-diagram}%
+ {You must include the pb-diagram package prior to pb-lams.}}{}
+\@ifundefined{lamsvector}{%
+ \@latexerr{The pb-lams style option requires lamsarrow}%
+ {You must include the lamsarrow package prior to pb-lams.}}{}
+
+\newif\ifdg@LATEXGEOM \dg@LATEXGEOMfalse
+
+\@namedef{dgo@}{%
+ \let\dg@VECTOR=\lamsvector
+ \lamsshaft{?}\lamssource{?}\lamstarget{?}%
+ \dg@LBLPOS=\dgARROWPARTS \divide\dg@LBLPOS\tw@\relax}%
+\@namedef{dgo@..}{\lamsshaft{.}}%
+\@namedef{dgo@<>}{\lamssource{^}\lamstarget{^}}%
+\@namedef{dgo@=}{\lamsshaft{=}}%
+\@namedef{dgo@-}{\lamstarget{0}}%
+\@namedef{dgo@'}{\lamstarget{'}}%
+\@namedef{dgo@`}{\lamstarget{`}}%
+\@namedef{dgo@A}{\lamstarget{A}}%
+\@namedef{dgo@V}{\lamssource{V}}%
+\@namedef{dgo@J}{\lamssource{J}}%
+\@namedef{dgo@L}{\lamssource{L}}%
+\@namedef{dgo@S}{\lamssource{S}}%
+%
+% approximate aspect ratio by half-integer betw 1/2 and 3
+% (or betw 1/2 and 2 if 3:1 arrow detected)
+%
+\def\dggeometry{
+ \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
+ \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
+ \else \divide\dg@ZTEMP\dg@YGRID \fi
+ % font limit cutoffs
+ \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
+ \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\fi
+ \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
+ \unitlength=1sp\relax
+ \ifnum\dg@ZTEMP<\tw@
+ % round aspect ratio up toward 2:2, widen rect
+ \advance\dg@ZTEMP\@ne
+ \multiply\unitlength\dg@YGRID
+ \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
+ \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
+ \divide\unitlength\dg@YGRID
+ \else
+ % round aspect ratio down toward 2:2, tallen rect
+ \multiply\unitlength\dg@XGRID
+ \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
+ \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
+ \divide\unitlength\dg@XGRID
+ \fi
+ \divide\unitlength\@m\relax
+ \dg@LATEXGEOMfalse}
+%
+% Bugwards-compatibility mode for versions 3.6 and earlier.
+% Enable it with \let\dggeometry=\dgoldgeometry
+%
+\def\dgoldgeometry{
+ \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
+ \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
+ \else \divide\dg@ZTEMP\dg@YGRID \fi
+ % font limit cutoffs
+ \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
+ \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\fi
+ \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
+ % The following calculation is garbled!
+ \unitlength=2sp\relax
+ \ifnum\dg@ZTEMP<\tw@
+ % round aspect ratio up toward 2:2, widen rect
+ \advance\dg@ZTEMP\@ne
+ \multiply\unitlength\dg@YGRID \divide\unitlength\tw@
+ \else
+ % round aspect ratio down toward 2:2, tallen rect
+ \multiply\unitlength\dg@XGRID \divide\unitlength\dg@ZTEMP
+ \fi
+ \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
+ \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
+ \divide\unitlength\dg@YGRID \divide\unitlength\@m
+ \dg@LATEXGEOMfalse}
+%
+% new directions
+\def\dgt@nee{\dg@DX=\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
+\def\dgt@see{\dg@DX=\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
+\def\dgt@nww{\dg@DX=-\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
+\def\dgt@sww{\dg@DX=-\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
+\def\dgt@nnne{\dg@DX=\@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
+\def\dgt@nnnw{\dg@DX=\m@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
+\def\dgt@sssw{\dg@DX=\m@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
+\def\dgt@ssse{\dg@DX=\@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
+\def\dgt@nnnee{\dg@DX=\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
+\def\dgt@nnnww{\dg@DX=-\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
+\def\dgt@sssww{\dg@DX=-\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
+\def\dgt@sssee{\dg@DX=\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
+%
+% these are only drawn approx correct in some aspect ratios:
+\def\dgt@nneee{\dg@DX=\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
+\def\dgt@nnwww{\dg@DX=-\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
+\def\dgt@sswww{\dg@DX=-\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
+\def\dgt@sseee{\dg@DX=\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
+%
+% these only work with LaTeX-compatible aspect ratios:
+% must set this globally to see it later!!!
+\def\dgt@neee{\dg@DX=\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
+ \global\dg@LATEXGEOMtrue}%
+\def\dgt@nwww{\dg@DX=-\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
+ \global\dg@LATEXGEOMtrue}%
+\def\dgt@swww{\dg@DX=-\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
+ \global\dg@LATEXGEOMtrue}%
+\def\dgt@seee{\dg@DX=\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
+ \global\dg@LATEXGEOMtrue}%
+