2

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?

  • I have never had a problem like this on Ubuntu. Can you post a minimal example in a bug report at lyx.org/trac ? Note that there are known problems with previews (i.e. LyX's display) but it shouldn't affect output. See e.g. lyx.org/trac/ticket/9778 – scottkosty Oct 30 '15 at 15:39
3

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.

2

@Deve gave the right hint

In the Inkscape wiki http://wiki.lyx.org/Tips/UseInkscapeSVGImages they state:

as of version 2.0.0 LyX is capable of displaying SVGs without configuring Inkscape as converter (i.e. without doing the procedure above) but in some cases (e.g. SVG containing text, LyX running on Windows), the rendering will be buggy (see http://www.lyx.org/trac/ticket/7657). Using Inkscape as converter with the procedure above solves the issues.

Apparently you don't have to add the converters manually:

librsvg or Inkscape needs to be installed on your computer. [...] Then use Tools > Reconfigure. If you open up the Converters preference again, you should see new entries there for SVG to PNG, SVG to EPS, and SVG to PDF. Once you have them, everything should work fine. You do NOT have to add the converters yourself; they will be automatically added when LyX detects Inkscape on the path during a reconfigure operation

To add the PATH to Inkscape on Mac OS they state:

MacOS X

In the Preferences under Paths you should append :/Applications/Inkscape.app/Contents/Resources/bin at the end if you have Inkscape installed at the default location. (Make sure a colon separates it from the other entries.) Then Save and choose Tools->Reconfigure. After a restart, in the Preferences there should now be listed three converters for SVG.

Now graphics look well!

  • But only some hours later. Maybe I need more reputation to do it directly. Good that you remind me – nnn Nov 3 '15 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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