Nameref for chapter showing the previous subsection details

Issue #170 open
Sandeep George created an issue

I am not sure how this is supposed to work, for me when i use this template and i try to reference a \chapter’s label using nameref it pulls out the name from the previous section (the last available one)

When i change the chapter to a section, it pulls the right one. Is there something wonky that goes on when i try to nameref a chapter ?

Comments (6)

  1. Sandeep George reporter

    More examples

    In v4.6 i downloaded a fresh copy and added

    hello world this \ref{ch:introduction}--\nameref{ch:introduction}........
    

    This didnt work either ( the default version had compile errors when i tried to add a subsection). This did not work implies that after the emdash there was a blank it did not mention the chapter name.

    Interestingly this issue was not there in an olderversion of classic-thesis ( the one thats available on sharelatex) https://www.sharelatex.com/templates/thesis/classic-thesis though it doesn’t tell the version number.

  2. Ivo Pletikosić

    This is nameref clashing with (the way we use) titlesec. Namely, after v4.2 we introduced \titleclass{\chapter}{top} so that titlesec would treat chapters the same way it treats parts, sections, subsections etc - by writing to ClassicThesis.toc

    \contentsline {chapter}{\numberline {2}{Examples}}{13}{chapter.2} \contentsline {section}{\numberline {2.1}{A New Section}}{13}{section.2.1}

    instead of (note the missing { } around Examples)

    \contentsline {chapter}{\numberline {2}Examples}{13}{chapter.2} \contentsline {section}{\numberline {2.1}{A New Section}}{13}{section.2.1}

    This helps us format the table of contents with tocloft in a more consistent way.

    Now, unfortunately, nameref uses its own hacks (From nameref documentation: "This works by redefining some of the inside LATEX macros, so it is vulnerable to future changes."; also "Parts and chapters are treated differently. sigh.").

    I have to check if we can do anything about this. Removing only \titleclass{\chapter}{top} from classicthesis.sty would solve the issue with nameref, but the table of contents formatting for the chapters would be wrong.

  3. Sandeep George reporter

    @Ivo Pletikosić thankyou that helps with the nameref but as you pointed out the TOC formatting is now messed up. 😞 I was looking into hacking it with a temporary solution and im yet to find that.

  4. Log in to comment