[IPython-dev] Problems with tikzmagic and svg output

David Powell DavidAnthonyPowell+python at gmail.com
Mon Oct 20 23:04:58 EDT 2014

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.

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141021/b8234681/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tikz-magic-output.png
Type: image/png
Size: 36146 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141021/b8234681/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tikz-svg-test.ipynb
Type: application/octet-stream
Size: 14025 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141021/b8234681/attachment.obj>

More information about the IPython-dev mailing list