summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-05-17 22:41:33 +0000
committerKarl Berry <karl@freefriends.org>2009-05-17 22:41:33 +0000
commit939b7004d3332442ca355c2916737e53d0e71df7 (patch)
tree17b79c4adcf2d74decb98146a3b75c8dd4c05ade /Master/texmf-dist/tex
parent249444f732b68d762005367d91ff6f4717d86301 (diff)
diagmac2 2.1 (16may09)
git-svn-id: svn://tug.org/texlive/trunk@13186 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/diagmac2/diagmac2.sty89
1 files changed, 86 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/latex/diagmac2/diagmac2.sty b/Master/texmf-dist/tex/latex/diagmac2/diagmac2.sty
index 6c99b11bc1b..5826312c1b0 100644
--- a/Master/texmf-dist/tex/latex/diagmac2/diagmac2.sty
+++ b/Master/texmf-dist/tex/latex/diagmac2/diagmac2.sty
@@ -1,14 +1,43 @@
+%% This is file 'diagmac2.sty'
+%%
+%% Copyright (C) 1997 J. C. Reynolds, john.reynolds@cs.cmu.edu
+%% 2004-09 R. D. Tennent, rdt@cs.queensu.ca
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "author-maintained".
+
%MACROS FOR DIAGRAMS - J. C. Reynolds - December 1987
-% Modified to use pict2e.sty by Bob Tennent, February 2004
+% Modified to use pict2e.sty by Bob Tennent
% Changes indicated thusly: %%%pict2e
+% Changelog:
+%
+% Version 2.1 May 2009
+%
+% Two extensions added: \drawedgebar and \ctec
+% User Manual TeXified and expanded
+%
+% Version 2.0 February 2004
+%
+% Modified to use pict2e.sty
+% Changes indicated thusly: %%%pict2e
+
+\ProvidesPackage{diagmac2}[2009/05/09 v2.1 LaTeX style for (category-theory) diagrams]
+
\AtBeginDocument{\RequirePackage{pict2e}} %%%pict2e
\def\slopemax{1000} %%%pict2e slope factor maximum
%This file contains general-purpose macros for drawing diagrams in LATEX,
%followed by additional macros especially for category-theory diagrams.
-%A user's manual is given in the file diagmac.doc, and a test program is
+%A user's manual is given in the file diagmac2.tex, and a test program is %%%pict2e
%given in the file diagmactest.tex.
%GENERAL-PURPOSE MACROS
@@ -20,7 +49,7 @@
\def\edgeheaddisp{4pt}
\def\circleheaddisp{2pt}
\def\diameterlist{1pt,2pt,3pt,4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,%
-12pt,13pt,14pt,15pt,16pt,20pt,24pt,28pt,32pt,36pt,40pt,}
+12pt,13pt,14pt,15pt,16pt,20pt,24pt,28pt,32pt,36pt,40pt,} %%%pict2e: not used
%Redefine if circle fonts are different.
%The following registers store the representation of diagram and/or
@@ -974,3 +1003,57 @@ WITH NO SHADOW}}
\def\cthead{\def\zzctdrawhead{\zzctdrawedgehead}}
\def\ctnohead{\def\zzctdrawhead{\zzctnodrawedgehead}}
+
+
+% Extensions by Bob Tennent (May 2009):
+%
+%\drawedgebar draws a bar across the end of the current edge.
+%
+\def\drawedgebar{\zzdrawedgebara\xend\yend\xstart\ystart{-\xslope}{-\yslope}}
+\def\zzdrawedgebara#1#2#3#4#5#6{\zzcheckedge{DRAW ARROWBAR FOR}
+\zzcheckslope{#5}{#6}4{ARROWBAR}
+\zzdmA=#3\advance\zzdmA by -#1
+\divide\zzdmA by 10\multiply\zzdmA by 100\divide\zzdmA by 10
+\zzdmB=#4\advance\zzdmB by -#2
+\divide\zzdmB by 10\multiply\zzdmB by 100\divide\zzdmB by 10
+\zzdistance{#5}{#6}\zzdmC=0pt
+\multiply\zzdmC by 100\divide\zzdmC by \zzglobalcnA\zzdmD=\zzdmC
+\multiply\zzdmC by #5\multiply\zzdmD by #6
+\advance\zzdmA by \zzdmC\advance\zzdmB by \zzdmD
+\advance\zzdmA by #1\zzcnA=\zzdmA\advance\zzdmB by #2\zzcnB=\zzdmB
+\zzmakepicture{\put(\zzcnA,\zzcnB){\line(#6,-#5){140000}}
+\zzrecordwidth\zzdmA\zzdmA\zztotheight=\zzdmB\zztotdepth=\zzdmB}
+\zzmakepicture{\put(\zzcnA,\zzcnB){\line(-#6,#5){140000}}
+\zzrecordwidth\zzdmA\zzdmA\zztotheight=\zzdmB\zztotdepth=\zzdmB}
+}
+
+% \ctec draws a bezier-curve edge from (#1,#2) to (#3,#4) using (#5,#6) as a
+% control point; the balanced math text #7 is centered at the control point
+%
+\def\ctec#1,#2,#3,#4,#5,#6:#7{
+\ctv #5,#6:{#7}
+% get and save \xstart,\ystart after shadowing
+\setedge#1,#2,#5,#6:
+\def\zzprocpoly{\zzcastpoly}\def\zzprocrorect{\zzprocrorecta}
+\zzdmA=\xstart\zzdmB=\ystart\zzcnA=\xslope\zzcnB=\yslope
+\zzstartshadow\xstart=\zzdmE\ystart=\zzdmF
+\zzdmH=\xstart\zzdmI=\ystart
+% get \xend, \yend and shadow
+\setedge#5,#6,#3,#4:
+\def\zzprocpoly{\zzcastpoly}\def\zzprocrorect{\zzprocrorecta}
+\zzdmA=\xend\zzdmB=\yend\zzcnA=-\xslope\zzcnB=-\yslope
+\zzendshadow\xend=\zzdmE\yend=\zzdmF
+% draw head
+\zzctdrawhead1
+% restore saved \xstart, \ystart
+\xstart=\zzdmH\ystart=\zzdmI
+% compute control-point parameters
+\zzcnA=#5\zzcnB=#6
+\zzmultdiagramunit\zzdmH\zzcnA\zzmultdiagramunit\zzdmI\zzcnB
+\zzcnA=\xstart\zzcnB=\ystart\zzcnC=\xend\zzcnD=\yend\zzcnE=\zzdmH\zzcnF=\zzdmI
+% draw bezier curve
+\zzmakepicture{\qbezier(\zzcnA,\zzcnB)(\zzcnE,\zzcnF)(\zzcnC,\zzcnD)
+\zzrecordwidth\xstart\xstart\zzrecordwidth\xend\xend
+\zztotheight=\ystart\zztotdepth=\ystart\zzrecordheight\yend\yend}}
+
+