Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 626
VahnIronSky Avatar asked Sep 06 '25 00:09

VahnIronSky


1 Answers

Since Sphinx 1.6 version you can use bundled extension sphinx.ext.imgconverter for automatic conversion your SVG into PNG:

  1. Open your source/conf.py and add to extensions variable this string:

    extensions = [
        'sphinx.ext.imgconverter',
    ]
    
  2. Run build:

    make latexpdf
    
like image 170
Dunaevsky Maxim Avatar answered Sep 10 '25 14:09

Dunaevsky Maxim