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
url2cite: all-linksto your yaml front matterhttps://pandoc.org/MANUAL.html_x35_extension-yaml_metadata_block?. This will cause all links in the document to be converted to references.
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.
- Manubot is a more integrated and opinionated tool for creating scientific documents that has a similar method for creating citations without the hassle.
- pandoc-url2cite-hs is a Haskell port of this tool (mostly compatible)
AlexNethttp://dl.acm.org/citation.cfm?doid_x61_3098997.3065386? first introduced CNNs to the ImageNet challenge. – further improved on the results.
 phiresky, “Phiresky/pandoc-url2cite.” Apr-2021 [Online]. Available: https://github.com/phiresky/pandoc-url2cite. [Accessed: 18-Apr-2021]
 Y. Name, “Citation Style Language,” Citation Style Language. [Online]. Available: https://citationstyles.org/. [Accessed: 18-Apr-2021]
 “Mendeley - Reference Management Software & Researcher Network,” www.mendeley.com. [Online]. Available: https://www.mendeley.com/?interaction_required=true. [Accessed: 18-Apr-2021]
 “Zotero Your personal research assistant,” www.zotero.org. [Online]. Available: https://www.zotero.org/. [Accessed: 18-Apr-2021]
 “Automatic citation extraction from URLs - phiresky’s blog,” phiresky.github.io. [Online]. Available: https://phiresky.github.io/blog/2019/pandoc-url2cite/. [Accessed: 18-Apr-2021]
 19. O. 2018. K. Fern and ez-R. F. 266up. 3. comments, “How to use Pandoc to produce a research paper,” Opensource.com. [Online]. Available: https://opensource.com/article/18/9/pandoc-research-paper. [Accessed: 18-Apr-2021]
 E. Heyns, “Retorquere/zotero-better-bibtex.” Apr-2021 [Online]. Available: https://github.com/retorquere/zotero-better-bibtex. [Accessed: 18-Apr-2021]
 “Dev:translators [Zotero Documentation],” www.zotero.org. [Online]. Available: https://www.zotero.org/support/dev/translators. [Accessed: 18-Apr-2021]
 “Zotero/translation-server.” Zotero, Mar-2021 [Online]. Available: https://github.com/zotero/translation-server. [Accessed: 18-Apr-2021]
 “Citoid/API - MediaWiki,” www.mediawiki.org. [Online]. Available: https://www.mediawiki.org/wiki/Citoid/API. [Accessed: 18-Apr-2021]
 “Try translating PDF URLs based on URL · Issue #70 · zotero/translation-server,” GitHub. [Online]. Available: https://github.com/zotero/translation-server/issues/70. [Accessed: 18-Apr-2021]
 “Bibtex bibliography styles,” www.overleaf.com. [Online]. Available: https://www.overleaf.com/learn/latex/Bibtex_bibliography_styles. [Accessed: 18-Apr-2021]
 “The Open Graph protocol,” ogp.me. [Online]. Available: https://ogp.me/. [Accessed: 18-Apr-2021]
 “Url as citekey/referencekey · Issue #308 · jgm/pandoc-citeproc,” GitHub. [Online]. Available: https://github.com/jgm/pandoc-citeproc/issues/308. [Accessed: 18-Apr-2021]
 “Phiresky/pandoc-url2cite,” GitHub. [Online]. Available: https://github.com/phiresky/pandoc-url2cite. [Accessed: 18-Apr-2021]
 “Manubot - Manuscripts, open and automated,” manubot.org. [Online]. Available: https://manubot.org/. [Accessed: 18-Apr-2021]
 Lila, “Aver1y/pandoc-url2cite-hs.” Jan-2021 [Online]. Available: https://github.com/Aver1y/pandoc-url2cite-hs. [Accessed: 18-Apr-2021]
 K. Simonyan and A. Zisserman, “Very Deep Convolutional Networks for Large-Scale Image Recognition,” arXiv:1409.1556 [cs], Apr. 2015 [Online]. Available: http://arxiv.org/abs/1409.1556. [Accessed: 18-Apr-2021]
 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: 18-Apr-2021]
 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: 18-Apr-2021]