How to add color box to a non-citation reference?

Hello. If you want to reference correct numbering for all elements, then you can just do:

#show ref: it => {
  // Skip bibliography citations.
  if it.element == none { return it }
  box(stroke: 1pt + green, outset: (bottom: 1.5pt, rest: .5pt), it)
}

#let bib = ```yaml
cite:
  type: article
  author: Author
  title: Title
```.text

#set heading(numbering: "1.")
#set math.equation(numbering: "(1)")

= Heading <heading>
#figure([], caption: []) <figure>
#figure(table(), caption: []) <table>
$ x $ <equation>

@heading

@figure

@table

@equation

@cite

#bibliography(bytes(bib))

Your code uses heading counter for all elements which is semantically incorrect.

3 Likes