Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: LaTeX and SVG

  1. #1
    Join Date
    Aug 2006
    Beans
    82
    Distro
    Ubuntu 10.04 Lucid Lynx

    LaTeX and SVG

    I'd like to include SVG graphics in LaTeX documents easily. The setup that I'm using right now, is to create the images in Inkscape, then convert them to TikZ code, and add it to the .tex file. This is, however, far from optimal. The code is huge, and I don't get some details (like arrow ends) converted correctly. I've tried converting to .eps and .png, but both turn out with very poor quality, even if I raise the resolution to 600dpi when exporting. Any ideas on how to have good quality graphics that are relatively small?

  2. #2
    Join Date
    Aug 2007
    Beans
    876
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: LaTeX and SVG

    This is weird. I use .eps all the time when exporting from Inkscape and haven't experienced any poor quality. The vector graphics are preserved just fine. Although, I find Adobe Reader doing far better job with the graphics in general, have you attempted to look at the compiled, I suppose .pdf, using Adobe Reader?

    Another approach for you, if you can use pdflatex is to export into .pdf, or convert into .pdf. Both approaches should work.

  3. #3
    Join Date
    Nov 2009
    Location
    Europe
    Beans
    3
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: LaTeX and SVG

    For my thesis, I used to export the figures from Inkscape as eps and than convert them into pdf using "epstopdf". Afterwards, I used pdflatex to create the documents. It worked fine for me. The figures were pretty small and good quality.

  4. #4
    Join Date
    Jan 2008
    Location
    Auckland, New Zealand
    Beans
    3,129
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: LaTeX and SVG

    You can export directly to PDF from Inkscape. That's what I do and it works really well.

    I use epstopdf with plots from Gnuplot though.

  5. #5
    Join Date
    Aug 2006
    Beans
    82
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: LaTeX and SVG

    How do I include those pdf images in my tex file?

    These are my files, so you can compare them. The grafico2.svg is the original Inkscape one. The grafico2.pdf is the one exported at 300dpi from Inkscape. The file grafico2.eps, was also exported from Inskcape at 300dpi. And grafico2tex.pdf is the pdf generated by pdflatex using TikZ. The best one i thought was grafico2.pdf, but I don't know how to include it in my file.

    Thanks for the help!

  6. #6
    Join Date
    Aug 2007
    Beans
    876
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: LaTeX and SVG

    You really should preserve the vector graphics and not rasterize it (i.e. in this case export -> picking resolution), that will ruin everything. Use Inkscape's "Save a Copy" or "Save As" functions.

    You can include the .eps or .pdf figs in your .tex by the standard graphics environment
    Code:
    \begin{figure}
    \includegraphics[width = \textwidth]{grafico2.eps} % Or .pdf
    \caption{Some histogram thingie}
    \label{fig:hist}
    \end{figure}

  7. #7
    Join Date
    Jan 2008
    Location
    Auckland, New Zealand
    Beans
    3,129
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: LaTeX and SVG

    Yeah, you include pdf images the same way you would include any other image. If you have both an eps and a pdf file in the same directory, you can ommit the file suffix and pdflatex will use the pdf and latex will use the eps. If you've got other formats with the same name in there too they might get used instead though.

  8. #8
    Join Date
    Aug 2006
    Beans
    82
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: LaTeX and SVG

    Thanks a lot, I think I'm gonna stick to the pdf versions I exported. They behave nice enough and are small. Thanks again.

  9. #9
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: LaTeX and SVG

    One important aspect is which Cairo version you have installed. The newer Cairo is, the more capabilities it has in preserving transparency and filters in the PDF. In some situations Cairo is forced to rasterize in order to represent the graphic in the PDF.

    You have cairo 1.8.8, which is good. And you can see that it doesn’t preserve transparent vectors in the EPS, while it does in PDF. It can’t properly represent your semi-translucent bar stroking so it rasterizes these parts of the graphic in the EPS file.

    See: http://en.wikipedia.org/wiki/Transpa..._in_PostScript

  10. #10
    Join Date
    Aug 2006
    Beans
    82
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: LaTeX and SVG

    Aha! That's why my transparencies weren't looking good. I'm thinking I'm gonna stick to pdf then. It's been working great. Thanks everyone.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •