|
Edit Links |
Tips /
UseInkscapeSVGImages
<< Using LyX with Tgif | Page list | WordCount >>
Include SVG Images in LyX Inkscape from http://www.inkscape.org/ can be used to configure LyX to directly include .svg images and automaticaly generate .PNG preview images in lyx and .EPS for latex. I use those settings for several months now and I am very happy with that solution, because inkscape is a great tool to draw vector graphics with and I don't have to keep the eps files up to date manually to match the svg files - LyX does that for me! Another great thing is, that inkscape exports text to eps as a whole and not single characters (you may not resize text blocks with the mouse to be sure about that). This is useful for psfrag. WindowsI have tested the scripts from SVG Files and Inkscape and the configuration below in Windows XP with LyX 1.4.2 and Inkscape 0.44. You need both, the Windows command script You can configure LyX in a few steps:
You need to restart and maybe reconfigure LyX. LinuxYou can configure LyX in a few steps:
[Note: Make sure you do not use the --export-text-to-path option when converting from SVG to EPS with Inkscape. Likewise, when exporting figures by hand via the Inkscape GUI, the checkbox labeled "Convert text to path" should be unchecked. See the Inkscape manual page for details.] You need to restart and maybe reconfigure LyX. Some have found using convert (ImageMagick) works better on Linux. Simply leave out the SVG -> PNG definition and LyX will generate an EPS from the SVG and a PNG preview from this. You can also use convert with Windows. Replace "inkscape EPS" and "inkscape PNG" with "convert" in the converter section. If you add a .svg image in LyX now the Preview should work and LyX converts the image into an EPS-image if that is needed by a LaTeX run. There is a bug in Inkscape 0.44: It does not export text correctly to EPS if the font name has spaces in it. In order to succeed in exporting text, it can be converted to "paths", by using the command in the conversion from SVG to EPS, that is the same command used in the instructions above with the -T options added. You can use psfrag (in ERTs) to replace text in the images with LaTeX Text and formulas (It would be great if LyX would support that without ERTs!). Mac OS XUnder Mac OSX, it should work just as described in the Linux section. You need to provide the full path to the inkscape executable, on my system, this is: /Applications/Multimedia/Inkscape.app/Contents/Resources/bin/inkscape because I have Inkscape.app installed in /Applications/Multimedia. LyX-Friendly Inkscape SettingsOn 3/17/2008 Steve Litt observed in LyX version 1.5.3 that Inkscape-produced .svg files could be directly placed in the LyX file, even without defining converters for SVG. Your mileage may vary. (This seems to use some fallback conversion and produce a bitmap graphic) If the SVG is converted to EPS, the size of the resulting graphic is automatically set to the size of the content.
For both, bitmap and PDF output, by default the size is set to the "paper-size" of the canvas (letter or A4).
In order to get a graphic that can be input in a LyX document,
the Inkscape drawing must be sized right. Either add
(either with Strg-A or dragging a rectangle around all elements with the mouse.)
Categories |