Is it possible to modify the entries of a bibliography before (or even after) they are shown? I can’t find a way to access them. The best I could do was to increase the vertical space between entries with set block(...)
.
Unfortunately not yet as of v0.11.1, in the future we will hopefully be able to via something akin to #show bibliography.entry
like outline.entry
today.
The issue is being tracked at Bibliography customization from within Typst · Issue #942 · typst/typst · GitHub.
A workaround with manual formatting:
#let fakebib(yaml-data) = {
let format-entry(b) = {
b.author
[. ]
b.title
// etc.
}
locate(loc => {
// Get all ref'd cite `@doe2024` cf. https://discord.com/channels/1054443721975922748/1179252098362253384/1179258313863606283
// Limitation: it will not work on #cite(<doe2024>) though
let citations = query(ref.where(element: none), loc).map((r) => str(r.target)).dedup()
enum(
numbering: "[1]",
..citations.map((c) => format-entry(yaml-data.at(c))
)
)
})
}
#show bibliography: it => {
set text(size: 0pt)
show heading: set text(size: 12pt)
it
}
@may2000 @doe2024
#bibliography("citations.yml", style: "ieee")
#fakebib(yaml("citations.yml")) // Read yaml file here because if you put fakebib() into a package, it cannot access your hayagriva yaml file
I had to format a bibliography in a way that isn’t currently possible, and I used this workaround. One problem is that I had to recreate CSL style from scratch in Typst (or its rough copy).
That looks very interesting. But I don’t think it is worth the trouble (at least for my usecase). Perhaps it will already be addressed in the next version of Typst.
A little bit off-topic, but I know there is a template that changes 等
in entries to et al.
Their hack is show grid.cell.where(x: 1): …
.
#import "@preview/modern-nju-thesis:0.3.4": bilingual-bibliography
// Replace `#bibliography("refs.bib")` with
#bilingual-bibliography(bibliography: bibliography.with("refs.bib"))