A CSL reproduction of BibTeX's "plain.bst"

Hello everyone,

I’ve just released plain.csl, a faithful reproduction of BibTeX’s classic plain.bst style. This means that you can now use the plain style directly in Typst and other CSL-compatible tools like Zotero or Mendeley. In Typst, simply add a #set bibliography(style: "plain.csl") rule and you’re good to go!

You can access the code on this GitHub repo.

I initially developed this for para-lipics, my Typst reproduction of the Dagstuhl LIPIcs template. However, since plain.bst is one of the most widely used bibliography styles of BibTeX (and therefore the world!), I hope that this work can benefit other projects and journal/conference templates!

1. Current limitations

I’ve tested plain.csl extensively against the original plain.bst. While the reproduction is quite faithful, there are some remaining discrepancies:

  • Some features aren’t yet implemented in the CSL (e.g., right-aligned reference numbers)
  • Some discrepancies arise from BibTeX → CSL conversion issues (e.g., @phdthesis and @masterthesis both map to CSL’s thesis type; @conference has no CSL equivalent)
  • Some Typst/Hayagriva-specific quirks remain (e.g., @inbook conversion issues, which should be fixed in the next Typst release, see typst/hayagriva#361)

I’ve documented all known issues in detail in TODO.md with testing resources available in the /test directory.

2. A small licensing question

Before submitting this style to the official CSL database (and eventually to Typst’s default bibliography styles, hopefully), I wanted to confirm the licensing approach with the community. BibTeX and its styles (including plain.bst) use the Knuth license:

This software is copyrighted. Unlimited copying and redistribution of this package and/or its individual files are permitted as long as there are no modifications. Modifications, and redistribution of modifications, are also permitted, but only if the resulting package and/or files are renamed.

Since I’m:

  1. Renaming the file plain.bstplain.csl
  2. Crediting the original authors (Howard Trickey and Oren Patashnik)
  3. Creating a different format (BST vs. CSL) rather than modifying the original

I believe it’s appropriate to license my project under the MIT License. Does this seem correct to you?

3. Future work

Contributions are welcome! I am also open to reimplementing other classic BibTeX styles that lack a CSL reproduction (AFAIK, abbrv.bst, siam.bst, unsrt.bst), if people have specific needs or want to lend a hand!

Happy Typsting!

3 Likes

I think there should be some CSL files in the CSL repo that mimic the LaTeX/BibTeX/whatever styles. If there are some, and they are named the same, well and if the initial style is also licensed under the Knuth license, then you’re good. Typst also has at least one CSL style that I think mimics an original BibTeX style — alphanumeric. But it’s not included in the CSL styles repo.

In any case, you can ask in that repo about this. Before or after creating a PR.

I think this is mostly resolved with the upcoming 0.14 update as you can then use the type BibTeX field to specify the type of thesis.

Why isn’t it included in the official CSL repo? Also, where can we find it? I tried to find this CSL in the GitHub repos of the Typst project, without success.

Alphanumeric is actually the only existing non-publisher style of BibTeX that I found that has a CSL reproduction. Of course, the BibTeX creators are not going to sue ACM, IEEE, or APA because they created CSL styles reproducing acm.bst, ieeetr.bst, and apalike.bst :sweat_smile:

Surely yes, but you still have to change the BibTeX entries to obtain what you want. Unlike BST, CSL does not distinguish @phdthesis and @masterthesis, so you cannot fine-tune the styling based on these BibTeX types. I am not too concerned about the discrepancies between LaTeX/BST and the CSL Visual Editor: they come from inherent conversion loss/imperfect mapping between the BST and CSL formats, and there is nothing we can do about it.

However, I am more concerned about the discrepancies between the CSL Visual Editor and Typst, as this means that Typst/Hayagriva does not comply with the CSL standard. I listed some of these discrepancies in TODO.md, Section 3. Due to a lack of time, I wasn’t able to identify everything, but there is more than what I listed.

Dunno.

Yeah, there are some I faced in Update gost-r-7-0-5-2008-numeric.csl by Andrew15-5 · Pull Request #7468 · citation-style-language/styles · GitHub, mainly Different formatting for English and Russian · Issue #376 · typst/hayagriva · GitHub and CSL `plural="never"` is ignored · Issue #377 · typst/hayagriva · GitHub.