I was trying to make a document with an outline as well as headings with labels, and links to those headings. Minimal example:
#outline()
#link(<Foo>)[Go to Foo]
#heading[Foo <Foo>]
However, this naive construction leads to the following error:
error: label `<Foo>` occurs multiple times in the document
┌─ main.typ:2:1
│
2 │ #link(<Foo>)[Foo]
│ ^^^^^^^^^^^^^^^^
It doesn’t matter what the label is (e.g. heading Foo with the label <Bar> complains that the label <Bar> appears multiple times). Removing either the call to outline or the call to link resolves the error, however I conceptually need both.
What’s the usual workaround for this? In my actual use-case, I’m generating the headers/labels from input data. This seems like a fairly common edge-case to hit, but after a few hours of searching docs and forums I haven’t found anyone else mentioning this issue. I can, but would rather not, generate the outline manually.