0

When creating a standalone document to convert it into a PNG file, I get an error if I include the SVG package.

MWE

%\documentclass{standalone}
\documentclass[convert={density=720,outext=.png}]{standalone}
\usepackage{svg}

\begin{document}

\includesvg{se}

\end{document}

Without the convert option it works perfectly. With the convert option I get the following error:

(/usr/local/texlive/2020/texmf-dist/tex/latex/svg/svg.sty
Package: svg 2020/05/07 v2.02f (include SVG pictures)
 (/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbase.sty
Package: scrbase 2020/04/19 v3.30 KOMA-Script package (KOMA-Script-independent basics and keyval usage)


! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.478 \FamilyProcessOptions{KOMA}
                                 \relax
? 
! Emergency stop.

I have tried to compile using both, pdftex and luatex, and get the same result.

Does anyone know what the reason for this error is, and how to solve it? Thanks for the help beforehand!

9
  • 1
    What is in se.svg?
    – daleif
    Jun 30, 2020 at 12:14
  • Also are you sure this is the actual error and not just the end of the log? Because I get this error just over the line where svg.sty is loaded: Class standalone Warning: Conversion failed! Please ensure that shell escape (standalone) is enabled (e.g. use '-shell-escape').
    – daleif
    Jun 30, 2020 at 12:18
  • No, I can confirm that problem. It seems to be related to the svg package, not the \includesvg{se}. If I replace \includesvg{se} by test in your MWE and compiles with pdflatex --shell-escape file.tex I get the same error
    – daleif
    Jun 30, 2020 at 12:22
  • You probably need to report this to the maintainer of the svg package. I'm not sure it makes sense loading scrbase.sty in this context or what ever it is svg is trying to do.
    – daleif
    Jun 30, 2020 at 12:29
  • Try to move the configuration out of the class options. svg is using the keyval parser from KOMA and seems to get confused by the option. \documentclass[convert]{standalone} \standaloneconfig{convert={density=720,outext=.png}} could work. Jun 30, 2020 at 12:34

1 Answer 1

1

Imho it is a standalone error. It cleans up the \@classoptionslist but not the list from xkeyval, and then scrbase fails on it. You can redefine the list:

\documentclass[convert={density=720,outext=.png}]{standalone}
\makeatletter 
\def\XKV@classoptionslist{} %empty or with whatever option you want to pass on.
\makeatother 

\usepackage{svg}

\begin{document}

\includesvg{se}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.