# Undefined control sequence at: “\begin{document}”

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?

• You have reformatted the error message removing the information about which command is undefined. That is \sf@counterlist  – David Carlisle Nov 21 '14 at 14:56
• @DavidCarlisle, how do you mean I have reformatted the error message? All I have done is replaced the actual path to the folder with <path-to-source-folder> and ended the error message earlier, because what I could see it didn't provide any additional information about this specific case... or did it? – StrawberryFieldsForever Nov 21 '14 at 15:16
• I aded the message to the question as you can not format code in comments note the version you posted is abbreviated so makes no sense "at the end of the top line" refers to the first line of the message, which ends with \sf@counterlist which is therefore the command triggering the error – David Carlisle Nov 21 '14 at 15:20
• @DavidCarlisle, I still don't know what you mean by that I reformatted the error message. The message does not start with \sf@counterlist; I don't have that text anywhere in the log file. – StrawberryFieldsForever Nov 21 '14 at 15:57
• The log must have had the lines that I added to your question. are you looking at the .log file or the terminal output, or are you looking at some filtered view in a "tex editor" – David Carlisle Nov 21 '14 at 16:22

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}

• Thank you very much for this answer. With TeX Live 2016 something seems to have changed, because now I get an Package subcaption Error: This package can't be used in cooperation with the subfig package.` Is there a new workaround? – Roos Aug 18 '16 at 5:56