Is there a way to make a cross reference to a label of a header with custom text? That is, its text should differ from the Header text, or its number or page (not like the predefined formats in Lyx). Something like the the hyperlinks or bookmarks in MS word, and in such a way that I can write the different text for each cross-reference individually. I'm not looking to define a new format for the references.

For example, if the header text is "State and Path functions", I want to make a cross reference to it with the text "state function".

1 Answer 1


With the package hyperref you can use the optional argument of \hyperref to reference a \label with arbitrary text:

\section{Hello World}
Reference to \hyperref[sec:hello]{this section}.


  • Why wouldn't you just write "Reference to this section", then? The reference doesn't seem to do anything?
    – user56834
    Dec 13, 2017 at 7:28
  • 11
    @Programmer2134 Then, I would not have a short simple example that shows the usage of \hyperref with the optional argument. Dec 13, 2017 at 16:52
  • 2
    @user56834 when you are looking at a pdf of the document, referencing the section means the text is clickable. So the reference makes the text "this section" a button which, when pressed, takes the reader to that section.
    – Kraigolas
    Aug 5, 2019 at 0:33
  • 1
    Is there a way to define the custom text once at the label rather than each time at the reference?
    – CGFoX
    Feb 22, 2021 at 9:59
  • 3
    @CGFoX A label has already a text ("1" in the example above), that is shown by \ref. In case of section titles, packages nameref or titleref can be used to get a reference with the title instead. Feb 23, 2021 at 19:11

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.