[Tex/LaTex] Undefined control sequence at: “\begin{document}”

errorshyperrefsubcaptionsvg

When trying to compile this document:

\documentclass{article}

\usepackage{hyperref}
\usepackage{subcaption}
\usepackage{svg}

\begin{document}

\end{document}

I get the following error message:

<path-to-source-folder>\mwe.tex:7: Undefined control sequence
The control sequence at the end of the top line
of your error message was never \def'ed.

full form:

! Undefined control sequence.
<argument> \sf@counterlist 

l.8 \begin{document}

? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

? 

which obviously refers to \begin{document}. Why do I get this error? If I comment out any of the used packages the error messages disappears and the document compile process exits normally, but changing the document class doesn't seem to make any difference. So it seems like the combination of these three packages for some reason is problematic. But why?

Best Answer

unfortunately svg loads a load of packages not directly related to svg inclusion itself including subfig which is incompatible with subcaption. You can suppress subfig inclusion by:

\documentclass{article}


\usepackage{subcaption}
\expandafter\def\csname ver@subfig.sty\endcsname{}


\usepackage{svg}
\usepackage{hyperref}

\begin{document}




\end{document}