typst / biblatex

A Rust crate for parsing and writing BibTeX and BibLaTeX files.
Apache License 2.0
120 stars 15 forks source link

Discuss wider `@string` syntax #32

Open Neved4 opened 1 year ago

Neved4 commented 1 year ago

Best suited for Discussions, but I'm opening an issue for reference.

After reversing for a while I found this interesting one, and it's so cozy that I find it not a bug but a feature.

In BibTeX/BibLaTeX there's the @STRING special entry, that defines abbreviations of strings and which the preprocessor will take care of.

So we can define our list of aliases or abbreviations:

@string{anch-ie = {Angew.~Chem. Int.~Ed.}}
@string{cup     = {Cambridge University Press}}
@string{dtv     = {Deutscher Taschenbuch-Verlag}}
@string{hup     = {Harvard University Press}}
@string{jams    = {J.~Amer. Math. Soc.}}
@string{jchph   = {J.~Chem. Phys.}}
@string{jomch   = {J.~Organomet. Chem.}}
@string{pup     = {Princeton University Press}}

And then we can use it instead of typing the full journal name, notice the field journaltitle:

@article{aksin,
  author       = {Aks{\i}n, {\"O}zge and T{\"u}rkmen, Hayati and Artok, Levent
                  and {\c{C}}etinkaya, Bekir and Ni, Chaoying and
                  B{\"u}y{\"u}kg{\"u}ng{\"o}r, Orhan and {\"O}zkal, Erhan},
  title        = {Effect of immobilization on catalytic characteristics of
                  saturated {Pd-N}-heterocyclic carbenes in {Mizoroki-Heck}
                  reactions},
  journaltitle = jomch,
  date         = 2006,
  volume       = 691,
  number       = 13,
  pages        = {3027-3036},
  indextitle   = {Effect of immobilization on catalytic characteristics},
}

At the same time, typst allows us an alternative syntax:

@string{
  anch-ie = {Angew.~Chem. Int.~Ed.},
  cup     = {Cambridge University Press},
  dtv     = {Deutscher Taschenbuch-Verlag},
  hup     = {Harvard University Press},
  jams    = {J.~Amer. Math. Soc.},
  jchph   = {J.~Chem. Phys.},
  jomch   = {J.~Organomet. Chem.},
  pup     = {Princeton University Press}
}

That will work and compile just fine, just like in the example above.

I'm not aware if this has unintended consequences or if there's good reasons to disallow it, personally I'd love that in the TeX world we supported that alternative syntax.

Again, I find it nice of typst 🧡, even if it won't work on BibTeX/BibLaTeX.

Examples come from biblatex-examples.bib.