I have drawn a diagram in Inkscape (with a little help from Blender) and saved it as a SVG file. I want my labels on the diagram to match my document's (both typeface and size) and my labels also contain math; so I cannot add the labels with Inkscape. I want to add them with PGF.

My workflow right now is: (a) create a complicated 3D shape in Blender, (b) trace out the mesh edges and fill faces in Inkscape, style it, add ''ugly'' labels, (c) save the file as PDF (or EPS) and import into my TeX document.

First, I cannot draw the 3D shape in PGF because TikZ is not good enough. I need Blender to sketch out the shape. Secondly, I would like to be able to change the style across all my diagrams. Right now, once I have exported into PDF, my styles are set in stone. If I later decide that I want all my fill color to be a little darker, I have to manually change the fill color for all my drawings in Inkscape one after another. If I could access the paths (or their co-ordinates and controls points) from TikZ, I can ask PGF to draw them and style them with TikZ's global styles.

Question: Is it possible to put ''invisible markers'' in the SVG files with Inkscape and then access them from TikZ. Like, maybe, the marker could be assigned a TikZ node and I can place my label with respect to the node. Also, is it also possible to modify a SVG path with TikZ? Like, for a given path in SVG file, is it possible to access it from TikZ and change the stroke style (color, thickness, etc) from TikZ. Otherwise, can you suggest an alternative workflow.

  • How complex are the SVG paths? There is \usetikzlibrary{svg.path} which allows you to put the stuff you feed as value to the d attribute in an SVG <path> tag directly into a TikZ environment ... However, this would still not add markers to the path. Commented Sep 23, 2022 at 11:19
  • You can add the LaTeX code directly in Inkscape (just type any math like $a_b + \sqrt{c}$ literally in Inkscape) and then save as pdf with the option "Omit text in PDF and create LaTeX file". Then you can input the generated file in your LaTeX document and render the math from there.
    – Marijn
    Commented Sep 23, 2022 at 11:37
  • The question is what the desired file format is in the end. If you are fine with pdf you could just add any math formulas to the Inkscape graphic and use package svg in order to render all formulas with LaTeX. If you want to stick with svg you maybe find some plugin like inkscape.org/~jcwinkler/%E2%98%85textext
    – mrpiggi
    Commented Sep 23, 2022 at 12:15
  • These solutions work for labels. Is there a solution for changing styles across all my diagrams?
    – sigsegv
    Commented Sep 23, 2022 at 12:37
  • I'm not aware of functionality to change svg elements within TikZ (maybe it exists but I just don't know about it). However, I have had some success in the past in editing the svg directly (from the terminal, or in a text editor, or with an xml editor) to do mass find-and-replace actions that can automate your workflow a bit. See tex.stackexchange.com/questions/640398/… for an example.
    – Marijn
    Commented Sep 23, 2022 at 12:44


You must log in to answer this question.

Browse other questions tagged .