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

Bryan Eastin beastin at gmail.com
Fri Mar 11 08:56:15 CET 2011


Ross,

> Hi all,
>
> On 10/03/2011, at 11:03 AM, Kristoffer H Rose wrote:
>
>> Dear Everyone,
>>
>> In the message below, Bryan reports that Xy-pic 3.8 has problems with diagrams generated from Qcircuit.  Since we have a maintenance release coming up (3.8.6 with Daniel's xypdf 1.7), any help with a quick solution from anyone who has experienced similar problems would be most welcome!
>>
>> Bryan and Steve: if you can submit a complete TeX document to the list (as .tex and .pdf attachments), which, when typeset, explains and demonstrates the problem then that will probably facilitate a solution.
>
> Yes.
> Please provide explicit examples using Qcircuit ...
>
>>
>> Thanks to all,
>>         Kris
>
>
>> I've tried to isolate what's going wrong, and I think I've identified
>> all of the problems (Roughly.  I don't know enough to dig around
>> inside Xy-pic.).  I'm not sure if these are bugs in the new release or
>> intentional changes, but I've catalogued the issues at the end of this
>> email.
>
> I can reproduce *only one* of those errors that you state.
> But that example was using a syntax for frames that is not documented
> within the Xy-pic reference manual. So you are rather lucky (or is it
> really unlucky?) that it worked at all, in any circumstance.
> More on this below.

I'll claim really unlucky given the circumstances.  We tested
extensively before making it public and the code worked on Windows,
Linux, and Mac.  I never heard of any problems until the updates
started this year.

As you can no doubt tell, I was never very skilled with Xy-pic, but
looking back on the code and the old manual, I think that I was just
trying to apply the general rule that a dropped object can be preceded
by a size modifier.  I was dropping a frame and wanted it bigger so I
added the size modifier prior to the object.

> My testing was on a Mac, both *with* and *without* the new PDF support,
> and also with the older  dvips+PostScript backend.
>
>>
>> If they're bugs then please consider this a bug report and a heartfelt
>> request for some kind of fix.  If they're not bugs I would be very
>> grateful for any advice on how I might circumvent these features.
>
> I'd be more than happy to do so, if I could reproduce them.
> For the case of framing an object of zero size, your syntax
> was actually undocumented. With the correct documented syntax
> there is not a problem at all.

Hopefully the files I sent will help.  As I said though, not all error
seem to manifest on all systems.

> In the other cases, my best guess is that you somehow are mixing
> some files from an earlier version of Xy-pic with those of a
> later version.

If so, this is a problem that afflicts many people, since I have
gotten quite a number of complaints.  I believe I have also gotten
complaints from individuals who were doing fresh installs.

> Either that, or I have already implemented fixes which you have not
> yet been made aware of. But I'd thought that we have released all
> the fixes that relate to these examples. Maybe I'm wrong about this?
>
> Please put  \listfiles  in the preamble of your tests, and send the
> complete  .log  file that results.
>
>
>>
>> If you're interested in knowing more about Qcircuit, the package has a
>> webpage at http://www.cquic.org/Qcircuit/ .  I believe it is presently
>> the most commonly used method for typesetting quantum circuits.
>>
>> Thank you for your time,
>> Bryan Eastin
>>
>> [I have CC'd this email to Steven Flammia, the other author of Qcircuit.]
>>
>>
>>
>> %The following examples were generated using MikTeX version 2.7 and
>> Xy-pic version 2.8.5 on a Windows XP machine.  Not all of these
>> problems
>> %seem to manifest on machines running TeXLive on Ubuntu or Mac.  Some
>> variant of the first issue happens on all systems, though an error
>> %message is not always generated.
>>
>> %Problem:
>> %Cannot draw an arrow to an entry of xymatrix of size 0em.
>> %Qcircuit command broken:
>> %\Qcircuit
>> %Example code:
>> \xymatrix @*[o] @*=<0em> {
>> & \ar @{-} [0,-1] & \ar @{-} [0,-1]
>> }
>> %Resultant error message:
>> %Xy-pic Warning: division overflow [FixQcircuit:51]
>> %
>> %! Arithmetic overflow.
>> %<recently read> \quotPTK@
>> %Hack:
>> %Set the default entry size in \xymatrix to .05em.  Smaller sizes
>> somehow result in bigger gaps.
>> %The hack is undesirable because:
>> %Arrows meeting at an empty entry no longer connect.  Important!
>
> The attached image shows what I get when testing this:
>
> There is most certainly an arrow/line drawn.

Yes.  That seems to work just fine for you.  Odd.  I was under the
impression that everyone got some variant of this error.

>> %Problem:
>> %The \frm command no longer works on null objects.
>> %Qcircuit command broken:
>> %\targ
>> %Example code:
>> \xy <0em,0em>*+<.8em>\frm{o}\endxy
>
> This I *can* reproduce, using the new PDF option.
>
> However, you are using a syntax that is undocumented.
> The *correct* way to make a circular frame of that size is:
>
>   *\frm<.4em>{o}
>
> This *does* work with the new PDF backend.

Thanks.  This is a nice, clean (and functional) alternative to the old code.

>> %Resultant error message:
>> %None.
>> %Hack:
>> %Insert a very tiny object.
>> %E.g., for \targ, use the code {\xy {<0em,0em> \ar @{ - } +<.39em,0em>
>> \ar @{ - } -<.39em,0em> \ar @{ - } +<0em,.39em> \ar @{ - }
>> -<0em,.39em>},<0em,0em>*{\rule{.01em}{.01em}}*+<.8em>\frm{o}\endxy}
>> %The hack is undesirable because:
>> %Aside from being inelegant, it requires a change to the original
>> code, which has already been widely distributed.  Less important.
>
>
> I cannot reproduce this next one:
>
>>
>> %Problem:
>> %Erratic generation of Division Overflow Errors.
>> %Qcircuit command broken:
>> %Uncertain.
>> %Example code:
>> %The following works.
>> \xymatrix @*[o] @*=<0.09em> @R=1.7em @C=1em {
>> & \ar @{-} [1,1]  \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1] \\
>> & \ar @{-} [-1,1] \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1]
>> }
>> %The following doesn't work:
>> \xymatrix @*[o] @*=<0.1em> @R=1.7em @C=1em {
>> & \ar @{-} [1,1]  \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1] \\
>> & \ar @{-} [-1,1] \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1]
>> }
>> %The following works.
>> \xymatrix @*[o] @*=<0.11em> @R=1.7em @C=1em {
>> & \ar @{-} [1,1]  \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1] \\
>> & \ar @{-} [-1,1] \ar @{-} [0,-1] & & *{a} \ar @{-} [0,-1]
>> }
>> %Resultant error message:
>> %Xy-pic Warning: division overflow [FixQcircuit:82]
>> %
>> %! Arithmetic overflow.
>> %<recently read> \quotPTK@
>> %Hack:
>> %Use a different number?
>> %The hack is undesirable because:
>> %I have no idea what will work when or whether a workable alternative
>> will always be available.
>
>
> nor this one:
>
>>
>> %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.
>
>
>
>
>
> The extra tiny object makes an imperceptible difference,
> in the attached image.

   Oops.  Sorry.  I included the complaint from an old hack.  The
typesetting that you get from this one is quite good, but to apply
this trick to Qcircuit I have to make the user insert dummy objects
into their circuit to connect to.  It's not a pretty solution, and
however I make the change, I'll break all previously written Qcircuit
code that links to empty entries.

> 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
> ------------------------------------------------------------------------
>
>
>
>
>

Thanks!
Bryan



More information about the xy-pic mailing list