Making Citations Clickable Hyperlinks
If I'm using Zotero to write articles, research papers, etc., that are published electronically (e.g., online), is there any way to make the citations (in the body of the text) clickable so that the reader is taken to the abstract, full study, etc.?
For example, let's take the following excerpt about supplementation with oral glutathione:
"Setria (oral) glutathione has been shown to increase blood levels of glutathione. (1) Sublingual glutathione has also been shown blood levels of glutathione. (2) However, is there any head-to-head comparative data?"
In this example, I'd like to hyperlink citation 1 to this study: https://www.ncbi.nlm.nih.gov/pubmed/24791752
And I'd like to hyperlink citation 2 to this study: https://www.ncbi.nlm.nih.gov/pubmed/26262996
Is there any way to do this automatically through Zotero? Or, is this something that needs to be done manually (e.g., after writing, unlink citations, then manually add hyperlinks)?
Thank you very much for your time and help!
For example, let's take the following excerpt about supplementation with oral glutathione:
"Setria (oral) glutathione has been shown to increase blood levels of glutathione. (1) Sublingual glutathione has also been shown blood levels of glutathione. (2) However, is there any head-to-head comparative data?"
In this example, I'd like to hyperlink citation 1 to this study: https://www.ncbi.nlm.nih.gov/pubmed/24791752
And I'd like to hyperlink citation 2 to this study: https://www.ncbi.nlm.nih.gov/pubmed/26262996
Is there any way to do this automatically through Zotero? Or, is this something that needs to be done manually (e.g., after writing, unlink citations, then manually add hyperlinks)?
Thank you very much for your time and help!
There are also several methods discussed in various places on these forums to link the numeric citations to the bibliography entry, and you can include the DOI or URL there and use Word AutoFormat to make them clickable links.
Thanks so much for taking the time to provide such a thoughtful reply. I should have noted that I did attempt to do my due diligence in searching these forums before posting my question. I know it's a cardinal sin not to do so :)
I don't know much about using Word macros, so I'll need to look into that.
In another thread here on the forums, I think I saw someone mention that the Zotero plug-in for WordPress may have the capability to do what I'm looking for. The articles I'm writing are published in WordPress -- although that's done by someone else in my organization -- so maybe that's something for me to consider as well.
Thank you very much for your time and help!
In Word this would be done with bookmark references.
Feel free to improve the code.
import uno
from ast import literal_eval as to_dict
document = XSCRIPTCONTEXT.getDocument()
#alter this for citations divided by comma
ns = ";"
def copylinks():
oSearch = document.createSearchDescriptor()
oSearch.SearchRegularExpression = True
oCurs = document.getText().createTextCursor()
refmarks = document.ReferenceMarks
for refmark in refmarks:
a = refmark.Name
b, _ = a.rsplit(" ", 1)
_,_, c = b.split(" ", 2)
d = to_dict(c)
cite = d["properties"]["formattedCitation"]
plain_cite = d["properties"]["plainCitation"]
plain_cite = plain_cite.replace("(", "")
plain_cite = plain_cite.replace(")", "")
#alter this for citations divided by comma
names = list(plain_cite.split(ns))
if "citationItems" in d.keys():
list_e = d["citationItems"]
else:
continue
for g in list_e:
if "itemData" in g.keys():
h = g["itemData"]
authors = h["author"]
m = authors[0]
author = m["family"]
citatation = list(filter(lambda x: author in x,names))
oCurs = refmark.getAnchor()
oCursor = oCurs.getStart()
oSearch.SearchString = citatation[0]
oFound = document.findNext(oCursor, oSearch)
oCursor2 = oFound.Text.createTextCursorByRange(oFound)
if "DOI" in h.keys():
DOI = h["DOI"]
else:
DOI = ""
if "source" in h.keys():
source = h["source"]
else:
source = ""
if "note" in h.keys():
note = h["note"]
else:
note = ""
else:
continue
if DOI:
oCursor2.HyperLinkURL = "https://doi.org/" + DOI
aaa = oCursor2.HyperLinkURL
elif source == "PubMed":
_, n = note.split(": ")
oCursor2.HyperLinkURL = "https://pubmed.ncbi.nlm.nih.gov/" + n
else:
pass