How to print bibliography without line breaks between references

I tweaked the IEEE csl so that my bibliography looks like this:

[1] Smith et al. (2020) 10.5194/acp-20-9591-2020a
[2] Doe et al. (2021) 10.5194/acp-20-9591-2020xyz
[3] Smith & Wesson (2023) 10.5194/acp-20-9591-2020abc

How can I suppress line breaks between bibliographic items, as in:

[1] Smith et al. (2020) 10.5194/acp-20-9591-2020a [2] Doe et al. (2021) 10.5194/acp-20-9591-2020xyz [3] Smith & Wesson (2023) 10.5194/acp-20-9591-2020abc

The objective is, obviously, to produce a more compact list of references.

Should I tweak my csl file or do something within Typst?

This is not possible because bibliography uses grid, and you can’t override bibliography.entry: Add `bibliography.entry` element by xkevio · Pull Request #5932 · typst/typst · GitHub.

Same goes to alexandria – Typst Universe, but you can actually modify it:

#let render-bibliography(...) = {
  ...
    for e in bib.references {
      h(0.25em, weak: true)
      [#metadata(none)#label(bib.prefix + e.key)]
      if e.prefix != none {
        hayagriva.render(e.prefix)
      }
      h(0.65em)
      hayagriva.render(e.reference)
    }
  ...
}

replacing

#let render-bibliography(...) = {
  ...
    grid(
      columns: 2,
      // rows: (),
      column-gutter: 0.65em,
      // row-gutter: 13.2pt,
      row-gutter: par.spacing,
      // fill: none,
      // align: auto,
      // stroke: (:),
      // inset: (:),
      ..for e in bib.references {
        (
          {
            [#metadata(none)#label(bib.prefix + e.key)]
            if e.prefix != none {
              hayagriva.render(e.prefix)
            }
          },
          hayagriva.render(e.reference),
        )
      },
    )
  ...
}

#import "@preview/alexandria:0.2.0": *
#show: alexandria(prefix: "", read: path => read(path))
#bibliographyx("works.bib", full: true, title: "")

Cc @ensko

You can transform the grid to something else:

#show bibliography: bib => {
  show grid: g => g.children.map(cell => cell.body).join(" ")
  bib
}

= Title
Text.@work1 @work2

#bibliography(bytes("
  @online{work1,
  	title = {Some Work},
    author = {Some Author},
  	year = 2024,
  }
  @online{work2,
  	title = {Another Work},
    author = {Another Author},
  	year = 2025,
  }
"))

It looks like this solution does not work anymore after the recent changes to how to bibliographies are constructed.

From what I can tell, you can no longer access the field elements of the grid() within the bibliography(). I would be curious to get your input @sijo and @Andrew

It’s weird, it seems that Typst still uses a grid, but show rules on grid have no effect, while rules on grid.cell do have an effect.

Yes, I remember also noticing this when the change happened. The code causing this is here iiuc: typst/crates/typst-layout/src/rules.rs at v0.14.0 · typst/typst · GitHub