I am creating a long PDF report using Quarto. I want to include two formats of cross-reference:
- To the section/figure number, e.g.
As discussed in Section 3.1
- To the section/figure title, e.g.
As discussed in My awesome section.
It is possible to achieve either like this:
---
format:
pdf:
number-sections: true
---
# Why Stack Overflow is so great {#sec-stack}
I can use style 1, the section number, with the explicit ID, e.g. as seen in @sec-stack.
I can use style 2, the section title, with a link [Why Stack Overflow is so great].
I can also custom text with [Custom text before the link][Why Stack Overflow is so great].
This produces the desired output:
Problem
The problem is that the document is being redrafted by several authors. If a section title is changed from Why Stack Overflow is so great to Why I love Stack Overflow, it breaks the cross-references using the second style (section title).
I am looking for a way to refer to a section using the explicit identifier @sec-stack
, and have it display the title instead of the section number. This would be something like [@sec-stack]
rather than @sec-stack
.
There are various options in the Quarto cross-referencing docs. However, I can't see a way to make it so that cross-reference text updates if the section title is updated, provided the explicit identifier remains the same.
Does this exist?