From 53dfb1e8ebedf4f6bb281d768ad60ed33f7bf69d Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph@weston.cloud>
Date: Wed, 15 May 2019 15:17:08 +0200
Subject: [PATCH] convert SVG to PDF when using latex builder

---
 .gitlab-ci.yml     | 6 ++++--
 doc/source/conf.py | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 30c4ec70..a3ef10b2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -239,7 +239,8 @@ build documentation:
     - build:latest
   stage: test
   script:
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx
+    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
+    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
     - python -m ipykernel install --user --name kwant-latest
     - make -C doc clean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W -D jupyter_execute_default_kernel=kwant-latest' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
   artifacts:
@@ -253,7 +254,8 @@ build PDF documentation:
     - build:latest
   stage: test
   script:
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx
+    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
+    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
     - python -m ipykernel install --user --name kwant-latest
     - make -C doc latex SPHINXOPTS='-n -W -D jupyter_execute_default_kernel=kwant-latest'
     - cd doc/build/latex
diff --git a/doc/source/conf.py b/doc/source/conf.py
index da68f06b..080a71ff 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -38,7 +38,8 @@ sys.path.insert(0, os.path.abspath('../sphinxext'))
 
 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary',
               'sphinx.ext.todo', 'sphinx.ext.mathjax', 'numpydoc',
-              'kwantdoc', 'sphinx.ext.linkcode', 'jupyter_sphinx.execute']
+              'kwantdoc', 'sphinx.ext.linkcode', 'jupyter_sphinx.execute',
+              'sphinxcontrib.rsvgconverter']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['../templates']
-- 
GitLab