尝试编译此文档时:
\documentclass{article}
\usepackage{hyperref}
\usepackage{subcaption}
\usepackage{svg}
\begin{document}
\end{document}
我收到以下错误消息:
<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.
完整形式:
! 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.
?
显然指的是\begin{document}
。为什么会出现此错误?如果我注释掉任何使用的包,错误消息就会消失,文档编译过程也会正常退出,但更改文档类似乎没有任何区别。因此,这三个包的组合似乎出于某种原因有问题。但为什么呢?
答案1
不幸的是,svg
加载了大量与 svg 包含本身不直接相关的包,其中包括subfig
与 不兼容的包subcaption
。您可以subfig
通过以下方式禁止包含:
\documentclass{article}
\usepackage{subcaption}
\expandafter\def\csname [email protected]\endcsname{}
\usepackage{svg}
\usepackage{hyperref}
\begin{document}
\end{document}