请考虑以下文档:
\listfiles % for debugging
\documentclass{llncs}
\usepackage[colorlinks]{hyperref}
\begin{document}
\begin{theorem}\label{th}This is true.\end{theorem}
See \autoref{th}
\end{document}
我原本以为最后一行是“参见定理 1”。但我得到的却是“参见第 1 节”。引用图表和表格没问题,但引用引理和定理不行。有什么线索可能出错了吗?有什么线索可以修复或解决这个问题吗?(好吧,我猜最明显的解决方法是使用 \ref 而不是 \autoref,但是……)
文件列表来自listfiles
:
*File List*
llncs.cls 2015/06/24 v2.20
LaTeX document class for Lecture Notes in Computer Science
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
multicol.sty 2016/04/07 v1.8p multicolumn formatting (FMi)
aliascnt.sty 2009/09/08 v1.3 Alias counter (HO)
remreset.sty
hyperref.sty 2016/05/21 v6.83p Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2016/05/14 v3.1 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2016/05/21 v6.83p Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hpdftex.def 2016/05/21 v6.83p Hyperref driver for pdfTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
color.sty 2016/06/02 v1.1d Standard LaTeX Color (DPC)
color.cfg 2016/01/02 v1.6 sample color configuration
pdftex.def 2016/06/17 v0.06h Graphics/color for pdfTeX
supp-pdf.mkii
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
test.out
test.out
***********
答案1
当前版本llncs.cls
(2015/06/24 v2.20)\phantomsection
在定理相关构造中附加了一条内容。因此,在使用case
、conjecture
、corollary
、definition
、时,您会看到相同的行为example
...
老的llncs.cls
:
1065: \def\@spthm#1#2#3#4{\topsep 7\p@ \@plus2\p@ \@minus4\p@
1066: \refstepcounter{#1}%
1067: \@ifnextchar[{\@spythm{#1}{#2}{#3}{#4}}{\@spxthm{#1}{#2}{#3}{#4}}}
新的llncs.cls
:
1065: \def\@spthm#1#2#3#4{\topsep 7\p@ \@plus2\p@ \@minus4\p@
1066: \refstepcounter{#1}\phantomsection
1067: \@ifnextchar[{\@spythm{#1}{#2}{#3}{#4}}{\@spxthm{#1}{#2}{#3}{#4}}}
最简单的解决方案是使用补丁:
\documentclass{llncs}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@spthm}{\phantomsection}{}{}{}
\makeatother
\begin{document}
\begin{theorem}\label{thm:theorem}This is a theorem.\end{theorem}
See \autoref{thm:theorem}.
\end{document}