%% xyline.tex from $Id: xyline.doc,v 3.3 1996/12/18 09:22:29 ross Exp $ %% %% Xy-pic ``Line Width'' extension. %% Copyright (c) 1993-1996 Ross Moore %% %% 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-1996 Kristoffer H. Rose %% %% 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, write to the Free Software Foundation, Inc., %% 675 Mass Ave, Cambridge, MA 02139, USA. %% \ifx\xyloaded\undefined \input xy \fi \xyprovide{line}{Line styles extension}{\stripRCS$Revision: 3.3 $}% {Ross Moore}{ross@mpce.mq.edu.au}% {Mathematics Department, Macquarie University, NSW~2109, Australia} \xydefcsname@{*stylechar@|@}#1{\xyFN@\xywidthchar@#1@@}% \xydefcsname@{style [thinner]}{\xyshape@thinner@} \xydefcsname@{style [thicker]}{\xyshape@thicker@} \xynew@{dimen}\xylinethick@ \xylinethick@=\xydashw@ \xydef@\xyshape@thicker@{\xylinewidth@i{\multiply\xylinethick@\tw@}} \xydef@\xyshape@thinner@{\xylinewidth@i{\divide\xylinethick@\tw@}} \xydef@\xylinewidth@i#1{\edef\xyprevwidth@@{\the\xylinethick@}% #1\edef\next@{\xylinethick@=\the\xylinethick@}% \expandafter\addtotoks@\expandafter{% \expandafter\xylinewidth@@\expandafter{\next@}}} \xydef@\xywidthchar@{% \ifx \space@\next \expandafter\DN@\space{\xyFN@\xywidthchar@}% \else\ifx @\next \DN@ @@{\checkXyStyle@}% \else\ifx (\next \DN@ (##1)##2@@{% \xylinewidth@i{\xylinethick@=##1\xydashw@}}% \else\addLT@\ifx \next \addGT@{\addLT@\DN@ ##1}##2@@{% \xylinewidth@i{\xylinethick@=##1\relax}}% \else\ifx *\next \DN@ *@@{\recoverXyStyle@}% \else\addEQ@\ifx \next \addEQ@\DN@##1@@{\checkXyStyle@ \addtotoks@{\xynamestyle@{##1}}}% \else\ifx C\next \DN@ C##1@@{\xysetlinecap@{##1}@}% \else\ifx J\next \DN@ J##1@@{\xysetlinejoin@{##1}@}% \else\ifx M\next \DN@ M(##1)@@{\xymiterlimit@{##1}@}% \else \DN@##1@@{\xylinewidth@i{\xylinethick@=##1\relax}}% \fi\fi\fi\fi\fi\fi\fi\fi\fi \next@} \xydef@\xylinecap@{2} \xydef@\xylinejoin@{2} \xydef@\xylinemiter@{10} \xydefcsname@{style [bevel]}{\xyshape@bevel@} \xydefcsname@{style [roundjoin]}{\xyshape@rdjoin@} \xydefcsname@{style [miter]}{\xyshape@miter@} \xydefcsname@{style [butt]}{\xyshape@butt@} \xydefcsname@{style [roundcap]}{\xyshape@rdcap@} \xydefcsname@{style [projcap]}{\xyshape@projcap@} \xydef@\xyshape@butt@{\xysetlinecap@@0} \xydef@\xyshape@rdcap@{\xysetlinecap@@1} \xydef@\xyshape@projcap@{\xysetlinecap@@2} \xydef@\xyshape@miter@{\xysetlinejoin@@0} \xydef@\xyshape@rdjoin@{\xysetlinejoin@@1} \xydef@\xyshape@bevel@{\xysetlinejoin@@2} \xydef@\xysetlinecap@#1@{\DN@ii{#1}\count@=#1\relax \expandafter\DN@\expandafter{\the\count@}% \ifx\next@\next@ii\else \xywarning@{ignoring extra tokens in line-cap: \next@}\fi \expandafter\xysetlinecap@@\expandafter{\next@}} \xydef@\xysetlinejoin@#1@{\DN@ii{#1}\count@=#1\relax \expandafter\DN@\expandafter{\the\count@}% \ifx\next@\next@ii\else \xywarning@{ignoring extra tokens in line-join: \next@}\fi \expandafter\xysetlinejoin@@\expandafter{\next@}} \xydef@\xysetmiterlimit@#1@{\DN@ii{#1}\dimen@=#1\p@\relax \edef\next@{\expandafter\removePT@\the\dimen@}% \ifx\next@\next@ii\else \xywarning@{ignoring extra tokens in miter-limit: \next@}\fi \expandafter\xysetmiterlimit@@\expandafter{\next@}} \xydef@\xysetlinecap@@#1{\xy@linecap@i{\def\xylinecap@{#1}}} \xydef@\xysetlinejoin@@#1{\xy@linejoin@i{\def\xylinejoin@{#1}}} \xydef@\xysetmiterlimit@@#1{% \xy@linemiter@i{\def\xylinemiter@{#1}}} \xydef@\xy@linecap@i#1{#1\addtotoks@{\xy@linecap@@{#1}}} \xydef@\xy@linejoin@i#1{#1\addtotoks@{\xy@linejoin@{#1}}} \xydef@\xy@linemiter@i#1{#1\addtotoks@{\xy@linemiter@{#1}}} \xydef@\xy@linecap@#1{\checkXyStyle@ \edef\xyprevcap@@{\xylinecap@}% #1\let\prexylinecap@=\prexylinecap@@ \let\postxylinecap@=\postxylinecap@@ \applyLIFOstyle@\prexylinecap@{\xylinecap@}% \postxylinecap@{\xyprevcap@@}} \xydef@\prexylinecap@@{\let\prexylinecap@=\eat@ \let\postxylinecap@=\postxylinecap@@ \outputxylinecap@ } \xydef@\postxylinecap@@{\let\postxylinecap@=\eat@ \let\prexylinecap@=\prexylinecap@@ \resetxylinecap@@ } \xylet@\prexylinecap@=\prexylinecap@@ \xylet@\postxylinecap@=\postxylinecap@@ \xydef@\outputxylinecap@#1{\xycapSpecial@@{#1}} \xydef@\resetxylinecap@#1{\resetxylinecap@i{#1}\outputxylinecap@{#1}} \xydef@\resetxylinecap@i#1{\def\xylinecap@{#1}} \xylet@\resetxylinecap@@=\resetxylinecap@ \xylet@\xycapSpecial@@=\eat@ \xydef@\xy@linejoin@#1{\checkXyStyle@ \edef\xyprevjoin@@{\xylinejoin@}#1% \let\prexylinejoin@=\prexylinejoin@@ \let\postxylinejoin@=\postxylinejoin@@ \applyLIFOstyle@\prexylinejoin@{\xylinejoin@}% \postxylinecap@{\xyprevjoin@@}} \xydef@\prexylinejoin@@{\let\prexylinejoin@=\eat@ \let\postxylinejoin@=\postxylinejoin@@ \outputxylinejoin@ } \xydef@\postxylinejoin@@{\let\postxylinejoin@=\eat@ \let\prexylinejoin@=\prexylinejoin@@ \resetxylinejoin@@ } \xylet@\prexylinejoin@=\prexylinejoin@@ \xylet@\postxylinejoin@=\postxylinejoin@@ \xydef@\outputxylinejoin@#1{\xyjoinSpecial@@{#1}} \xydef@\resetxylinejoin@#1{\resetxylinejoin@i{#1}\outputxylinejoin@{#1}} \xydef@\resetxylinejoin@i#1{\def\xylinejoin@{#1}} \xylet@\resetxylinejoin@@=\resetxylinejoin@ \xylet@\xyjoinSpecial@@=\eat@ \xydef@\xy@linemiter@#1{\checkXyStyle@ \edef\xyprevmiter@@{\xylinemiter@}#1% \let\prexylinemiter@=\prexylinemiter@@ \let\postxylinemiter@=\postxylinemiter@@ \applyLIFOstyle@\prexylinemiter@{\xylinemiter@}% \postxylinecap@{\xyprevmiter@@}} \xydef@\prexylinemiter@@{\let\prexylinemiter@=\eat@ \let\postxylinemiter@=\postxylinemiter@@ \outputxylinemiter@ } \xydef@\postxylinemiter@@{\let\postxylinemiter@=\eat@ \let\prexylinemiter@=\prexylinemiter@@ \resetxylinemiter@@ } \xylet@\prexylinemiter@=\prexylinemiter@@ \xylet@\postxylinemiter@=\postxylinemiter@@ \xydef@\outputxylinemiter@#1{\xymiterSpecial@@{#1}} \xydef@\resetxylinemiter@#1{\resetxylinemiter@i{#1}\outputxylinemiter@{#1}} \xydef@\resetxylinemiter@i#1{\def\xylinemiter@{#1}} \xylet@\resetxylinemiter@@=\resetxylinemiter@ \xylet@\xymiterSpecial@@=\eat@ \xydef@\xypolyline#1{\xypolyline@{#1}} \xydef@\xypolyline@#1{\hbox\bgroup \enter@{\pfromthep@ \basefromthebase@ \cfromthec@}% \def\xyps@list{}\edef\smapp@@{\s@bot}% \smapxy@i{\enter@{\pfromthep@ \basefromthebase@ }% \edef\xyps@list{\expandafter\removePT@\the\X@c\space \expandafter\removePT@\the\Y@c\space \xyps@list}\leave@}% \leave@ \xy@polystyle@@{#1}\xydopoly@style\egroup \def\Drop@@{\styledboxz@}\def\Connect@@{\styledboxz@}}% \xylet@\xypolyline@Special=\eat@ \xylet@\xypolyfill@Special=\eat@ \xylet@\xypolyeofill@Special=\eat@ \xylet@\xypolydot@Special=\eat@ \xylet@\xypolydash@Special=\eat@ \xydef@\UnloadpolySpecials@{% \let\xypolyline@Special=\eat@ \let\xypolyfill@Special=\eat@ \let\xypolyeofill@Special=\eat@ \let\xypolydot@Special=\eat@ \let\xypolydash@Special=\eat@ } \xydef@\xy@polystyle@#1{% \let\poly@style@@=\xypolyline@Special \DNii@{#1}\ifx\nextii@\empty \else\DN@{*}\ifx\next@\nextii@ \let\poly@style@@=\xypolyfill@Special \else\DN@{?}\ifx\next@\nextii@ \let\poly@style@@=\xypolyeofill@Special \else\expandafter\DN@\expandafter{\addDOT@{}}\ifx\next@\nextii@ \let\poly@style@@=\xypolydot@Special \else\expandafter\DN@\expandafter{\addDASH@{}}\ifx\next@\nextii@ \let\poly@style@@=\xypolydash@Special \else\DN@{{*}}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{*}}% \else \def\poly@style@@{\xypolystraight@{#1}}% \fi\fi\fi\fi\fi\fi } \xydef@\xydopoly@style{\expandafter\poly@style@@\expandafter{\xyps@list}} \xydef@\xynopolystyle@#1#2{\xyundefinedLine@{polyline}{{#1}}@@} \xydef@\xypolynospec@#1{\DNii@{#1}% \ifx\nextii@\empty\def\poly@style@@{\xypolystraight@{-}}% \else\DN@{.}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}% \else\DN@{-}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{--}}% \else\DN@{*}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}% \else\DN@{?}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}% \else\DN@{{*}}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{*}}% \else \def\poly@style@@{\xypolystraight@{#1}}% \fi\fi\fi\fi\fi\fi } \xydef@\xypolystraight@#1#2{% \enter@{\pfromthep@ \basefromthebase@ \cfromthec@}% \edef\smapp@@{\s@bot}\csname S@0\endcsname\czeroEdge@\pfromc@\def\smapp@@{0}% \smapxy@i{\czeroEdge@\enter@{\pfromthec@}{\connect@\dir{#1}}\leave@}\leave@ } \xylet@\xy@polystyle@@=\xypolynospec@ \xydef@\UninstallPolylines@{% \UnloadpolySpecials@ \let\xy@polystyle@@=\xypolynospec@ } \UninstallPolylines@ \xydef@\xyundefinedLine@#1#2@@{% \xywarning@{The #1 #2 effect is not implemented with the current driver.}}% \xydef@\xynolinewidth@#1{% \xyundefinedLine@{linewidth}{\the\xylinethick@}@@}% \xydef@\xynolinecap@#1{\xyundefinedLine@{linecap}{\xylinecap@}@@}% \xydef@\xynolinejoin@#1{\xyundefinedLine@{linejoin}{\xylinejoin@}@@}% \xydef@\xynolinemiter@#1{\xyundefinedLine@{miterlimit}{\xylinemiter@}@@}% \xylet@\xylinewidth@@=\xynolinewidth@ \xylet@\xy@linecap@@=\xynolinecap@ \xylet@\xy@linejoin@@=\xynolinejoin@ \xylet@\xy@linemiter@@=\xynolinemiter@ \xydef@\UnloadLine@#1{% \ifx#1\relax\else\xyunload@{line width extension}\fi \let\resetxyline@@=\resetxyline@ \let\resetxylinecap@@=\resetxylinecap@ \let\resetxylinejoin@@=\resetxylinejoin@ \let\resetxylinemiter@@=\resetxylinemiter@ \let\transxyline@@=\DN@ \let\xylineSpecial@@=\eat@ \let\xycapSpecial@@=\eat@ \let\xyjoinSpecial@@=\eat@ \let\xymiterSpecial@@=\eat@ \let\xylinewidth@@=\xynolinewidth@ \let\xy@linecap@@=\xynolinecap@ \let\xy@linejoin@@=\xynolinejoin@ \let\xy@linemiter@@=\xynolinemiter@ \UninstallPolylines@ } \xyaddunsupport{line}{\UnloadLine@\relax} \xydef@\xylinewidth@#1{\checkXyStyle@ #1\let\prexyline@=\prexyline@@ \let\postxyline@=\postxyline@@ \applyLIFOstyle@\prexyline@{\the\xylinethick@}\postxyline@{\xyprevwidth@@}} \xydef@\prexyline@@{\let\prexyline@=\eat@ \let\postxyline@=\postxyline@@ \outputxyline@ } \xydef@\postxyline@@{\let\postxyline@=\eat@ \let\prexyline@=\prexyline@@ \resetxyline@@ } \xylet@\prexyline@=\prexyline@@ \xylet@\postxyline@=\postxyline@@ \xydef@\resetxyline@#1{\resetxyline@i{#1}\outputxyline@{#1}} \xydef@\resetxyline@i#1{\xylinethick@=#1\relax} \xydef@\outputxyline@#1{\transxyline@@{#1}% \expandafter\xylineSpecial@@\expandafter{\next@}} \xylet@\resetxyline@@=\resetxyline@ \xydef@\transxyline@#1{\edef\next@{\removePT@#1}} \xylet@\transxyline@@=\DN@ \xylet@\xylineSpecial@@=\eat@ \xyendinput