I am trying to add a label and footnote to a heading like so:
#set page(paper: "a7")
#set heading(numbering: "1.")
= Recipe#label("rec")#footnote[adapted from pantry]
- five grams sugar
- ten grams flour
= Method
stir all items from @rec together
I get a
Cannot reference text (@rec) line 10
error.
If I change the syntax of assigning the label to <rec> and move the #footnote to a new line I can get it to compile, but then the footnote isn’t with the header:
#set page(paper: "a7")
#set heading(numbering: "1.")
= Recipe<rec>
#footnote[adapted from pantry]
- five grams sugar
- ten grams flour
= Method
stir all items from @rec together
Labels always need to be after whatever they are supposed to attach to. If you want to label a heading, it must be after the entire heading, including any footnotes in the header. Thus:
= Foo #footnote[Baz] <bar>
See @bar. // See Section 1.
is subtly different, as the label gets attached to the footnote and not the heading. This is because the <> syntax is special-cased to end the heading.
So according to the documentation, it seems like #label("bar") does not work for headings in markup mode, only <bar> is suitable? Do I understand that correctly?
And if I want to reference an element in the header but not the header itself, I then use #label("bar2")?
@Warp37, you haven’t wrapped the @rec references. If a user with this handle exists, they will get a notification from you, possibly spamming their email inbox.
Complex errors are wrapped in code block to prevent any issues with the error’s content.