- edited description
nameref to label of \part
By default currentlabelname is not set by the definition of part in documentclasses.
However, to use \nameref of hyperref, part can be redefined for this purpose.
Would you consider making the redefinition of part in classicthesis compatible with nameref?
\documentclass{scrbook}
\usepackage[
parts,
]
{classicthesis}
\usepackage{hyperref}
% http://tex.stackexchange.com/questions/211035/problems-with-nameref-not-refering-to-the-correct-label-x-titlesec
\makeatletter
\let\oldpart\part
\def\part#1{\def\@currentlabelname{#1}\oldpart{#1}}
\makeatother
\usepackage[
capitalise,
nameinlink,
]{cleveref}
\begin{document}
\chapter*{Preface}
\label{chapt:preface}
We discuss in \emph{\cref{part:superpart} ``\nameref{part:superpart}''} the super results.
\part{Super Part}
\label{part:superpart}
This is the super part.
\end{document}
Official response
Comments (14)
-
reporter -
repo owner Thanks for the input. Ivo fixed a lot of things with the implementation of
\part
, so your work-around should work now:\makeatletter \let\oldpart\part \def\part#1{\def\@currentlabelname{#1}\oldpart{#1}} \makeatother
However, the part-number is still in lower-case, which has to be fixed...
-
repo owner - changed status to open
However, the part-number is still in lower-case, which has to be fixed...
-
repo owner -
assigned issue to
- marked as bug
- marked as major
-
assigned issue to
-
Part number is in lowercase because of \renewcommand{\thepart}{\roman{part}} in classicthesis.sty. One could change this to \renewcommand{\thepart}{\Roman{part}}, then however the TOC would look ugly - part numbers would be too tall. One could then change \renewcommand{\cftpartpresnum}{\scshape} to \renewcommand{\cftpartpresnum}{\scshape\MakeTextLowercase}, but this would only lowercase the first character of the roman number because of the primitive way these entries are written to the .toc file. It's pretty hopeless, I think, unless one really digs deep into how the .toc entries are being written. This differs between document classes.
How about we leave these instructions here for those few who really need it. The redefinition of \part above does not include \part* command, nor does it take into account that \part can have an optional argument (short title). Plus we have just gotten rid of an ugly and lengthy redefinition of the \part command, better not to go back there. My two cents.
-
repo owner - changed status to wontfix
Based on Ivo's work and assessment, this will not be fixed.
-
repo owner - changed status to closed
-
repo owner An ugly, but somehow ok-ish work-around is:
Part~\textsc{\ref{pt:showcase}}
-
An alternative workaround (from TeX stackexchange) which looks better to my eyes: In the preamble:
\usepackage{cleveref} \crefformat{part}{Part #2\MakeUppercase{#1}#3}
In the main text use
\cref
instead of\ref
(no need to manually write "Part"):Bla bla in \cref{sec:part}.
-
repo owner Thank you very much for you input and your patience. I will look into this for the next release.
-
repo owner - changed status to open
-
repo owner Thanks to kluth and Enrico Gregorio for this fix, will be in next release (to be tested for side effects).
-
repo owner - changed status to resolved
-
repo owner Fixed
#128,#160, and#172. Made progress on#163. Thanks to all contributers.→ <<cset 1f28ef06ecca>>
- Log in to comment
Thanks for the input. Ivo fixed a lot of things with the implementation of
\part
, so your work-around should work now:However, the part-number is still in lower-case, which has to be fixed...