arrows in the middle of bezier curves

Denis Girou Denis.Girou at
Thu Dec 18 22:31:48 CET 1997

This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.

  Here is my own (limited) attempt - unfortunately the code posted
by Tamas Bori <bori at> is too difficult for me to understand...
It work only for \psline for the moment, but I'm pretty sure than it can be
extended this way to other kinds of curves.

  I add two new parameters ArrowInside and ArrowInsidePos. The first define
the arrow to print inside each segment of the line and the second the position 
of it in the segment (it must be a number between 0 and 1, with 0.5 as default 
value). The arrow itself is one of those defined, beginning each time by the
- character.

  See the examples below after the \begin{document} line.







% DG addition begin - Dec. 18, 1997

% Adapted from \psset at arrows
\def\psset at ArrowInside#1{%
\pst at activearrows
\xdef\pst at tempg{<#1}%
\expandafter\psset@@ArrowInside\pst at tempg\@empty-\@empty\@nil
\if at pst\else
\@pstrickserr{Bad intermediate arrow specification: #1}\@ehpa

% Adapted from \psset@@arrows
\def\next##1,#1-##2,##3\@nil{\def\pst at tempg{##2}}%
\expandafter\next\pst at arrowtable,#1-#1,\@nil
{\@pstfalse\def\psk at ArrowInside{}}%
{\def\psk at ArrowInside{#2}}}
\def\psk at ArrowInside{}

% Modified version of \pst at addarrowdef
\def\pst at addarrowdef{%
\addto at pscode{%
/ArrowA {
\ifx\psk at arrowA\@empty
\pst at oplineto
\pst at arrowdef{A}
} def
/ArrowB {
\ifx\psk at arrowB\@empty \else \pst at arrowdef{B} \fi
} def
% DG addition
/ArrowInside {\ifx\psk at ArrowInside\@empty \else \pst at arrowdefA{Inside} \fi} def

% Adapted from \pst at arrowdef
\def\pst at arrowdefA#1{%
\ifnum\pst at repeatarrowsflag>\z@
/Arrow#1c [ 6 2 roll ] cvx def Arrow#1c
\tx at BeginArrow
\psk at arrowscale
\@nameuse{psas@\@nameuse{psk at Arrow#1}}
\tx at EndArrow}

% ArrowInsidePos parameter
\def\psset at ArrowInsidePos#1{\pst at checknum{#1}\psk at ArrowInsidePos}%
\psset at ArrowInsidePos{0.5}

% Redefinition of the PostScript /Line macro to print the intermediate arrow
% on each segment of the line
\pst at def{Line}<{%
n 0 eq not
  { n 1 eq { 0 0 /n 2 def } if
    2 copy
    /y1 ED
    /x1 ED
    x1 y1
    /n n 1 sub def
    n { 4 copy
        /y1 ED
        /x1 ED
        /y2 ED
        /x2 ED
        /aposx x2 x1 sub \psk at ArrowInsidePos mul x1 add def
        /aposy y2 y1 sub \psk at ArrowInsidePos mul y1 add def
        x1 y1 aposx aposy ArrowInside pop pop pop pop Lineto
      } repeat
    CP 4 2 roll ArrowB L pop pop } if}>

% DG addition end
















The list interface (subscription, information, access to the archives) is on:
Otherway to unsubscribe, send mail to pstricks-request at
with a blank subject and in body the line unsubscribe <email-address>

More information about the PSTricks mailing list