7

As the title says, how can you reference a chapter or section title when using cref? To be more clear: I do not want the label "section" or "chapter", I want the actual title of the chapter or section..

\documentclass{article}
\usepackage[norsk]{babel} 
\usepackage{tabularx}
\usepackage{apacite}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage[norsk,nameinlink]{cleveref}
\begin{document}

\section{Title}


\section{another title}
%I want to reference the first section here, with its name


\end{document}
  • 2
    Add a \label so you have something to refer to. Then use \cref{label name} and \nameref{label name} for the title. – daleif Mar 12 '15 at 10:01
  • so cleveref dont have a command similar to nameref? I would want the name clickable.. – miniHessel Mar 12 '15 at 10:06
  • @miniHessel related: 1, 2, 3 – egwene sedai Mar 12 '15 at 10:08
  • @egwenesedai no, not at all. I am talking about cleveref. – miniHessel Mar 12 '15 at 10:10
  • @miniHessel, did you test it. The name is clickable. – daleif Mar 12 '15 at 10:10
11

This:

\documentclass{article}
\usepackage[norsk]{babel} 
\usepackage{tabularx}
\usepackage{apacite}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage[norsk,nameinlink]{cleveref}
\begin{document}

\section{Title}


\section{another title}
\label{sss}
%I want to reference the first section here, with its name

nameref: \nameref{sss}\\
cref: \cref{sss}\\
ref: \ref{sss}

\end{document}

Gives this after 2 or 3 compilations:

enter image description here

  • 1
    Where does the avsnitt come from? – Trylks Apr 14 '15 at 17:16
  • 1
    @Trylks From the Norsk language? – yo' Apr 14 '15 at 17:19
  • I see, so it means "section" I guess. I was asking because I have a related problem but it seems to be different. Thank you. – Trylks Apr 14 '15 at 18:12
2

So, if I understand the comments and suggestions correctly:

Cleveref actually don't have a function equal to nameref, so the solution is to use normal \nameref

  • 2
    Yes, exactly. Why in the world would it double something that is (1) painful to implement and (2) perfectly done by hyperref?! – yo' Mar 12 '15 at 10:13
  • I just thought the best "approach" would be to use one of them through the whole document. Guess I got blinded by that. – miniHessel Mar 12 '15 at 10:17

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.