diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 30c4ec70313a00d850633bf103e799ece107c923..a3ef10b22292cf12ec26d224aae75e1409dc8c23 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 da68f06bf8e783bb9768869317b49dc38bbf7ccd..080a71ff0039aaf8528ddf692c45e1569050697a 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']