JuliaDocs / DocumenterCitations.jl

DocumenterCitations.jl uses Bibliography.jl to add support for BibTeX citations and references in documentation pages generated by Documenter.jl.
https://juliadocs.github.io/DocumenterCitations.jl/
MIT License
72 stars 5 forks source link

Add support for corporate authors #44

Closed lgoettgens closed 12 months ago

lgoettgens commented 1 year ago

In my bibliography, I have some authors that are not a person's name, but some corporation. Example:

@Misc{OEIS,
  bibkey        = {OEIS},
  author        = {OEIS Foundation Inc.},
  title         = {The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences},
  howpublished  = {Published electronically at https://oeis.org},
  year          = {2023},
  url           = {https://oeis.org}
}

Unfortunately, this name gets printed as O. F. Inc. in the bibliography due to the first and middle names being abbreviated. Once https://github.com/Humans-of-Julia/BibInternal.jl/pull/21 is released as BibInternal.jl v0.3.5, one can provide such names with double-braces, e.g. author = {{OEIS Foundation Inc.}} to the parser. It remains for DocumenterCitations.jl to remove one layer of braces before printing (and to bump the compat of BibInternal.jl).

goerz commented 1 year ago

The official way to have "corporate authors" in LaTeX is to enclose the name in braces. So, the .bib file should definitely look as

@Misc{OEIS,
  author        = {{OEIS Foundation Inc.}},
  title         = {The {O}n-{L}ine {E}ncyclopedia of {I}nteger {S}equences},
  howpublished  = {Published electronically at https://oeis.org},
  year          = {2023},
  url           = {https://oeis.org}
}

Unfortunately, though, as you point out, this has to be fixed by Azzaare in Bibliography.jl/BibInternal.jl with a new release. I've added https://github.com/JuliaDocs/DocumenterCitations.jl/pull/47/commits/87a14cacee0b60031609544a530f1468f6ec5dfd (in #47) with a test to track the issue here. If you run that test, you'll see that Bibliography.jl parses the name as

BibInternal.Name
  particle: String ""
  last: String "Inc.}"
  junior: String ""
  first: String ""
  middle: String ""

which is very very wrong.

I figured out a workaround, though: use non-breaking spaces ("\u00A0") for the name in the .bib file.

goerz commented 1 year ago

This is the workaround: https://github.com/JuliaDocs/DocumenterCitations.jl/pull/47/commits/6aa7f8f806a59896985a7f82164cd920fea43b47

You can't see it in the Github UI (cf. https://github.com/JuliaDocs/DocumenterCitations.jl/pull/46#discussion_r1358359415), but the .bib file contains non-breaking spaces, which you'll have to figure out how to type, or paste from a unicode table

lgoettgens commented 1 year ago

https://github.com/Humans-of-Julia/BibInternal.jl/releases/tag/v0.3.5 is now available, including https://github.com/Humans-of-Julia/BibInternal.jl/pull/21. So the only work needed here is to adapt the compat bound, and remove some braces from such entries (which is a special instance of https://github.com/JuliaDocs/DocumenterCitations.jl/issues/15).

goerz commented 12 months ago

Oh, wow, I totally missed that, somehow!

Ok, I’ll verify the test on top of #52, and if everything works, we can close this.

I’ll probably leave the compat bound as-is: fundamentally the plugins still works even with the older version. And unless someone specifically pins the old version, they should get the newest release anyway. If they do pin the old version, they’ll have to deal with any bugs in that version (and presumably, they have a reason for wanting the exact old behavior)

goerz commented 12 months ago

I've verified that the test passes now, so I'll update and merge #47 after #52 is merged. 🎉

I’ll probably leave the compat bound as-is:

Just to clarify: we don't have an explicit dependency on BibInternal.jl, only Bibliography.jl. I'd be reluctant to change that, when BibInternal is not explicitly used in the code.

However, BibInternal v0.3.5 is compatible even with the oldest compat bound Bibliography v0.2.15. I'm explicitly testing in the CI that the minium compat bounds work correctly, so that should be good enough.