Automatic citation extraction from URLs
You simply add a URL of a publication, and it will replace that with a real citation in whatever CSL style you want. This means you can avoid dealing with Mendeley or Zotero and keeping your Reference Manager database and bibtex file in sync, especially when collaborating with others.
Here is a minimal example:
# Introduction The GAN was first introduced in [@gan]. # References [@gan]: https://papers.nips.cc/paper/5423-generative-adversarial-nets
Compiling this file with this command
pandoc \ --filter=pandoc-url2cite --filter=pandoc-citeproc \ --csl ieee-with-url.csl \ minimal.md -o minimal.pdf
How to Use
Install this package globally using
npm install -g pandoc-url2cite.
--filter=pandoc-url2cite to your pandoc command (before pandoc-citeproc, see the minimal example above).
If you’re not familiar with writing papers in pandoc, you can refer to e.g. this article. It’s pretty flexible, you can use templates from whatever conference you want, and you can still use inline latex code if you need it (and you are ok with not being able to convert your document to nice HTML or EPUB anymore).
url2cite allows multiple ways to cite:
(PREFERRED) Use the pandoc citation syntax for citations:
The authors of [@alexnet] first introduced CNNs to the ImageNet challenge.
Then add the URLs with the usual "link reference" syntax to the bottom of your document in its own paragraph:
Convert all links to citations
You can still blacklist some links by adding
no-url2citeto either the CSS class of the link (pandoc-only):
or to the link title:
How it Works
The main idea is that usually every piece of research you might want to cite is fully identifiable by an URL - no need to manually enter metadata like author, release date, journal, etc. Citation managers like Zotero already use this and enable you to automatically fetch metadata from a website. But then you still have a citation database somewhere that you may or may not be able to synchronize with different computers, but probably won’t be able to add to the version control of your paper. There’s hacks such as better-bibtex to automatically generate and update diffable bibtex files – But that means you now have two sources of truth, and since the export is one-way this leads to multiple contributors overriding each other’s changes. pandoc-url2cite goes a step further: URLs are directly used as the cite keys, and the "bibliography file" is just an auto-generated intermediary artifact of those URLs.
All citation data is cached (permanently) as bibtex as well as CSL to
citation-cache.json. This is both to improve performance and to make sure references stay the same forever after the initial fetch, as well as to avoid problems if the API might be down in the future. This also means that errors in the citation data can be fixed manually, although if you find you need to do a lot of manual tweaking you might again be better off with Zotero.
Currently, extracting the metadata from direct URLs of full text PDFs does not work, so you will need to use the URL of an overview / abstract page etc. I’m not sure why, since this does work in Zotero. More info might be here.
Currently, this filter only works if you use pandoc-citeproc, because the citations are written directly into the document metadata instead of into a bibtex file. If you want to use natbib or biblatex for citations, this filter currently won’t work. Using citeproc has the disadvantage that it is somewhat less configurable than the "real" LaTeX citation text generators and the CSL language has some limitations. For example, the bibtex "alpha" style sometimes used in Germany can’t be described in CSL.
To make it work with biblatex, this script would need to write out a *.bib file somewhere temporarily and reference that in the latex code.
The book [@isbn:978-0374533557, pp. 15-17] is interesting.
Related Work (Longer Example)
 phiresky, “Effortlessly and transparently add correctly styled citations to your markdown paper given only a URL: Phiresky/pandoc-url2cite.” Dec-2019 [Online]. Available: https://github.com/phiresky/pandoc-url2cite. [Accessed: 14-Dec-2019]
 Y. Name, “Citation Style Language,” Citation Style Language. [Online]. Available: https://citationstyles.org/. [Accessed: 14-Dec-2019]
 “Mendeley - Reference Management Software & Researcher Network,” www.mendeley.com. [Online]. Available: https://www.mendeley.com/?interaction_required=true. [Accessed: 14-Dec-2019]
 “Zotero Your personal research assistant,” www.zotero.org. [Online]. Available: https://www.zotero.org/. [Accessed: 14-Dec-2019]
 “Automatic citation extraction from URLs (draft) - phiresky’s blog,” phiresky.github.io. [Online]. Available: https://phiresky.github.io/blog/2019/pandoc-url2cite/. [Accessed: 14-Dec-2019]
 F.-R. Kiko, “How to use Pandoc to produce a research paper,” Opensource.com. [Online]. Available: https://opensource.com/article/18/9/pandoc-research-paper. [Accessed: 14-Dec-2019]
 “Pandoc - Pandoc User’s Guide,” pandoc.org. [Online]. Available: https://pandoc.org/MANUAL.html#citations. [Accessed: 14-Dec-2019]
 “Pandoc - Pandoc User’s Guide,” pandoc.org. [Online]. Available: https://pandoc.org/MANUAL.html#extension-yaml_metadata_block. [Accessed: 14-Dec-2019]
 E. Heyns, “Make Zotero effective for us LaTeX holdouts. Contribute to retorquere/zotero-better-bibtex development by creating an account on GitHub.” Dec-2019 [Online]. Available: https://github.com/retorquere/zotero-better-bibtex. [Accessed: 14-Dec-2019]
 “Dev:Translators [Zotero Documentation],” www.zotero.org. [Online]. Available: https://www.zotero.org/support/dev/translators. [Accessed: 14-Dec-2019]
 “A Node.Js-based server to run Zotero translators. Contribute to zotero/translation-server development by creating an account on GitHub.” zotero, Dec-2019 [Online]. Available: https://github.com/zotero/translation-server. [Accessed: 14-Dec-2019]
 “Citoid/API - MediaWiki,” www.mediawiki.org. [Online]. Available: https://www.mediawiki.org/wiki/Citoid/API. [Accessed: 14-Dec-2019]
 “Try translating PDF URLs based on URL · Issue #70 · zotero/translation-server,” GitHub. [Online]. Available: https://github.com/zotero/translation-server/issues/70. [Accessed: 14-Dec-2019]
 “Bibtex bibliography styles,” www.overleaf.com. [Online]. Available: https://www.overleaf.com/learn/latex/Bibtex_bibliography_styles. [Accessed: 14-Dec-2019]
 “Open Graph protocol,” ogp.me. [Online]. Available: http://ogp.me/. [Accessed: 14-Dec-2019]
 “Url as citekey/referencekey · Issue #308 · jgm/pandoc-citeproc,” GitHub. [Online]. Available: https://github.com/jgm/pandoc-citeproc/issues/308. [Accessed: 14-Dec-2019]
 phiresky, “pandoc-url2cite/example/doi-isbn.md.” Dec-2019 [Online]. Available: https://github.com/phiresky/pandoc-url2cite/blob/master/example/doi-isbn.md. [Accessed: 14-Dec-2019]
 A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet Classification with Deep Convolutional Neural Networks,” Commun. ACM, vol. 60, no. 6, pp. 84–90, May 2017 [Online]. Available: http://doi.acm.org/10.1145/3065386. [Accessed: 14-Dec-2019]
 K. Simonyan and A. Zisserman, “Very Deep Convolutional Networks for Large-Scale Image Recognition,” arXiv:1409.1556 [cs], Sep. 2014 [Online]. Available: http://arxiv.org/abs/1409.1556. [Accessed: 14-Dec-2019]
 C. Szegedy et al., “Going deeper with convolutions,” in 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 1–9 [Online]. Available: https://ieeexplore.ieee.org/document/7298594. [Accessed: 14-Dec-2019]
 K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition,” in 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770–778 [Online]. Available: https://ieeexplore.ieee.org/document/7780459. [Accessed: 14-Dec-2019]