Deep linking with Org mode and Zotero
(Edited )When writing permanent notes in Org mode, I use links to connect my own words back to phrases or paragraphs in the PDFs I’m referencing. This lets me readily pull up sources, providing important context when I revisit my notes in the future.
While it is possible to use docview:
links to specific
pages and read them in Emacs’s built-in PDF reader, I’ve come up with an
approach that suits me better.
Zotero
For managing and reading my documents, I use Zotero. It’s open source, the UI is great, and most importantly it has a flexible URL system. This lets us link not just to a given file, but to a specific page or annotation within that file. Some examples:
zotero://open-pdf/library/items/AZ8RTGGB
zotero://open-pdf/library/items/AZ8RTGGB?page=4
zotero://open-pdf/library/items/AZ8RTGGB?page=4&annotation=UPQH27BA
Adding a PDF to your Zotero library creates a copy and gives it a unique ID. This makes it relatively hard to break your links as long as you keep your library around.
Copying links
To easily copy links, you’ll need a Zotero extension called Actions &
Tags. Its page has instructions for installing both the extension
and the Copy
item link script, so I won’t cover that here. You will have to edit
the script slightly — near the top, change linkType
to
"plain"
.
When selecting or reading a document in Zotero, you can use your assigned shortcut to copy the link to your clipboard. To link to a chunk of text, just make a highlight, select it, and copy that as a link.
Following links
(defun my-org-zotero-open (path _)
(call-process "open" nil nil nil (concat "zotero:" path)))
(org-link-set-parameters "zotero" :follow #'my-org-zotero-open)
This is all the Elisp it takes to make zotero:
links
followable in Org mode. Make sure you replace "open"
with
whatever your system uses (xdg-open
, start
,
etc.)
Conclusion
I hope I’ve shed some light on part of a workflow for interacting with literature from the comfort of Emacs. As for the rest, I’m still feeling my way towards my ideal setup. I intend to write up more of my findings in the future. Get in touch if you’ve got your own workflows or Zotero tips to share.
I’ll leave you with a recommendation. While it’s easy enough to drag and drop your PDFs into Zotero, it’s even easier to use Zotero Connector. It can download documents — even snapshots of websites! – straight to your library, ready to be linked. Sweet.