arrows in the middle of bezier curves

Tamas Bori bori at
Wed Dec 10 13:44:51 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.


Denis Girou wrote:
>     Paulo.Abreu> There is, however, a small feature that I miss a lot:
>     Paulo.Abreu> the ability to put an arrow automaticaly in the
> middle
>     Paulo.Abreu> of a curve.
>   It's clear that this possibility is not currently offered, as
> opposite to
> Xy-pic or MetaPost for instance. Alternate methods must be found
> according to
> the different cases.

I've made some extensions to the PSTricks macro package before
(eg. using points of intersection of circles and lines as coordinate,
some other fillstyles and linestyles and corresponding other
pssets too, the poosibility to use the arrows ]-[, )-( etc.)
and an arrows linestyle too, but that works not,
how it intended to. I'm not an PostScript guru, so I wonder,
if somebody can investigate this...

The problem is, that this code seems to be device-specific,
the output is non-deterministic expect for the same device/resolution,
and there looks very ugly too ... Can you explain, why?

% linestyle=Arrows ;  Arrowsep=<dim> <num>
\def\next{\input pstricks.tex}\expandafter\next
\def\psset at Arrowsep#1{%
\pst at expandafter\pst at getdimnum{#1} {} {} {}\@nil
\edef\psk at Arrowsep{\pst at number\pst at dimg \pst at tempg\space
\psk at arrowsize\space
currentlinewidth mul add \psk at arrowlength\space mul mul add }}
\psset at Arrowsep{5mm 1}
\def\psls at Arrows{tx at TomiDict begin
\psk at arrowinset\space \psk at arrowsize\space \psk at arrowlength\space
\psk at Arrowsep\space \pst at linetype\space \tx at ArrowLine end }%
\def\tx at ArrowLine{ArrowLine }

And some code for this, derivated from the bluebook program 11
putting characters on a (flattened)path (or from the PostScript
That's somewhat very ugly, and shows much from my
PostScript-incompetency ;(
and perhaps it schouldn't even work...
So, I've made a file containing the following code (among
It should be placed among the other PSTricks .pro and .lpro files.
/tx at TomiDict 60 dict def tx at TomiDict begin
/ArrowLine { %
/AsP exch def
/ArrowWidtH exch def
/ArroWSizE exch def
/ArroWSiZe exch def
/ArroWWidtH ArroWSizE currentlinewidth mul ArroWSiZe add ArrowWidtH mul
/ArroWInseT exch def
/pathdist 0 def
/setdist 0 def
/ovr 0 def
/movetoProc { %
/newy exch def /newx exch def /firstx newx def /firsty newy def /ovr 0
newx newy transform /cpy exch def /cpx exch def } def
/linetoProc { %
/oldx newx def /oldy newy def /newy exch def /newx exch def
/dx newx oldx sub def /dy newy oldy sub def
/dist dx dup mul dy dup mul add sqrt def
dist 0 ne {/dsx dx dist div ovr mul def /dsy dy dist div ovr mul def
oldx dsx add oldy dsy add transform
/cpy exch def /cpx exch def /pathdist pathdist dist add AsP 5 div sub
{ setdist AsP 5 div add
pathdist le { gsave cpx cpy itransform
dy dx atan sin ArroWWidtH 3 div mul add exch %1.75
dy dx atan cos ArroWWidtH 3 div mul add exch %1.75
translate dy dx atan 90 add
0 0 moveto %/Times-Roman findfont 24 scalefont setfont (a) show
%Output of Arrows
gsave newpath false ArroWInseT ArrowWidtH ArroWSiZe ArroWSizE Arrow
currentpoint transform /cpy exch def /cpx exch def grestore
/setdist setdist %ArroWWidtH ArrowWidtH div add
AsP add
} { /ovr setdist pathdist sub def exit } ifelse } loop } if } def
{ movetoProc }
{ linetoProc }
{ % curvetoProc
(ERROR: No curveto's after flattenpath!) print }
{ % closepathProc
firstx firsty linetoProc firstx firsty movetoProc }
} def end

If this didn't work at all (me works somehow, so I missed something),
please let me know!
Any other reactions are welcome!


bori at

PS: Please excuse me for my poor english and for this long letter too!

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