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

Bryan Eastin beastin at gmail.com
Fri Mar 25 06:10:52 CET 2011


Ross,

Thanks!  That's really useful info.  It was pretty clear that the
problem was entries of zero size, but I didn't realize that it
wouldn't happen if I didn't specify that they had to be circular.
Qcircuit is used mainly for typesetting papers in journals, and they
(or Physical Review at least,
https://authors.aps.org/revtex4/apsguide4-1.pdf ) don't allow authors
to define macros with conditional statements (at least that's what I
assume they mean by "context dependent commands"), but that optional
argument adds functionality that to my knowledge has only ever been
used by myself and one other author (who is no longer in the field).
I probably shouldn't assume that I know what people are doing with my
macros, but I'm much more willing to break that functionality than
other things.  On my windows machine removing the circular specifier
allows things to compile, though the error from exampleError2 still
happens and there are still some issues with connections in
exampleError3 and exampleError4.

Thanks again,
Bryan


On Sun, Mar 20, 2011 at 1:30 PM, Ross Moore <ross.moore at mq.edu.au> wrote:
> 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)
>
>
>
>
> 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