On 25/11/2018 11:57, Baris Erkus wrote:
On 11/23/2018 5:13 PM, Bernt Lie wrote:
I use LyX 2.3.1 on Windows 10, 64 bit.
It seems like LyX sometimes has problems handling SVG files,
specifically lines with arrow heads.
Here is one example; the original file in Inkscape:
In Inkscape, this looks fine. However, when I import this svg file
into a LyX float figure, this is what it looks like:
Observe that some of the arrowheads seems to have a “broken neck”...
If I generate a pdf from Inkscape and import the drawing as a pdf into
LyX, then there is no problems. But then the preview in LyX looks
pixelated.
Q: where is the problem? Is it Inkscape that uses corrupted svg files,
or is it LyX that doesn’t properly handle arrow heads?
-B
Hello,
I am following this post and just want to make sure if I got it right:
* SVG files are not supported by LaTeX directly, am I right? According
to this StackExchange post
<https://tex.stackexchange.com/questions/2099/how-to-include-svg-diagrams-in-latex>,
there are some tricky and tedious ways to include an SVG file
without converting it to PDF, but they do not seem to be as
efficient as including a PDF file and compiling with pdflatex.
* From the discussion, it is my understanding that LyX comes with an
external tool to convert an SVG file to an insertable format.
Obviously, the result will be as good as the tool's capability
provided, and the issues with the result should be associated with
that tool, not LyX. Did I get this correct?
* So, if I would like to include an SVG file into my LyX (or LaTeX
file), it may be a good idea to export it to a LaTeX compatible
format (e.g. PDF) externally and make sure the conversion is
acceptable first. I can use different tools such as InkScape,
ImageMagick etc.
* Alas, it is my experience that it is not always guaranteed to get a
perfect PDF, particularly when working with quite fragile formats
such as SVG or WMF or Extended WMF. For sensitive figures as the one
given in this post, it may be a good investment to kill some time to
learn Tikz or PSTricks (personally my favorite is TikZ; I can
prepare the attached figure in 30 to 60 mins).
* One question I have is, which tool is used to prepare the attached
SVG? Or is it taken from an external party? If it is prepared by a
tool such as InkScape, is it possible to save it as PDF from the
source?
* So, my suggestion here is not to spend too much time on inserting
SVG into LaTeX through conversion. For this specific example, I
would even prefer to get a screen shot with high resolution and
include it as PNG into LyX. For the future, I would concentrate on
tools such as Tikz.
-- Baris
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Please bottom-post. Start your reply here:
The problems seems to be particularly about how the graphic is shown in
LyX (not about the output with LaTeX). LyX uses a different converter
for the two. In the former case this is a conversion to bitmap (SVG ->
PNG) and we try to figure out whether there is a way to get the arrows
show up correctly in LyX by using another PNG conversion.
As mentioned in the post conversion to PDF first seems to be no option
unless one can fix the pixelation of imported PDF files in LyX (again in
the preview not in the output).
Yes, I guess wrapping TikZ/PSTricks into a preview might be an alternative.
Daniel