Xy-pic User's Guide: Next: 3 More Entries. Up: 2 More Arrows and . Previous: 2.8 More bending arrows.

2.9 Defining new arrow types

Last in this treatment of arrows we will explain how new arrows can be defined. The crucial fact is that the characters used for tips and shafts are restricted to the following:

><|ox+/()[] tip characters
-.~:= shaft characters

When an arrow is interpreted by Xy-pic it is first split into the three components and then each component is looked up in a library of so-called `directionals'. It is possible to add new such directionals using the command

\newdir{ directional }{ composite }

where directional should be a sequence either of tip characters or of shaft characters, and composite should be a list of objects separated with * just like the argument to \composite described in section 2.2. If arrows of a particular variant (always one of the letters ^_23) needs an alternate definition then another declaration can be given with the variant inserted between \newdir and the first {. There is one object modifier which is very useful in this context, in addition to those of section 2.2:

!vector shift object vector

(where the possibilities for vector are described in section 2.6). Combined with the direction code this is very powerful, for example,

\newdir{|>}{%
 !/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
defines a new tip that makes
\xymatrix{ A \ar @{=|>} [r] & B }
typeset

In particular notice how the `relative direction' is used here to rotate some of the composed components.

 

Exercise 13.

Often tips used as `tails' have their ink on the wrong side of the point where they are placed. Fortunately space ( ) is also a tip character so we can define the directional > to generate a `tail-spaced' arrow. Do this such that
\xymatrix{ A
 \ar @{>->}  @< 2pt> [r]
 \ar @{ >->} @<-2pt> [r]
 & B }
typesets

Answer.

Finally, when Xy-pic diagrams are used in conjunction with Knuth's computer modern fonts then the declaration

\UseComputerModernTips

will change the tips to some that look similar, e.g.,

$\UseComputerModernTips
 \xymatrix@1{A\ar@{->>|}[r]&B}$
typesets . This declaration respects TeX grouping.


Xy-pic User's Guide: Next: 3 More Entries. Up: 2 More Arrows and . Previous: 2.8 More bending arrows.



© Kristoffer Høgsbro Rose <kris@diku.dk> / October 18, 1995.