How to add ‘cf.’ (compare) to citations in Typst?

You can use the following solution for footnote styles (from Add prenote for cite · Issue #3020 · typst/typst · GitHub):

#let pre-foot-data = state("pre-foots", (foots: (), prefixes: ()))

// NOTE: This show rule has to go at the top of the document, before any content / text.
#show footnote.entry: it => context {
  let foot-data = pre-foot-data.final()
  let foot-num = counter(footnote).at(it.note.location()).first()
  let foot-num-pos = foot-data.foots.position(s => s == foot-num)
  if foot-num-pos != none {
    let prefix = foot-data.prefixes.at(foot-num-pos)
    show super: it => it + prefix + sym.wj
    it
  } else {
    it
  }
}

#let pre-cite(..args, prefix: none) = {
  if prefix != none {
    context {
      let foot-num = counter(footnote).get().first() + 1
      pre-foot-data.update(s => {
        s.foots.push(foot-num)
        s.prefixes.push(prefix)
        s
      })
    }
  }

  cite(..args)
}

// Demo

#let cite-cf = pre-cite.with(prefix: "cf. ")
#let cite-see = pre-cite.with(prefix: "see ")

#set page(height: auto)

Citing @first and #cite-cf(<first>). Also#cite-see(<first>)

#bibliography("bibliography.bib", style: "chicago-notes")

first citation has just "Doe, 'First Thing'" in the footnote, second citation has "cf." before the same text, and third one has "see" before the same text

1 Like