# [IPython-dev] More complicated LaTeX output in IPython notebook cells.

Rick Muller rpmuller@gmail....
Tue Jun 18 11:48:37 CDT 2013

I'm interested in getting working quantum circuit drawings in IPython
notebook cells. The current approaches that do this use latex to draw these
circuits, so I was hoping this wouldn't be too difficult to make work.

Ike Chuang has a python program called [qasm2circ](
http://www.media.mit.edu/quanta/qasm2circ/). I wrote a lightweight python
class around the object that wraps the basic parsing methods and presents a
_repr_latex_ method so that I could display the circuit. This outputs
something that looks like:

\input{xyqcirc.tex}

% definitions for the circuit elements

\def\gAxA{\op{H}\w\A{gAxA}}
\def\gBxA{\b\w\A{gBxA}}
\def\gBxB{\o\w\A{gBxB}}

% definitions for bit labels and initial states

\def\bA{ \q{q_{0}}}
\def\bB{ \q{q_{1}}}

% The quantum circuit as an xymatrix

\xymatrix@R=5pt@C=10pt{
\bA & \gAxA &\gBxA &\n
\\  \bB & \n   &\gBxB &\n
%
% Vertical lines and other post-xymatrix latex
%
\ar@{-}"gBxB";"gBxA"
}

which doesn't display, I think because the xyqcirc.tex stuff isn't
supported by mathjax.
Does anyone know of a workaround for this, or should I start honing my SVG
skills to generate a more native option?

--
Rick Muller
rpmuller@gmail.com
505-750-7557
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130618/2480f945/attachment.html