[Xy-pic] Spacing problems with triangles
Ross Moore
ross at ics.mq.edu.au
Wed Mar 31 10:12:25 CEST 2004
Hi Jurgen,
On 30/03/2004, at 11:03 PM, Jürgen Koslowski wrote:
> Hello,
>
> I encountered an annoying spacing problem when displaying triangular
> diagrams. The top corner is much too close to the preceeding text, in
Yes, your are right.
There is a problem whereby the full size of the diagram is lost
when the \twocell (and other 2-cell macros) are used.
> case of a short line even protrudes into that line. So far I have
> used invisible entries to get around this problem, is there a better
> way? Enclosing the diagram into \vcenter{...} does not help.
>
I've devised a fix.
Try including the follow code in the document-preamble,
after the Xy-pic package has been loaded.
\makeatletter
\gdef\xymerge at MinMax{}
\xydef@\twocell{\hbox\bgroup\xysave at MinMax\@twocell}
\xydef@\uppertwocell{\hbox\bgroup\xysave at MinMax\@uppertwocell}
\xydef@\lowertwocell{\hbox\bgroup\xysave at MinMax\@lowertwocell}
\xydef@\compositemap{\hbox\bgroup\xysave at MinMax\@compositemap}
\xydef@\twocelll#1#{\hbox\bgroup\xysave at MinMax\xy@\save\save@\@twocelll{
#1}}
\xydef@\xysave at MinMax{\xdef\xymerge at MinMax{%
\noexpand\ifdim\X at max<\the\X at max \X at max=\the\X at max\noexpand\fi
\noexpand\ifdim\X at min>\the\X at min \X at min=\the\X at min\noexpand\fi
\noexpand\ifdim\Y at max<\the\Y at max \Y at max=\the\Y at max\noexpand\fi
\noexpand\ifdim\Y at min>\the\Y at min \Y at min=\the\Y at min\noexpand\fi
}}
\xydef@\drop at Twocell{\boxz@ \xymerge at MinMax}
\xydef@\twocell at DONE{%
\edef\tmp@{\egroup
\X at min=\the\X at min \X at max=\the\X at max
\Y at min=\the\Y at min \Y at max=\the\Y at max}\tmp@
\L at c=\X at c \advance\L at c-\X at min \R at c=\X at max \advance\R at c-\X at c
\D at c=\Y at c \advance\D at c-\Y at min \U at c=\Y at max \advance\U at c-\Y at c
\ht\z@=\U at c \dp\z@=\D at c \dimen@=\L at c \advance\dimen@\R at c \wdz@=\dimen@
\computeLeftUpness@
\setboxz at h{\kern-\X at p \raise-\Y at c\boxz@ }%
\dimen@=\L at c \advance\dimen@\R at c \wdz@=\dimen@ \ht\z@=\U at c \dp\z@=\D at c
\Edge at c={\rectangleEdge}\Invisible at false \Hidden at false
\edef\Drop@@{\noexpand\drop at Twocell
\noexpand\def\noexpand\Leftness@{\Leftness@}%
\noexpand\def\noexpand\Upness@{\Upness@}}%
\edef\Connect@@{\noexpand\connect at Twocell
\noexpand\ifdim\X at max<\the\X at max \X at max=\the\X at max\noexpand\fi
\noexpand\ifdim\X at min>\the\X at min \X at min=\the\X at min\noexpand\fi
\noexpand\ifdim\Y at max<\the\Y at max \Y at max=\the\Y at max\noexpand\fi
\noexpand\ifdim\Y at min>\the\Y at min \Y at min=\the\Y at min\noexpand\fi }%
\xymerge at MinMax
}%
\makeatother
> Here is an example:
>
> \documentclass[11pt]{article}
> \usepackage[arrow,2cell,line,dvips,ps]{xy}
>
> %\CompileMatrices
> \UseAllTwocells
>
> \setlength{\textwidth}{16 cm}
> \begin{document}
>
> If for a 2-cell
> \[
> \xy
> ;<50 pt,0 pt>:
> (0.0,0) *+{A}="A",
> (0.5,\halfrootthree) *+{B}="B",
> (1.0,0) *+{C}="C",
> "A";"C",{\twocell<\omit>{<-3>{\ \phi}}},
> \ar_{t}"A";"C"
> \ar^{r}"A";"B"
> \ar^{s}"B";"C"
> \endxy
> \]
This example should work properly now.
Please try the above fix, and report any problems that you notice.
Cheers
Ross
> pasting at $s$ is bijective, we call $\langle s,\phi\rangle$ a right
> extension of $t$ along $r$.
>
> Even if the line preceeding the diagram is longer, the placement
> is better but we still have a problem. There seems to be too little
> space above the diagram:
> \[
> \xy
> ;<50 pt,0 pt>:
> (0.0,0) *+{A}="A",
> (0.5,\halfrootthree) *+{B}="B",
> (1.0,0) *+{C}="C",
> "A";"C",{\twocell<\omit>{<-3>{\ \phi}}},
> \ar_{t}"A";"C"
> \ar^{r}"A";"B"
> \ar^{s}"B";"C"
> \endxy
> \]
> I don't want to put in extra invisible elements to get the spacing
> right.
>
> \end{document}
>
> -- Juergen
>
> --
> Juergen Koslowski If I don't see you no more on this
> world
> ITI, TU Braunschweig I'll meet you on the next one
> koslowj at iti.cs.tu-bs.de and don't be late!
> http://www.iti.cs.tu-bs.de/~koslowj Jimi Hendrix (Voodoo Child,
> SR)
> _______________________________________________
> xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic
>
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia fax: +61 +2 9850 8114
------------------------------------------------------------------------
More information about the xy-pic
mailing list