Nameref for chapter showing the previous subsection details
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)
-
reporter -
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. -
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.
-
repo owner Thanks for pointing this out. As Ivo explained, this might be hard to resolve, I did some experiments with the alternatives (zref…) mentioned here https://texfaq.org/FAQ-nameref, but could not find a solution.
-
repo owner - changed status to open
-
repo owner -
assigned issue to
-
assigned issue to
- Log in to comment
More examples
In v4.6 i downloaded a fresh copy and added
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.