diff --git a/nbconvert/exporters/pdf.py b/nbconvert/exporters/pdf.py index 4226b44b7..97843536f 100644 --- a/nbconvert/exporters/pdf.py +++ b/nbconvert/exporters/pdf.py @@ -60,7 +60,7 @@ class PDFExporter(LatexExporter): latex_count = Integer(3, help="How many times latex will be called.").tag(config=True) latex_command = List( - ["xelatex", "{filename}", "-quiet"], help="Shell command used to compile latex." + ["xelatex", "-shell-escape", "{filename}", "-quiet"], help="Shell command used to compile latex." ).tag(config=True) bib_command = List(["bibtex", "{filename}"], help="Shell command used to run bibtex.").tag( diff --git a/share/templates/latex/base.tex.j2 b/share/templates/latex/base.tex.j2 index 493130b07..2b3c0a8a7 100644 --- a/share/templates/latex/base.tex.j2 +++ b/share/templates/latex/base.tex.j2 @@ -20,8 +20,6 @@ override this.-=)) \usepackage{graphicx} % Keep aspect ratio if custom image width or height is specified \setkeys{Gin}{keepaspectratio} - % Maintain compatibility with old templates. Remove in nbconvert 6.0 - \let\Oldincludegraphics\includegraphics % Ensure that by default, figures have no caption (until we provide a % proper Figure object with a Caption API and a way to capture that % in the conversion process - todo). @@ -93,6 +91,23 @@ override this.-=)) % normalem makes italics be italics, not underlines \usepackage{soul} % strikethrough (\st) support for pandoc >= 3.0.0 \usepackage{mathrsfs} + \usepackage{svg} % enable support for rendering SVGs via Inkscape + \makeatletter + % Hook to includgraphics to pass SVGs to \includesvg + \let\includegraphics@original\includegraphics + % Hook + \renewcommand{\includegraphics}[2][]{% + \def\svgextension{svg} + \filename@parse{#2}% + \ifx\filename@ext\svgextension + \includesvg[#1]{#2} + \else + \includegraphics@original[#1]{#2} + \fi + }% + \makeatother + % Maintain compatibility with old templates. Remove in nbconvert 6.0 + \let\Oldincludegraphics\includegraphics ((* endblock packages *)) ((* block definitions *))