# How to use svgZ with \includesvg?

I am trying to load an SVGZ using \includesvg. It always looks for the SVG instead of the svgz (see error below). I know I can unzip the SVGZ to get the SVG, but I would prefer using SVGZ to keep the file size smaller.

There's no file test.svg'
in folder images/'.


My code:

\begin{figure}[!h]
\centering
\includesvg[width=\textwidth]{images/test.svgz}
\caption{test}
\end{figure}

• (1) welcome, (2) please make a full minimal example, not all uses are familiar with \includesvg (3) are you sure svgz is even supported? – daleif Jul 10 '18 at 13:36
• I don't think svgz files are supported. You might want to automate this by a shell escape and unzipping it. – percusse Jul 10 '18 at 13:38
• Thank you for the quick response, I just checked the documentation and as you both expected svgzis not supported :( mirror.hmc.edu/ctan/graphics/svg/doc/svg.pdf – HennyKo Jul 10 '18 at 13:52
• Although it probably does not help much for vector images, you could try to save the svg as pdf (using Inkscape etc.) and see if the pdf compression algorithms can reduce the filesize. Otherwise you might be able to simplify the svg file in the program that created the file, or avoid it altogether and recreate the image in LaTeX (if it is some kind of plot or diagram, for example). – Marijn Jul 10 '18 at 13:58

The svg package calls Inkscape to convert a SVG file to PDF. And Inkscape can handle SVGZ files. You just need to give the option svgextension=svgz.

\documentclass[a4papaer]{article}
\usepackage{svg}
% by default graphic and text is split, so text can be set with LaTeX
% I did not want this here
\svgsetup{inkscapelatex=false}
\begin{document}
\begin{figure}[!h]
\centering
\includesvg[svgextension=svgz,width=\textwidth]{example-image.svgz}
\caption{test}
\end{figure}
\end{document}