[Xy-pic] Controlloing the dimensions of xy boxes

Ross Moore ross@ics.mq.edu.au
Sun, 28 Oct 2001 13:00:01 +1100 (EST)


Thanks Luigi,

(and Kris, please read this!)

> Hi everybody,
> 
> I have several difficulties controlling the dimensions
> produced by the environments \xy\endxy.
> 
> The following is an example of what I mean (Latex file
> follows, dvi-file in attachment). There are two different
> graph escapes which are supposed to draw the objects of a
> categorical commutative square. However, even if very
> similar, they behave in a very different manner. 

Your example indicates a rather subtle "feature" of the \xygraph
implementation. (It may be better called a "bug" !)

Your code generates xygraph "hops" of the form:   [r(-1)]
rather than using  [l]  for hops to the left.

In the internal processing, this first causes Xy-pic to
generate the coords of the point at  [r] from the current node,
then it calculates the "place" at position (-1) on the line
joining the current node to this calculated [r].

In performing the calculation of [r] its location is included
within the size of the complete picture. Usually this will
not matter, but in your example, this calculated point becomes
the farthest to the right of anything in the picture.
Hence you get that unwanted extra space to the right.


> Have you got any suggestion ?

for Kris Rose:

the  \MOVE@place  method calls the null-connection \no@@ with
\Hidden@false . Probably it should have  \Hidden@true .
Certainly this fixes the immediate problem, but I'm not sure
what other problems it may cause.

I debugged this, using a new null-connection:  \noh@@
defined as follows:

\xydef@{\noh@@}{\ifHidden@\no@@\else\Hidden@true\no@@\Hidden@true\fi}
\xydef@\MOVE@place{\xy@@\noh@@ \afterPLACE{\xyFN@\MOVE@}}

These 2 lines could replace the single line in  xygraph.tex :
(generated from  xygraph.doc )

\xydef@\MOVE@place{\xy@@\no@@ \afterPLACE{\xyFN@\MOVE@}}

The only implication of this change, so far as I can see,
is that you cannot influence the size of a graph by using
extra hops (e.g. [r(5)]) without also explicitly dropping
an empty <object> (e.g. [r(5)]*{}) .
This is probably the way it should be!


BTW, working with Luigi's example, I've uncovered another
interesting effect --- definitely a "bug" this time.
An arrow, such as  []-[r(-1)]  does not draw. 
(But []-[l] draws fine, of course.)
I haven't fully traced the problem, but I think it has something
to do with the directionality of the breaking mechanism for arrows. 
 

Cheers,

	Ross

> 
> Thanks, 
> 
> 	Luigi
> 
> %%% Begin Latex File
> \documentclass{article}
> 
> \usepackage[all]{xy}
> 
> %% Draw a square, 1st attempt
> 
> \newgraphescape{s}[8]{
>   []*+{#1}="1"
>   (
>   :@{{}{}{}}[d(#5)r(#6)]*+{#2}="2"
>   :@{{}{}{}}[d(#8)r(#7)]*+{#4}="4",
>   :@{{}{}{}}[d(#8)r(#7)]*+{#3}="3"
>   )
>   }
> 
> \newgraphescape{S}[6]{
>   []!s{#1}{#2}{#3}{#4}{#5}{0}{#6}{0}
>   }
> \begin{document}
> 
> %% Draw a square, 2nd corrected attempt
> 
> \newgraphescape{t}[8]{
>   []
>   :@{{}{}{}}[]*+{#1}="1" %% This line the only difference
>   (
>   :@{{}{}{}}[d(#5)r(#6)]*+{#2}="2"
>   :@{{}{}{}}[d(#8)r(#7)]*+{#4}="4",
>   :@{{}{}{}}[d(#8)r(#7)]*+{#3}="3"
>   )
>   }
> 
> \newgraphescape{T}[6]{
>   []!t{#1}{#2}{#3}{#4}{#5}{0}{#6}{0}
>   }
> 
> $$
> \fbox{\xy\xygraph{
>     []
>     !S{a}{b}{c}{d}{1}{-1}
>   }\endxy}
> \hspace{2em}
> \fbox{\xy\xygraph{
>     []
>     !T{a}{b}{c}{d}{1}{-1}
>   }\endxy}
> $$
> 
> \end{document}
> 
> %%% End of Latex File
> --
> Luigi Santocanale
> 	
> Department of Computer Science, University of Calgary.
> Tel: (403) 220-5106, fax:(403) 284-4707.
> http://www.cpsc.ucalgary.ca/~luigis/

[application/x-dvi is not supported, skipping...]