[Xy-pic] Problem with \newdir{d}
Ross Moore
ross at ics.mq.edu.au
Sun Jan 6 23:17:39 CET 2008
Hi Michael,
On 06/01/2008, at 3:00 AM, Michael Barr wrote:
> You will see the problem if you compile the following. I reverted
> to your original definition for this purpose. Notice incidentally
> that that \lower1.1ex has no discernible effect. The dots work
> reasonably well up to about a 45 deg angle and then start to go wrong.
>
> Any ideas?
Yes.
You really need to take more care about the exact size and
placement of the \cdotbox to guarantee that it is square,
and has the \cdot right in the middle.
Here is my current best attempt:
\setbox\cdotbox=\hbox to3pt{\kern1.75pt\lower0.55ex\hbox{$\cdot$}
\kern-1.75pt}%
\ht\cdotbox=1.5pt \dp\cdotbox=1.5pt
\newdir{d}{\object{\copy\cdotbox}}
In this coding, you see the need for the \lower to get the
\cdot centered vertically.
the two \kern commands help with centering horizontally.
Adjust the actual numbers to get the best appearance.
Also, you asked about the syntax with @{<arrow-specifier>} .
This is a little tricky, as there are 3 separate directionals
that can be specified here; namely
arrow-tail, arrow-shaft, and arrow-head .
e.g. @{<->} for a double-headed arrow, specifies all 3 ;
but @{>}, @{<} and @{|} specify just the arrow tip.
But @{<.} and @{.>} specify 2 of the 3 directionals,
but different ones in each case, so that they do the "natural"
thing, resulting in a dotted shaft with tail or tip respectively.
There also needs to be a lot of flexibility to allow easy syntax
for customisation of arrows using user-defined directionals.
e.g. \@{d>} uses a tip-specifier obtained from \newdir{d>}
rather than a shaft of \dir{d} and tip of \dir{>}
The complete syntax is described as a BNF diagram, in the
Xy-pic reference.
It works roughly as follows:
@{{..}{..}{..}} (3 groupings) sets all 3 pieces, assuming that
their contents define a valid directional; if not valid, then
an error message will result at some later stage in the processing.
@{..whatever..} parses the ..whatever.. character by character,
looking for particular characters that have meaning for each part
of the arrow, in the order: tail, then shaft, then head.
If nothing is found that is appropriate for one part, then it is
left as empty and we move on to examine for the next part.
Characters such as . - : = have meaning for the shaft, but not tip
nor tail.
Single letters a-z or A-Z have no meaning for any part, but...
... if nothing valid is found for the any part, then the whole of
{..whatever..} is presumed to be meant as a directional for the tip.
That is, these should give identical results:
@{{}{}{..whatever..}} and @{..whatever..}
unless the ..whatever.. starts with valid characters for some pieces.
e.g.
@{d>} is the same as @{{}{}{d>}} ( and also @{d>{}{}} !!)
but @{.>} is the same as @{{}{.}{>}} and @{{}.>} and @{.{>}}
and various other combinations.
Redundant stuff occurring after valid specifiers will cause an error;
e.g. @{.><} , @{.>{}} etc.
Hope this helps,
Ross
>
> Michael
>
> \documentclass{article}
> \usepackage[arrow]{xy}
>
> \begin{document}
> \newbox\cdotbox
> \setbox\cdotbox=\hbox{\lower1.1ex\hbox{$\cdot$}}
> \newdir{d}{\object{\copy\cdotbox}}
> $$\xy
> \POS(0,0)*+!!<0ex,.55ex>{\cdot}\ar@{>} (0,20)*+!!<0ex,.55ex>{\cdot}
> \POS(20,0)*+!!<0ex,.55ex>{\cdot}\ar@{{}{d}>} (20,20)*+!!<0ex,.55ex>
> {\cdot}
> \POS(0,20)*+!!<0ex,.55ex>{\cdot}\ar@{>} (20,20)*+!!<0ex,.55ex>{\cdot}
> \POS(0,0)*+!!<0ex,.55ex>{\cdot}\ar@{{}{d}>} (20,0)*+!!<0ex,.55ex>
> {\cdot}
> \endxy$$
>
> \setbox\cdotbox=\hbox{$\cdot$}
> \newdir{d}{\object{\copy\cdotbox}}
> $$\xy
> \POS(0,0)*+!!<0ex,.55ex>{\cdot}\ar@{>} (0,20)*+!!<0ex,.55ex>{\cdot}
> \POS(20,0)*+!!<0ex,.55ex>{\cdot}\ar@{{}{d}>} (20,20)*+!!<0ex,.55ex>
> {\cdot}
> \POS(0,20)*+!!<0ex,.55ex>{\cdot}\ar@{>} (20,20)*+!!<0ex,.55ex>{\cdot}
> \POS(0,0)*+!!<0ex,.55ex>{\cdot}\ar@{{}{d}>} (20,0)*+!!<0ex,.55ex>
> {\cdot}
> \endxy$$
> \end{document}
>
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia 2109 fax: +61 +2 9850 8114
------------------------------------------------------------------------
More information about the xy-pic
mailing list