[Tex/LaTex] LyX makes mistakes rendering svg graphics

inkscapelyxpdftexsvg

I am writing a document in LyX 2.1.4 on Mac OS 10.11 using MacTeX-2015. I insert svg files created in Inkscape 0.91. Some of them are entirely created in Inkscape. Some are outputs from R that I imported into Inkscape from pdf and edited a bit.

What happens if I compile the document via pdflatex is the following:

  • some graphics have black rectangles over the image (I think where text boxes where)
  • some have a white rectangle over the image (also where the text boxes are supposed to be)
  • some graphics have text boxes or other boxes inverted so that the content is a mirror image of itself

The part of the svg that originated from R usually is alright. Mainly the parts I added in Inkscape show this strange behavior. All svgs look alright if I open them in any Viewer and also if I export them to pdf directly from Inscape.

I recently had the thing with the black boxes in a poster I created in Inkscape. But now the pdf export directly from Inkscape looks alright.

I can convert all my graphics to pdf before I use them in LyX. But why does this happen anyway? Is there something wrong with my settings or packages installed?

Best Answer

As PDF export from Inkscape works well, as you say, you should configure Lyx to use Inkscape as a file converter. For doing so go to Tools > Preferences > File Handling > Converters. Find the Converter SVG -> PDF (graphics). In the field Converter I use the following command on a Linux system

inkscape --file=$$i --export-area-page --without-gui --export-pdf=$$o

Should be the same under OS X, I guess.

Related Question