SVG images can be included with the \includesvg command form the svg package. Under the hood this calls Inkscape and generates PDFs from the SVG files together with extra LaTeX files called <svg_name>-tex.pdf_tex that import the generated PDFs. These files are located by default under ./svg-inkscape in the LaTeX project root.
Problem is arXiv naturally does not run Inkscape so the submission fails unless the user manually replaces the \includesvg calls to \includeinkscape calls pointing to the generated files. The user should then manually delete the SVG files before submitting.
Currently arxiv-latex-cleaner does not copy SVG files nor the generated files since .svg is in the list of extensions to delete and the generated files are effectively not referenced by any LaTeX command in the parsed files.
Solution
This PR implements the process described above the user currently needs to manually go through. This is toggled with the --svg_inkscape option. By default this will scan the generated files under ./svg-inkscape in the input directory, but the user can provide an alternative path in case they set a different inkscapepath when loading the svg package.
Note
One reason why this could be implemented so easily is thanks to a potential harmless mistake (?) in the code. By simply replacing \includesvg{figure.svg} with \includeinkscape{svg-inkscape/figure-tex.pdf-tex}, the cleaner can now trace the generated PDF files all the way from the main .tex file because the .pdf-tex files actually match the .tex$ pattern here and are thus successfully considered as LaTeX code.
This PR adds support for the
svg
package.Problem description
SVG images can be included with the
\includesvg
command form thesvg
package. Under the hood this calls Inkscape and generates PDFs from the SVG files together with extra LaTeX files called<svg_name>-tex.pdf_tex
that import the generated PDFs. These files are located by default under./svg-inkscape
in the LaTeX project root.Problem is arXiv naturally does not run Inkscape so the submission fails unless the user manually replaces the
\includesvg
calls to\includeinkscape
calls pointing to the generated files. The user should then manually delete the SVG files before submitting.Currently
arxiv-latex-cleaner
does not copy SVG files nor the generated files since.svg
is in the list of extensions to delete and the generated files are effectively not referenced by any LaTeX command in the parsed files.Solution
This PR implements the process described above the user currently needs to manually go through. This is toggled with the
--svg_inkscape
option. By default this will scan the generated files under./svg-inkscape
in the input directory, but the user can provide an alternative path in case they set a differentinkscapepath
when loading thesvg
package.Note
One reason why this could be implemented so easily is thanks to a potential harmless mistake (?) in the code. By simply replacing
\includesvg{figure.svg}
with\includeinkscape{svg-inkscape/figure-tex.pdf-tex}
, the cleaner can now trace the generated PDF files all the way from the main.tex
file because the.pdf-tex
files actually match the.tex$
pattern here and are thus successfully considered as LaTeX code.