I'm trying to export a chart as pdf with tex code. I've made it with LibreOffice Calc, copied to Draw and exported it as svg. I've uploaded it to ge.tt.

Now, after opening the svg with Inkscape and working on it a bit, it looks like this: enter image description here

When I export it to pdf+LaTeX, though, every text label is put in the same coordinate (-0.00106898,0.6176822):

\put(-0.00106898,0.6176822){\makebox(0,0)[lb]{\smash{<the label>}}}

except for the trend line equation, which I added in Inkscape (it wasn't part of the exported svg), and the vertical label, which I have rotated with Inkscape (it is misplaced, anyway).

The result of typesetting with LaTeX is this:
enter image description here

1) The typesetting is correct (AFAIK), the problem lies in the instructions created during the export.
2) The only object that outputs correctly is the only object completely created within Inkscape.

Edit: these are the settings I use for exporting from Inkscape:
enter image description here


  • 1
    I cannot answer your question, but that seems like an awfully complicated way to generate a plot. I recommend that you take a look at actual plotting software with plot-exporting options such as Gnuplot or Matplotlib for Python.
    – Wrzlprmft
    Jun 14, 2015 at 16:11
  • Well, with LibreOffice there's no need to learn a new language... Jun 14, 2015 at 23:40
  • What version of Inkscape are you using? Have you tried it with the latest (0.91)? Jun 15, 2015 at 15:50
  • Yep. In the end I'm going to go the pgfplots way and keep using LO with TeXmaths just until I become handy enough with it. Jun 15, 2015 at 16:13

1 Answer 1


The problem is one of the tools (probably LO Draw) isn't setting the X,Y on the <svg:text> elements properly. If you open the SVG in Inkscape and look at the XML source, the <svg:text> elements don't have x and y attributes set. Within them, however <tspan> has an X and Y set (if I understand right, these offset the position from the original text's position). These are being dropped during the SVG -> PDF export. Not sure whether to blame Draw for setting coordinates this way or Inkscape for handling them one way when viewing the SVG, but ignoring them when exporting to PDF.

<!-- notice the x and y set on the child, not on <text> itself -->
<text class="TextShape" id="text307">
    <tspan class="TextParagraph" 
        font-family="Charter, serif"
        <tspan class="TextPosition"
            x="6361" y="8491" id="tspan311">
            <tspan fill="rgb(0,0,0)" stroke="none" id="tspan313">0,006</tspan>

Fixing the coordinates back hand will probably fix it, but that's going to be time consuming.

Try to svg package

Instead of converting from SVG to PDF, try just using the SVG. It might be able to handle this quirk. I haven't tried this package myself. Take a look at its manual for instructions on its usage.

Use a regular PDF export

If you have the fonts installed on your system leave as text or convert to paths. You'll lose TeX for your text processing in the image, but it would be a quick workaround.

Fix the SVG file

If you have a lot of these, writing an XSL to fix the SVG files (but moving the X,Y values from the tspans to the parent ) or fixing them by hand is also an option. If this is the only image and it's unlikely to change, taking 5-10 minutes to just fix it would work too.

  • Thanks @Scribblemacher! Now at least I know what causes the problem. Unfortunately, none of the solution you suggested really work for me: the svg package doesn't work on Windows and fixing the SVG isn't an option. Exporting straight from LO works of course, but it's what I was trying to improve upon. Thank you very much for your help, anyway :-) Jun 15, 2015 at 16:14
  • This is unfortunately still an issue in 2021. Using the following regex replace <text class="TextShape">(.*)x="([^"]*)" y="([^"]*)" replace with <text class="TextShape" x="\2" y="\3">\1x="\2" y="\3" to modify the SVG file works, however (for libreoffice 6 output, you may need to adjust it for your svg files).
    – Jonathan
    Feb 1, 2021 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.