[IPython-dev] Problems with tikzmagic and svg output

Matthias Bussonnier bussonniermatthias at gmail.com
Tue Oct 21 03:09:13 EDT 2014

Le 21 oct. 2014 à 05:04, David Powell <DavidAnthonyPowell+python at gmail.com> a écrit :

> Hello all,
> I came across a problem when using the tikz cell magic to generate svg output. If the tikz graphs have text in them, then each character is defined as a glyph in the svg file. This works fine, for a single figure. If multiple tikz graphs are included as svg, then their glyph definitions clash, and the second graph is rendered incorrectly in the notebook.
> I have attached a notebook and screen grab showing this effect. The generated svg files themselves are okay, it's only when they are rendered in the notebook that the problem occurs, so I guess the problem lies with the notebook rather than the tikz magic.
> I am unsure whether to raise a github issue, as there are situations (such as fonts defined in svg), where it would make sense to share definitions globally in the document. But it would be good if there was some option to include svg data in the notebook while ensuring that its definitions are kept private.

I suppose you should display it in an iframe, if you display the SVG with the isolated=true metadata, 
IPython should do that for you automatically.

> On a related point, is there an easy way to export the .svg output of a cell to a file directly from within the notebook? I know that I could use nbconvert, manually hack the html, or find the temporary svg created by the magic, but I was hoping to find a more convenient way.

No, no easy way. For most content, drag-and drop from Chrome to my desktop seem to work here. 
I was able to do it with SVG at some point, but today it refuses.

> Thanks,
> David
> <tikz-magic-output.png><tikz-svg-test.ipynb>_______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list