TransWikia.com

Enabling authoryear citation style with urlbst

TeX - LaTeX Asked by EA304GT on April 16, 2021

I like how urlbst handles preprints and DOIs in the bibliography. However, I noticed that none of the default urlbst bibliography styles are capable of producing author-year citations. Whenever I try

documentclass{article}
usepackage[utf8]{inputenc}
usepackage[hidelinks]{hyperref}

usepackage[sort, authoryear]{natbib}
bibliographystyle{plainurl}
setcitestyle{authoryear,open={(},close={)}}

begin{document}

One cite{Colmsee2015}  to cite{Ghrist2018} serve

bibliography{foobiblio}

end{document}

I get the following error

Package natbib Error: Bibliography not compatible with author-year citations. ...mandNAT@force@numbers{}NAT@force@numbers

If I instead go for numerical citation, everything goes smoothly.

Is there a quick way to modify, say plainurl.bst, so that it supports author-year citations?

If needed, this is my foobiblio.bib file

@Unpublished{Ghrist2018,
  author        = {Robert Ghrist and Rachel Levanger and Huy Mai},
  title         = {Persistent Homology and {E}uler Integral Transforms},
  year          = {2018},
  abstract      = {The Euler calculus -- an integral calculus based on Euler characteristic as a valuation on constructible functions -- is shown to be an incisive tool for answering questions about injectivity and invertibility of recent transforms based on persistent homology for shape characterization.},
  archiveprefix = {arXiv},
  eprint        = {1804.04740},
  primaryclass  = {math.AT},
}

@Article{Colmsee2015,
  author    = {Colmsee, Christian and Beier, Sebastian and Himmelbach, Axel and Schmutzer, Thomas and Stein, Nils and Scholz, Uwe and Mascher, Martin},
  journal   = {Molecular Plant},
  title     = {{BARLEX:} the Barley Draft Genome Explorer},
  year      = {2015},
  issn      = {1674-2052},
  month     = {Jun},
  number    = {6},
  pages     = {964-966},
  volume    = {8},
  day       = {01},
  doi       = {10.1016/j.molp.2015.03.009},
  groups    = {Barley genomics and phenomics},
  publisher = {Elsevier},
}

One Answer

The urlbst distribution is really a distribution of the script which modifies .bst files, with a few pre-convered BST files included for convenience.

This is a Perl script (sorry – it was a long time ago), and can be used like this (presuming you have Perl installed on your machine):

% kpsewhich chicago.bst
/usr/local/texlive/2020/texmf-dist/bibtex/bst/chicago/chicago.bst
% ./urlbst /usr/local/texlive/2020/texmf-dist/bibtex/bst/chicago/chicago.bst chicagourl.bst

The first command is to find out where the currently-installed chicago.bst actually is. The second command converts that .bst file into a new one called chicagourl.bst.

If I take your MWE and substitute

bibliographystyle{chicagourl}

Then I get:

MWE output

The script isn't guaranteed to work on every BST file – it's rather heuristic – but should work OK on ones which look more-or-less like the standard ones.

Correct answer by Norman Gray on April 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP