summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xypic/xyemtex.tex
blob: d1a7e76da0bd9e213a951966f8891399b84e9563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%% xyemtex.tex from $Id: xyemtex.doc,v 3.7 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``em-TeX'' back-end extension.
%% Copyright (c) 1995-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{emtex}{em-TeX backend}{\stripRCS$Revision: 3.7 $}%
 {Ross Moore}{ross.moore@mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\xynew@{if}\ifEMspecials@
\xydef@\UseEMspecials{\EMspecials@true}
\xydef@\NoEMspecials{\EMspecials@false}
\xydef@\xyemtex@lineto{\xyEM@special{lineto}} 
\xydef@\xyemtex@moveto{\xyEM@special{moveto}} 
\xydef@\xyemtex@line#1{\xyEM@special{line #1}} 
\xydef@\xyemtex@point#1{\xyEM@special{point #1}} 
\xydef@\xyemtex@pen#1{\addtostyletoks@{\xyEM@special{linewidth #1}}}
{\catcode`:=12 \gdef\next#1{\special{em:#1}}}
\xylet@\xyEM@special=\next
{\catcode`:=12 \gdef\next#1{%
 \W@{EM:#1 (\the\X@p,\the\Y@p),(\the\X@c,\the\Y@c)}\special{em:#1}}}
\xylet@\xyEM@noisy=\next
\xydef@\NoisyEMTeX{\let\xyEM@special=\xyEM@noisy}
\xydef@\EMalternative@#1#2{%
\expandafter\global\expandafter\let\csname origxy#2@\endcsname=#1%
 \xdef#1{\noexpand\ifEMspecials@
 \noexpand\expandafter\expandafter\noexpand\csname xyemtex@#2@\endcsname
 \noexpand\else
 \noexpand\expandafter\expandafter\noexpand\csname origxy#2@\endcsname
 \noexpand\fi}}%
\xydef@\setupxyEMTeX@{\xywarning@{using em-TeX specials}%
 \EMalternative@{\solid@}{solid}%
 \EMalternative@{\splinesolid@}{splinesolid}%
 \let\setupxyEM@=\reloadxyEM@ 
 \activateEM@ }
\xydef@\xyunloadEM@{\xywarning@{EM specials turned off}%
 \xywithoption{line}{\xysetup@@\uninstallEMline@ }%
 \EMspecials@false
 \let\setupxyEM@=\reloadxyEM@ }
\xydef@\activateEM@{%
 \xywithoption{line}{\xysetup@@\installEMline@}%
 \EMspecials@true }
\xydef@\reloadxyEM@{\xywarning@{EM specials back on}\activateEM@ }
\xydef@\xyemtex@solid@{%
 \ifInvisible@ \let\next@=\no@@
 \else \DN@{\xyEMstraight@}\fi
 \next@ }
\xydef@\xyEMstraight@{\setupDirection@
 \edef\Creset@@{\cfromthec@ \pfromthep@ \DirectionfromtheDirection@}%
 \DN@##1##2{\def\checkoverlap@@{%
 \ifdim##1\X@p>##1\X@c \let\next@=\relax \fi
 \ifdim##2\Y@p>##2\Y@c \let\next@=\relax \fi}}%
 \edef\nextii@{{\sd@X}{\sd@Y}}\expandafter\next@\nextii@
 \noCshavep@@ \edef\Cshavep@@{\pfromthep@ \noexpand\resetDirection@}%
 \noCshavec@@ \edef\Cshavec@@{\cfromthec@ \noexpand\resetDirection@}%
 \ifHidden@\else
 \ifdim\Y@c>\Y@max \Y@max=\Y@c \fi \ifdim\Y@p>\Y@max \Y@max=\Y@p \fi
 \ifdim\Y@c<\Y@min \Y@min=\Y@c \fi \ifdim\Y@p<\Y@min \Y@min=\Y@p \fi
 \ifdim\X@c>\X@max \X@max=\X@c \fi \ifdim\X@p>\X@max \X@max=\X@p \fi
 \ifdim\X@c<\X@min \X@min=\X@c \fi \ifdim\X@p<\X@min \X@min=\X@p \fi \fi
 \ifInvisible@\let\next@=\relax \else
 \DN@{%
 \setboxz@h{\kern\X@p \raise\Y@p\hbox{\xyemtex@moveto}}%
 \ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@
 \setboxz@h{\boxz@ \kern\X@c \raise\Y@c\hbox{\xyemtex@lineto}}%
 \ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@ {\Drop@@}}%
 \fi 
 \checkoverlap@@
 \ifdim\d@X=\z@ \ifdim\d@Y=\z@ \DN@{\relax}\fi\fi \next@
 \def\Cslidep@@{\noCslidep@@}\def\Cslidec@@{\noCslidec@@}%
 \def\Calong@@{\noCalong@@}\Creset@@ }
\xydef@\xyemtex@splinesolid@{\setbox\splinebox@=\copy\voidb@x 
 \multiply\splinetol@\thr@@ 
 \gdef\splineextra@@{\xyemtex@moveto\gdef\splineextra@@{\xyemtex@lineto}}%
 \def\xycrvdrop@{ }\def\xycrvconn@{}\splineset@@ }
\xydef@\xyEMlinewidth@#1{\dimen@=#1\relax\edef\next@{\the\dimen@}}
\xydef@\installEMline@{%
 \let\xylinewidth@@=\xylinewidth@
 \let\xylineSpecial@@=\xyemtex@pen
 \let\transxyline@@=\xyEMlinewidth@ }
\xydef@\uninstallEMline@{\UnloadLine@\relax}%
\xydef@\UseEMlinewidth{\installEMline@}%
\xydef@\NoEMlinewidth{\uninstallEMline@}%
\xyendinput