Custom output for reference to custom header function

I had to create a custom header function for a findings report. The reason for that is that these findings are supposed to render like a level 1 header, but not behave like one logically.

I want to be able to reference these findings in text with @<finding>. My issue is that the output is just “Section” for every finding. How can i customize what is actually output in the final document for the reference of this custom function?

Below is the logic of the header function.

#let finding_header(
  content, 
  identifier: none,
  finding_id: none,
) = {
  let h = heading(level: 2)[
    #set text(
      font: "Lato",
      weight: "semibold",
      size: 20pt,
    )
    #set par(leading: 24pt - 20pt)
    #content
  ]

  if identifier != none and finding_id != none {
    [#h #label(str(identifier) + str(finding_id))]
  } else {
    h
  }

  v(9mm)
}

The supplement parameter of heading() is what you are looking for.

  let h = heading(
    level: 2,
    supplement: [Finding]
  )[
    //...
  ]

Thanks! Works perfectly.

1 Like