Can I make citations appear as footnotes?

Hello,

On slides, it is helpful to have the citations appear on the same slide in full format, instead of collected at the end. Ideally, these are shown with a non-numeric symbol (like fa-book or something).

I can’t quite figure out how to make the citations (with @citation syntax) appear as footnotes. With the hayagriva demo citations in refs.yaml, I can put

#set page(paper: "a8")
#show cite: it => {
  footnote()[#it.fields() /*#cite(it.key(), form: "full", style: "nature")*/]
}
Here, I have text with a @harry citation.
#pagebreak()
And more text with @electronic citation.
#bibliography("refs.yaml")

Produce the usual endnote citations, with footnotes on each page repeating the reference index value. In the commented out attempt, you can see I am trying to access the key it.key (which does not exist, though the #it.fields() call in the content makes it seem so). Is this because the cite command returns content so I would need to intercept this earlier in the process to get the key and manually construct the #footnote[#cite(key, ..)]?

Trying a #it.at.("key") crashes the web app compiler, which is perhaps concerning, too.

The @citation syntax is actually a ref.

#show ref: footnote

will make all references as footnotes, including references to labels.

The documentation gives a more detailed example
here: Reference Function – Typst Documentation
which you can adapt to result in

#show ref: it => {
  let cite = ref
  let el = it.element
  if el == none {
    footnote(it)
  } else {
    it
  }
}
#set heading(numbering: "1")
= Heading <label>

Citation: @citation

Label: @label

#bibliography("bibliography.bib")

In most IDEs, you can inspect the value of it, which is the input to the show rule on ref. Otherwise, just print it using repr.
For example, I have
image

The recommended way to do this is to use a citation style designed for footnotes, as this is natively supported by Typst:

#set page(height: auto)
#set cite(style: "chicago-notes")

This is a citation@typst

#bibliography("bib.yaml")

output: citation as footnote

bib.yaml file for reference
typst:
    type: Web
    title: Typst
    author:
      - Laurenz
      - Martin
    url: https://typst.app
2 Likes