Section/subsection links point to the wrong place

Issue #152 resolved
Csaba Hajdu created an issue

I'm writing my thesis using ClassicThesis and I'm really happy with the package.

I ran into a problem I haven't been able to fix, neither could I find any information online and now I'm pretty sure it's caused by the ClassicThesis package.

It appears that links to sections and subsections (in the TOC and from cross-references) point to the end of the preceding sectioning unit, which is fine in general. It looks a bit awkward if the previous sectioning unit ends at a page break, and it becomes quite annoying if there is at least one float stuck in between.

I wrote the following MWE to demonstrate the issue:

\documentclass[a4paper]{scrartcl}

\usepackage{lipsum}
\usepackage[demo]{graphicx}

%\usepackage{classicthesis}
\usepackage{hyperref}


\begin{document}

    \tableofcontents
    \clearpage

    \section{A section}
        \lipsum[2-6]

        \begin{figure}
            \centering

            \includegraphics[width=8cm, height=15cm]{dummy}
            \caption{Test figure.}
        \end{figure}

        \begin{figure}
            \centering

            \includegraphics[width=2cm, height=15cm]{dummy}
            \caption{Test figure number 2.}
        \end{figure}

%   \section{\label{sec:another}Another section}
    \subsection{\label{sec:another}A subsection}
        \lipsum[1-4]

    \section{Yet another section}
        \lipsum[24]

        \autoref{sec:another}

        \lipsum[18]

\end{document}

When using hyperref, the links to Section 1.1 work as expected. However, when switching over to ClassicThesis, both the link in the TOC and the link in running text point to the bottom of page 2, which is 2 pages off from the correct location in this case...

The situation is identical if the subsection is changed to a section. I haven't tried for other sectioning unit types.

I tried compiling with CT v4.4 and v4.5, on both MikTeX and TeXlive.

I would be really grateful if you could give me any pointers. Thank you very much!

Comments (7)

  1. Csaba Hajdu reporter

    Dear Ivo,

    That was quick, thank you very much! The new version does indeed fix the problem in my thesis and in the MWE I posted.

    I noticed a new problem, however. After your changes, it seems to me that the following code section in classicthesis-config.tex in https://bitbucket.org/amiede/classicthesis/src/PI-proposals/ is overridden:

    % ********************************************************************
    % 6. Setup autoreferences
    % ********************************************************************
    % There are some issues regarding autorefnames
    % http://www.ureader.de/msg/136221647.aspx
    % http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords
    % you have to redefine the makros for the
    % language you use, e.g., american, ngerman
    % (as chosen when loading babel/AtBeginDocument)
    % ********************************************************************
    \makeatletter
    \@ifpackageloaded{babel}%
      {%
        \addto\extrasamerican{%
          \renewcommand*{\figureautorefname}{Figure}%
          \renewcommand*{\tableautorefname}{Table}%
          \renewcommand*{\partautorefname}{Part}%
          \renewcommand*{\chapterautorefname}{Chapter}%
          \renewcommand*{\sectionautorefname}{Section}%
          \renewcommand*{\subsectionautorefname}{Section}%
          \renewcommand*{\subsubsectionautorefname}{Section}%
        }%
        \addto\extrasngerman{%
          \renewcommand*{\paragraphautorefname}{Absatz}%
          \renewcommand*{\subparagraphautorefname}{Unterabsatz}%
          \renewcommand*{\footnoteautorefname}{Fu\"snote}%
          \renewcommand*{\FancyVerbLineautorefname}{Zeile}%
          \renewcommand*{\theoremautorefname}{Theorem}%
          \renewcommand*{\appendixautorefname}{Anhang}%
          \renewcommand*{\equationautorefname}{Gleichung}%
          \renewcommand*{\itemautorefname}{Punkt}%
        }%
          % Fix to getting autorefs for subfigures right (thanks to Belinda Vogt for changing the definition)
          \providecommand{\subfigureautorefname}{\figureautorefname}%
        }{\relax}
    \makeatother
    

    My solution was to move it after the new location of the hypersetup section, and now everything works fine as far as I can tell. Thank you very much once more!

  2. Csaba Hajdu reporter

    Thanks!

    Another small suggestion (so small I figured I wouldn't even make it into a separate issue):

    In classicthesis-config.tex at 3bfeeb9, the option pdfpagemode is set twice on line 179.

  3. Ivo Pletikosić

    Good eye, Csaba! That's been there for ages. I'll try to remember to remove the first occurrence of the option by our next release.

  4. André Miede repo owner

    Thanks also from my side, the double occurrence is already fixed for the next release.

  5. Log in to comment