Mobile app version of vmapp.org
Login or Join
Debbie163

: Inkscape loses text coordinates when exporting for LaTeX 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

@Debbie163

Posted in: #Inkscape #Latex

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:


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:


Observations:
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:


Thanks.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Debbie163

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gretchen549

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"
font-size="353px"
font-weight="400"
id="tspan309">
<tspan class="TextPosition"
x="6361" y="8491" id="tspan311">
<tspan fill="rgb(0,0,0)" stroke="none" id="tspan313">0,006</tspan>
</tspan>
</tspan>
</text>


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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme