How to insert bibliography entries as code to avoid importing .bib file

I’d like to know how to put bibliography entries into the main.typ file, so that a user doesn’t need to create a separate *bib or other file.

The reason is I’m planning a conference next year for which we have always had tex and docx 1-page abstract formats. I want to add a typ format for next year, but I know that our audience will not have an easy time with multiple files. They just need a single file example which works. In these papers, nobody will have more than 3 references.

A reply to my own post. It could be done with a simple numbered list, but there doesn’t seem to be an easy way to reference items in a list

== References
“+” Smith & Brown (2022) J Whatever 22:123 “ref:SandB
“+” An Other Reference (2025)

We cite results from “@ref:SandB” // DOESN’T WORK

The bibliography function also accepts raw bytes as the source.

For example:

Cite them as usual: @key

#let bib = ```bib
@misc{key,
  title = {Title},
}
```.text
#bibliography(bytes(bib), style: "…")
1 Like

Thanks! Works well. Just to note for others, the #let can go anywhere. The bibliography goes where you would normally want it (an the end)

Use backticks for inline code. How to post in the Questions category - #7 by Andrew