2

Consider the following document:

\listfiles % for debugging
\documentclass{llncs}
\usepackage[colorlinks]{hyperref}
\begin{document}
\begin{theorem}\label{th}This is true.\end{theorem}
See \autoref{th}
\end{document}

I would expect the last line to be "See Theorem 1". But instead I get "See section 1". References to figures and tables work fine, but not lemmas and theorems. Any clue what might be wrong? Any clue how to fix or workaround it? (Well, I guess the obvious workaround is use \ref instead of \autoref, but...)

File list from 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
    The problem also arises with version 2016/06/24 v6.83q of hyperref. – Mico Jun 30 '16 at 2:20
  • 1
    Interestingly, \cref (of the cleveref package) gets the label right, i.e., it produces "theorem 1" rather than "section 1". – Mico Jun 30 '16 at 2:30
  • @Mico: There was a specific cleveref support update made by David. – Werner Jun 30 '16 at 3:23
3

The current version of llncs.cls (2015/06/24 v2.20) issues an additional \phantomsection as part of a theorem-related construction. As such, you would see the same behaviour when using a case, conjecture, corollary, definition, example, ...

Old 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}}}

New 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}}}

The easiest solution is to use a patch:

enter image description here

\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}
  • I wonder why they put the phantom section in the first place. It's not even mentioned in the history.txt file. Hopefully I'm not going to regret patching it out. In any case, works like a charm! Thanks!!! – Mark Jun 30 '16 at 5:34
  • @Mark: If the patch fails it can only be because they've removed \phantomsection from the macro, or its construction is different altogether. Best would be to bring this change to the attention of the journal editors. – Werner Jun 30 '16 at 6:38
  • No, the patch works! I was merely wondering why they put \phantomsection there in the first place. – Mark Jun 30 '16 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.