svg package and subcaption incompability

In this answer the solution is to suppress the load of the subfig package by this

\expandafter\def\csname [email protected]\endcsname{}

command. Unfortunately, this works for me only until TeX Live 2015.


I sent an email to the current maintainer of the svg package, and he replied with the following solution:

\RequirePackage{scrlfile}
\PreventPackageFromLoading{subfig}
\documentclass{article}
\usepackage{subcaption}
\usepackage{svg}
\usepackage{hyperref}
\begin{document}
test
\end{document}

Works like charm on MiKTeX on windows, I haven't tried another OS or TeX distribution. A new version of the svg package is likely to be released very soon, in which this issue will be fixed.


Extremely crude workaround:

Copy the svg.sty file to your project folder and simply comment out or remove the following line (line #40):

\@ifpackageloaded{subfig}{}{\RequirePackage{subfig}}%

So far, this doesn't produce any errors and correctly compiles svg files. Also works when I \includesvg the svg image files inside a subcaption environment.