Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem multiple itikz images in a single notebook #12

Open
jeroenvuurens opened this issue Jun 17, 2019 · 4 comments
Open

Problem multiple itikz images in a single notebook #12

jeroenvuurens opened this issue Jun 17, 2019 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jeroenvuurens
Copy link

  • itikz version: 0.1.3
  • Python version: 3.7.1
  • Operating System: Ubuntu 18.04

Description

I am experiencing problems when a notebook contains more than one itikz drawing. Somehow the text labels in the second drawing is corrupted. In the below example, if you enter the code into three separate cells, in the second plot instead of a and y the text labels show x and z.

What I Did

%load_ext itikz

%%itikz --implicit-pic --file-prefix aa- --tikz-libraries=positioning,shapes,shadows,arrows
\tikzstyle{node}=[circle, draw=black, text centered, text width=0.5cm]
\node[node] (I-0) at (0,-0) {$x$};
\node[node] (O-0) at (3,-0) {$z$};

%%itikz --implicit-pic --file-prefix ab- --tikz-libraries=positioning,shapes,arrows
\tikzstyle{node}=[circle, draw=black, text centered, text width=0.5cm]
\node[node] (I-0) at (0,0) {$a$};
\node[node] (G-0) at (3,-0) {$y$};

@jbn
Copy link
Owner

jbn commented Jul 5, 2019

Sorry for the delay!

I think I know what's happening. Are you using Jupyter lab or Jupyter notebook? I'm assuming the latter, as I replicated the problem in notebook but failed to do so in lab. If you're using notebook, give it a try in lab and see if the problem persists. (I don't mean this as a solution; it's diagnostic.)

@darrivau
Copy link

It does work with jupyter lab but still failed with nbconvert which is not convenient for any command line conversion in scripts.

@jbn
Copy link
Owner

jbn commented Jan 4, 2020

I'm not sure if there is an easy fix here. The SVGs are isolated at generation time so you can extract them and process accordingly, but in a joined document they share IDs and get garbled. It would be nice if there was a way to mangle identifiers so they didn't do this but I'm not aware of a simple way of doing so.

(Leaving this open in case anyone does find one.)

@jbn jbn added enhancement New feature or request help wanted Extra attention is needed labels Jan 4, 2020
@vargonis
Copy link

How do you work around this problem? I've resorted to using itikz to generate an SVG and then just drop the cell and embed the result (as an image). I wish there was a better option!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants