[Xy-pic] Fw: Xy-pic and Qcircuit

Ross Moore ross.moore at mq.edu.au
Sun Mar 20 20:30:49 CET 2011


Hi Bryan,

Thanks for providing the explicit examples.

On 21/03/2011, at 2:40 AM, Bryan Eastin wrote:

> Hi everyone,
> 
> I've compiled each of the TeX files containing error examples using a fresh Ubuntu 10.10 install, the 2009-10 version of TeXLive, and Xy-pic 2.8.5 (I replaced 2.7 manually).  On this system, everything produces the correct output except the fourth example. 

Yes, when using the xypdf backend.

>  Lots of warnings are generated for all but the second example, however.  I suspect that it is the handling of these warning situations that's causing the problem on some systems.

Not really. Those warnings should not occur.
These result from attempting to do trigonometric calculations
when the hypotenuse has zero length. It just isn't going
to work. 

In the example below, if you change:

>>> \xymatrix @*[o] @*=<0.01em> @R=1.7em @C=1em {


to become 

>>> \xymatrix @*=<0.01em> @R=1.7em @C=1em {

then the warnings do not happen, and the resulting
diagram looks just fine.

Explanation: the  @*[o] causes all objects to become
circular (actually elliptical), so that locating a point 
on the boundary essentially requires trigonometry. 
But when the size of the object is zero, this can result 
in the "division by 0" warnings that you see.

Now your definition of \Qcircuit is:

  \newcommand{\Qcircuit}[1][0em]{\xymatrix @*[o] @*=<#1>}

which is forcing @*[o] but imposing a default cell size of zero.
Hence you can expect to get these kinds of warning, and possibly
actual errors in the output --- as indeed you do get.

Using

   \renewcommand{\Qcircuit}[1][0em]{\xymatrix @*=<#1>}

allows your example to compile just fine.
The output has a small vertical glitch, whose source I've not
yet attempted to trace.  (see attached image)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: texshop_image.jpeg
Type: image/jpeg
Size: 198709 bytes
Desc: not available
URL: <http://tug.org/pipermail/xy-pic/attachments/20110321/63728b17/attachment-0001.jpeg>
-------------- next part --------------

When using TeX+dvips+Ghostscript, that glitch does not occur.
So there must definitely be some place in the xypdf coding 
where there is a bit of room for improvement.

But Qcircuit needs to stop requiring zero-sized objects from 
being circular.
To achieve this, but allow circularity with non-zero-sized
objects are being used:

 1. the expansion of  \Qcircuit  should test the value
 of its optional argument. 
 
 2. only if non-zero, then use  @*[o]  otherwise leave it out, 
    so that the vertex objects remain rectangular.

> 
> Bryan
> 

Hope this helps,

	Ross


> %Problem:
> %Arrows connect poorly to empty entries in \xymatrix
> %Qcircuit command broken:
> %\link
> %Example code:
> \xymatrix @*[o] @*=<0.01em> @R=1.7em @C=1em {
> & \ar @{-} [1,1]  \ar @{-} [0,-1] & & \ar @{-} [0,-1] \\
> & \ar @{-} [-1,1] \ar @{-} [0,-1] & & \ar @{-} [0,-1]
> }
> %Resultant error message:
> %None.
> %Hack:
> %Insert a very tiny object.
> %E.g.,
> \xymatrix @*[o] @*=<0.01em> @R=1.7em @C=1em {
> & *{\rule{.01em}{.01em}} \ar @{-} [1,1]  \ar @{-} [0,-1] &
> *{\rule{.01em}{.01em}} & \ar @{-} [0,-1] \\
> & *{\rule{.01em}{.01em}} \ar @{-} [-1,1] \ar @{-} [0,-1] &
> *{\rule{.01em}{.01em}} & \ar @{-} [0,-1]
> }
> %The hack is undesirable because:
> %The connections still don't look quite right.  Moderately important.


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the xy-pic mailing list