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

Brian Granger ellisonbg@gmail....
Tue Jun 18 12:00:37 CDT 2013


It is probably worth mentioning that SymPy has *basic* quantum circuit
drawing that uses matplotlib.  It would be great i someone wanted to
improve that....

On Tue, Jun 18, 2013 at 9:48 AM, Rick Muller <rpmuller@gmail.com> wrote:
> 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
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com


More information about the IPython-dev mailing list