2

I need to refer to a model described elsewhere, from a section title, like

\section{Analysis of model X} 

One way of referring to a model is to create a new counter, and then write

\section{Analysis of \cref{grandmodelofeverything}}

But now hyperref will complain because of invalid token, and it does not look good in the TOC either, especially since the titles of the sections the describe the models are more descriptive than

\section{Model 1}

They are currently like

\section{Adding the effect from Y processes}

Do I need to invent semi-descriptive long names like "The model by Authors with this modification" or can I live with these quirks?

lockstep
  • 250,273
  • 2
    As with everything else on this site. You are much much more likely to get help if you take the time to provide a minimal example that others can copy and use on their own systems without having to add anything. – daleif Jul 22 '15 at 12:54
  • @daleif What more is needed. I get everything work as expected, though I am not really happy with the result. – user877329 Jul 22 '15 at 12:57
  • There is no document class, no preamble. Basically the smallest document you can make, that can be copied to a new file and compiled as is. – daleif Jul 22 '15 at 13:04
  • @Though I ask for a reference model, that is independent on whatever tools you use to write: TeX, HTML, Word. Maybe the question belongs on Writers – user877329 Jul 22 '15 at 13:07
  • Still why should we waste a lot of time adding stuff to an example when you, the user, is the only one who knows which packages and class is used in your document. – daleif Jul 22 '15 at 13:09
  • @daleif Because you already know what will happen. You will get the model number in the section title, and a link to the label, but hyperref does not like links inside links, so it emits the warning. I argue that my approach to label the abstract things is not good. – user877329 Jul 22 '15 at 13:12
  • 3
    You are on your own. See most other first comments on this site: Provide a compilable minimal example! Then you get help. Providing a solution and then the user reveals that he is also using this this and this package, which complicates things, just wastes the time of the person trying to help. – daleif Jul 22 '15 at 13:17
  • Related: \cref inside a heading breaks PDF bookmark -- basically, use \texorpdfstring to render a plain-text version of the header for the ToC and hyperlinks, and the hyperlinked version for the header in the body of the document. – Mike Renfro Jul 22 '15 at 15:32
  • \cref isn't expandable, so this is no good idea to use it in a section title. The comment by Mike Renfro is a good starter –  Jul 22 '15 at 16:43

1 Answers1

1

Perhaps this is what the O.P. wants to achieve? A \nameref*{}, i.e. without a link?

\documentclass{article}

\usepackage[bookmarksopen]{hyperref}

%\usepackage{cleveref} %Well, not needed here ;-)

\begin{document}
\tableofcontents

\section{Analysis of \nameref*{something}}

\section{Model X}\label{something}


\end{document}

enter image description here