Search code examples
pdfsvglatexpython-sphinxpdflatex

Sphinx documentation: Include svg images in PDFs via latex


I'm doing an internship for an IT company which needs a document application for its firmware docs (md files).

The request was to maintain these md files and to convert them to rst format (I used pandoc). So now I have a configured Sphinx application with only rst files. The problem now is that some rst have links to SVG images, and I have to use the latex builder of Sphinx to convert them to PDFs.

I've searched around and I found this solution from 2 years ago, which was essentially what I was looking for: https://sites.google.com/site/nickfolse/home/sphinx-latexpdf-output-with-svg-images. I tried to implement it but I'm not an expert with GNU makefiles and I don't know if the current version of Sphinx allows it or if it is out there an easy workaround, so the thing didn't succeed.

Does someone have a viable solution for this?


Solution

  • At this time, SVG is still not supported. I work around it in Pyramid docs by exporting the original file (OmniGraffle) to both SVG and PNG.

    In docs/narr/router.rst:

    .. image:: ../_static/pyramid_request_processing.*
    

    And we place images in docs/_static.

    The HTML uses SVG and the PDF uses PNG.