diff options
Diffstat (limited to 'graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex')
-rw-r--r-- | graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex | 332 |
1 files changed, 9 insertions, 323 deletions
diff --git a/graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex b/graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex index d5bd965bba..3dee550dfd 100644 --- a/graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex +++ b/graphics/pstricks/contrib/pst-arrow/tex/pst-arrow.tex @@ -1,4 +1,4 @@ -%% $Id: pst-arrow.tex 136 2021-07-28 09:39:03Z herbert $ +%% $Id: pst-arrow.tex 164 2021-08-25 19:26:42Z herbert $ %% %% This is file `pst-arrow.tex', %% @@ -6,7 +6,7 @@ %% %% Package `pst-arrow.tex' %% -%% Herbert Voss <hvoss@tug.org> +%% Copyright 2021 Herbert Voss <hvoss@tug.org> %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -22,26 +22,14 @@ \ifx\PSTricksLoaded\endinput\else\input pstricks \fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi % -\def\fileversion{0.03} -\def\filedate{2021/07/28} +\def\fileversion{0.04} +\def\filedate{2021/08/25} \message{`pst-arrow' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax -\pst@addfams{pst-arrow} -% -\define@key[psset]{pst-arrow}{tipcolor}[black]{\def\pst@tipcolor{#1}} -\psset[pst-arrow]{tipcolor=} -\def\ps@check@tipcolor{% - \expandafter\if\expandafter$\pst@tipcolor$ - \pst@usecolor\pslinecolor - \else - \pst@usecolor\pst@tipcolor - \fi -} +\pst@addfams{pst-arrow} % -\def\tx@EndDot{ \ps@check@tipcolor\space EndDot } - \def\psBigArrow{\pst@object{psBigArrow}} \def\psBigArrow@i(#1)(#2){% \addbefore@par{doublesep=1cm} @@ -75,300 +63,9 @@ }% \end@ClosedObj } -% the original table -% \def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-],)-(,]-[,|>-<|} -% -% v : Vee arrow (inside) v,V,f and F by Christophe FOUREY -% V : Vee arrow (outside) -% f : Filled vee arrow (inside) -% F : Filled vee arrow (outside) -\edef\pst@arrowtable{\pst@arrowtable,v-v,V-V,f-f,F-F,t-t,T-T} - -% Vee arrow -\define@key[psset]{pst-arrow}{veearrowlength}[3mm]{\pst@getlength{#1}\psk@veearrowlength} -\psset[pst-arrow]{veearrowlength=3mm} % default projected length -\define@key[psset]{pst-arrow}{veearrowangle}[30]{\pst@getangle{#1}\psk@veearrowangle} -\psset[pst-arrow]{veearrowangle=30} % default angle -\define@key[psset]{pst-arrow}{veearrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@veearrowlinewidth} -\psset[pst-arrow]{veearrowlinewidth=0.35mm} % default vee arrow line width - -% Filled vee arrow -\define@key[psset]{pst-arrow}{filledveearrowlength}[3mm]{\pst@getlength{#1}\psk@filledveearrowlength} -\psset[pst-arrow]{filledveearrowlength=3mm} % default projected length -\define@key[psset]{pst-arrow}{filledveearrowangle}[15]{\pst@getangle{#1}\psk@filledveearrowangle} -\psset[pst-arrow]{filledveearrowangle=15} % default angle -\define@key[psset]{pst-arrow}{filledveearrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@filledveearrowlinewidth} -\psset[pst-arrow]{filledveearrowlinewidth=0.35mm} % default vee arrow line width -\define@key[psset]{pst-arrow}{arrowlinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psarrowlinestyle{#1}}} -\psset[pst-arrow]{arrowlinestyle=solid} % default -\pst@def{VeeArrow}<% - 1 setlinecap % round caps - 1 setlinejoin % round join - setlinewidth % vee arrow line width - /y ED % projected length - 2 div /a ED % angle (divide by 2) - /t ED % false = inside, true = outside - a sin a cos div y mul /x ED % perpendicular length : x=tan(a).y - t { 1 -1 scale } if % if outside : symmetry - x neg y moveto % point #1 - 0 0 L % point #2 - x y L % point #3 - { closepath gsave fill grestore } if % if filled : close and fill - \@nameuse{psls@\psarrowlinestyle} - \ps@check@tipcolor - stroke % draw line - 0 t { y 2 mul } { 0 } ifelse moveto> % if outside : twice longer line - -% VeeArrow : filled? outside? (total) angle (projected) length (arrow) line width - -\@namedef{psas@|}{\ps@check@tipcolor \psk@tbarsize \tx@Tbar} - -\@namedef{psas@v}{% - \ps@check@tipcolor - false false \psk@veearrowangle \psk@veearrowlength \psk@veearrowlinewidth \tx@VeeArrow} -\@namedef{psas@V}{% - \ps@check@tipcolor - false true \psk@veearrowangle \psk@veearrowlength \psk@veearrowlinewidth \tx@VeeArrow} -\@namedef{psas@f}{% - \ps@check@tipcolor - true false \psk@filledveearrowangle \psk@filledveearrowlength \psk@filledveearrowlinewidth \tx@VeeArrow} -\@namedef{psas@F}{% - \ps@check@tipcolor - true true \psk@filledveearrowangle \psk@filledveearrowlength \psk@filledveearrowlinewidth \tx@VeeArrow} - -% And An another arrowhead -% architectural tick / oblique arrow - -% Tick arrow -\define@key[psset]{pst-arrow}{tickarrowlength}[1.5mm]{\pst@getlength{#1}\psk@tickarrowlength} -\psset[pst-arrow]{tickarrowlength=1.5mm} % default projected length -\define@key[psset]{pst-arrow}{tickarrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@tickarrowlinewidth} -\psset[pst-arrow]{tickarrowlinewidth=0.35mm} % default tick arrow line width - -\pst@def{TickArrow}<% - 1 setlinecap % round caps - 1 setlinejoin % round join - setlinewidth % tick line width - /y ED % projected length - /t ED % false = normal, true = reversed - t { 1 -1 scale } if % if reversed : symmetry - y neg y moveto % point #1 - y y neg L % point #2 - \@nameuse{psls@\psarrowlinestyle} - \ps@check@tipcolor - stroke % draw line - 0 0 moveto> % origin - - -\@namedef{psas@t}{ \ps@check@tipcolor\space false \psk@tickarrowlength \psk@tickarrowlinewidth \tx@TickArrow } -\@namedef{psas@T}{ \ps@check@tipcolor\space true \psk@tickarrowlength \psk@tickarrowlinewidth \tx@TickArrow } - -\pst@def{ArrowD}< % the sides are drawn as curves (hv 20071211) - CLW mul add dup - 2 div /w ED - mul dup /h ED - mul /Inset ED - { 0 h T 1 -1 scale } if % changes the direction -% we use y=w/h^2 * x^2 as equation for the control points -% for the coordinates the arrow is seen from top to bottom -% the bottom (tip) is (0;0) - w neg h moveto % lower left of > - w 9 div 4 mul neg h 3 div 2 mul - w 9 div neg h 3 div - 0 0 curveto % tip of > - w 9 div h 3 div - w 9 div 4 mul h 3 div 2 mul - w h curveto % upper left of > - w neg Inset neg rlineto % move to x=0 and inset - gsave - \ps@check@tipcolor - fill grestore > -% -\pst@def{ArrowT}< % like tikz - CLW mul add dup - 2 div /w ED - mul dup /h ED - mul /Inset ED - { 0 h T 1 -1 scale } if % changes the direction - w 2 mul /w exch def - w neg h moveto % lower left of > - w 9 div 4 mul neg h 3 div 2 mul - w 9 div neg h 3 div - 0 0 curveto % tip of > - w 9 div h 3 div - w 9 div 4 mul h 3 div 2 mul - w h curveto % upper left of > -% w neg Inset neg rlineto % move to x=0 and inset -% CLW SLW -% 1 0 0 setrgbcolor - 2 setlinejoin - \ps@check@tipcolor - stroke - 0 0 moveto > -% -% -% HookLeft/RightArrow -\newdimen\pshooklength -\newdimen\pshookwidth -\define@key[psset]{pst-arrow}{hooklength}[3mm]{\pssetlength\pshooklength{#1}} -\define@key[psset]{pst-arrow}{hookwidth}[1mm]{\pssetlength\pshookwidth{#1}} -%\psset{hooklength=3mm,hookwidth=1mm} -% -\edef\pst@arrowtable{\pst@arrowtable,H-H,h-h} % add new arrow -\def\tx@RHook{RHook } % PostScript name -\def\tx@Rhook{Rhook } % PostScript name - -\@namedef{psas@H}{% - /RHook { - /x ED % hook width - /y ED % hook length - /z CLW 2 div def % save it - x y moveto % goto first point - x 0 0 0 0 y - curveto % draw Bezier - stroke - 0 y moveto % define current point - } def - \ps@check@tipcolor - \pst@number\pshooklength - \pst@number\pshookwidth - \tx@RHook -} -\@namedef{psas@h}{% - /Rhook { - CLW mul % size * CLW - add dup % +length size*CLW+length size*CLW+length - 2 div /w ED % (size*CLW+length)/2 -> w - mul dup /h ED mul % (size*CLW+length) - /a ED - w neg h abs moveto 0 0 L - gsave - \ps@check@tipcolor - stroke grestore - } def - 0 \psk@arrowlength \psk@arrowsize \tx@Rhook -} -% New parameter "arrowfill", with default as "true" -\define@boolkey[psset]{pst-arrow}[ps]{ArrowFill}[true]{} -% -% Modification of the PostScript macro Arrow to choose to fill or not the arrow -% (it require to restore the current linewidth, despite of the scaling) -\pst@def{Arrow}<{% - CLW mul add dup 2 div - /w ED mul dup - /h ED mul - /a ED { 0 h T 1 -1 scale } if - gsave - \ifpsArrowFill\else\pst@number\pslinewidth \pst@arrowscale\space div SLW \fi - \ps@check@tipcolor - w neg h moveto - 0 0 L w h L w neg a neg rlineto - \ifpsArrowFill gsave - \tx@setStrokeTransparency - fill - grestore \else gsave closepath - \ps@check@tipcolor - stroke grestore \fi - grestore - 0 h a sub moveto -}> -% -\define@key[psset]{pst-arrow}{nArrowsA}[2]{\def\psk@nArrowsA{#1}} -\define@key[psset]{pst-arrow}{nArrowsB}[2]{\def\psk@nArrowsB{#1}} -\define@key[psset]{pst-arrow}{nArrows}[2]{\def\psk@nArrowsA{#1}\def\psk@nArrowsB{#1}} -\psset{nArrows=2} -% -\@namedef{psas@>>}{% - \psk@nArrowsA\space 1 sub { - false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow - 0 h a sub T - } repeat - gsave - newpath - false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow - CP - grestore - moveto -} -% -\@namedef{psas@<<}{% - true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow - 0 h neg a add T - \psk@nArrowsB\space 2 sub { - false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow - 0 h neg a add T - } repeat - false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow - 0 h a 5 mul 2 div sub moveto -} -% -% DG addition begin - Dec. 18/19, 1997 and Oct. 11, 2002 -% Adapted from \psset@arrows -\define@key[psset]{pst-arrow}{ArrowInside}{% - \def\pst@tempArrow{#1}% - \ifx\pst@tempArrow\@empty \def\psk@ArrowInside{} % - \else% - \begingroup% - \pst@activearrows% - \xdef\pst@tempg{<#1}% - \endgroup% - \expandafter\psset@@ArrowInside\pst@tempg\@empty-\@empty\@nil% - \if@pst\else\@pstrickserr{Bad intermediate arrow specification: #1}\@ehpa\fi% - \fi% -} -% Adapted from \psset@@arrows -\def\psset@@ArrowInside#1-#2\@empty#3\@nil{% - \@psttrue - \def\next##1,#1-##2,##3\@nil{\def\pst@tempg{##2}}% - \expandafter\next\pst@arrowtable,#1-#1,\@nil - \@ifundefined{psas@#2}% - {\@pstfalse\def\psk@ArrowInside{}}% - {\def\psk@ArrowInside{#2}}% -} -% Default value empty -\psset{ArrowInside={}} -% Modified version of \pst@addarrowdef -\def\pst@addarrowdef{% - \addto@pscode{% - /ArrowA { - \ifx\psk@arrowA\@empty - \pst@oplineto - \else - \pst@arrowdef{A} - moveto - \fi - } def - /ArrowB { \ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi } def -% DG addition - /ArrowInside { - \ifx\psk@ArrowInside\@empty \else \pst@arrowdefA{Inside} \fi - } def - }% -} -% Adapted from \pst@arrowdef -\def\pst@arrowdefA#1{% - \ifnum\pst@repeatarrowsflag>\z@ /Arrow#1c [ 6 2 roll ] cvx def Arrow#1c\fi - \tx@BeginArrow - \psk@arrowscale - \@nameuse{psas@\@nameuse{psk@Arrow#1}} - \tx@EndArrow% -} -% ArrowInsidePos parameter (default value 0.5) -\define@key[psset]{pst-arrow}{ArrowInsidePos}[0.5]{\pst@checknum{#1}\psk@ArrowInsidePos}% -%\psset{ArrowInsidePos=0.5} -% -% -% Redefinition of the PostScript /Line macro to print the intermediate -% arrow on each segment of the line -% -\define@key[psset]{pst-arrow}{ArrowInsideNo}[1]{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001 -\define@key[psset]{pst-arrow}{ArrowInsideOffset}[0]{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001 -%\psset{ArrowInsideNo=1,ArrowInsideOffset=0} -% -\def\arrowType@H{H} +%% +%% Reqrite most of the existing macros +%% \pst@def{Line}< NArray n 0 eq not { n 1 eq { 0 0 /n 2 def } if (\psk@ArrowInside) length 0 gt { @@ -421,6 +118,7 @@ }{ ArrowA /n n 2 sub def n { Lineto } repeat } ifelse CP 4 2 roll ArrowB L pop pop } if > % + % Redefinition of the PostScript /Polygon macro to print the intermediate % arrow on each segment of the line \pst@def{Polygon}<{% @@ -678,18 +376,6 @@ /VPutPos { { VPutLines } HPutCurve } def }> % - -\def\resetArrowOptions{% - \def\pst@linetype{0}% - \psset[pst-arrow]{% - hooklength=3mm, hookwidth=1mm, - ArrowFill=true, - ArrowInside={}, ArrowInsidePos=0.5, - ArrowInsideNo=1, ArrowInsideOffset=0, -}} -% -\resetArrowOptions -% \catcode`\@=\PstAtCode\relax % %% END: pst-arrow.tex |