Citekeys with Internal Links
Hi all,
I'm new to Zotero, and have been doing my best to piece together how to use this program from around the web.
I'm running into two problems with BetterBibTex with which I could use others' help/advice:
1.) Using quick-copy, I want to generate Citekeys with @ in front of them instead of \cite. How do I adjust the quick-copy template in this regard?
2.) I understand that it's possible for citekeys to have an internal hyperlink attached to them such that when the internal hyperlink is followed, it will open up Zotero to the exact item reference via the Citekey. How is this possible? I would love it if quick-copy could generate a citekey with the internal hyperlink included.
Thank you all for your help!
I'm new to Zotero, and have been doing my best to piece together how to use this program from around the web.
I'm running into two problems with BetterBibTex with which I could use others' help/advice:
1.) Using quick-copy, I want to generate Citekeys with @ in front of them instead of \cite. How do I adjust the quick-copy template in this regard?
2.) I understand that it's possible for citekeys to have an internal hyperlink attached to them such that when the internal hyperlink is followed, it will open up Zotero to the exact item reference via the Citekey. How is this possible? I would love it if quick-copy could generate a citekey with the internal hyperlink included.
Thank you all for your help!
2. Set the quick copy format to select link with citekey in the BBT prefs
1.) Done, and works.
2.) I cannot find this option under BBT preferences. I'm in the "citation key" sub-menu. After selecting "pandoc" as the quick-copy citation method, there are no other options to attach a Zotero internal link to the citatation.
Here is an example of what I would like for Zotero to output for quick placement within an Obsidian note - [@seneca,SENECASHORTNESSLIFE,2016](zotero://select/library/items/3K9BG22A)
Instead, I can only configure Zotero using BBT to output the @citekey with no link, or the zotero link with no citekey, depending on the quick-copy format I select.
Once again, I appreciate the assistance very much.
But if you want both as one, you can select "Eta template" and enter
<% it.items.forEach(function(item) {
const [ , kind, lib, key ] = item.uri.match(/^https?:\/\/zotero\.org\/(users|groups)\/((?:local\/)?[^/]+)\/items\/(.+)/)
const select = (kind === 'users') ? `zotero://select/library/items/${key}` : `zotero://select/groups/${lib}/items/${key}`
%>[@<%= item.citationKey %>](<%= select %>)<% }) %>
Thank you for your help!
```
<% it.items.forEach(function(item) {
const [ , kind, lib, key ] = item.uri.match(/^https?:\/\/zotero\.org\/(users|groups)\/((?:local\/)?[^/]+)\/items\/(.+)/)
const select = (kind === 'users') ? `zotero://select/library/items/${key}` : `zotero://select/groups/${lib}/items/${key}`
%>[@<%= item.citationKey %>](<%= item.attachments[[1]][["url"]] %>)<% }) %>
```
```
<% it.items.forEach(function(item) {
const tem = item.attachments
const len = tem.length
const link = tem[tem.length-1]
%>[@<%= item.citationKey %>](<%= link[["url"]] %>)<%
})
%>
```
<% it.items.forEach(function(item) {
const att = (item.attachments || []).slice(-1)[0] || {};
%>[@<%= item.citationKey %>](<%= att.url %>)<%
}) %>
```
<% it.items.forEach(function(item) {
const tem = item.attachments
if (tem.length === 0) {
if (item.url) {
%>[[@<%= item.citationKey %>]](<%= item.url %>)<%
} else {
%>[[@<%= item.citationKey %>]](<%= item.DOI %>)<%
}
} else {
const link = tem[tem.length-1]
const url = link[["url"]]
%>[[@<%= item.citationKey %>]](<%= url %>)<%
}
})
%>
```
BTW, is it possible to export an embedded hyperlink citation with eta template code? Currently I used macOS Shortcut to run pandoc to convert quick copy from clipboard to rtf, and paste it into my Scrivener. The workflow is fine for me, though a little bit clunky.
Thank you for your help!
link[["url"]]
could possibly work in Javascript.This is how I would do it:
<% it.items.forEach(function(item) {
I don't understand what you mean by this.const att = (item.attachments || []).find(a => a.url)
if (att) {
%>[[@<%= item.citationKey %>]](<%= att.url %>)<%
}
else if (item.url) {
%>[[@<%= item.citationKey %>]](<%= item.url %>)<%
}
else {
%>[[@<%= item.citationKey %>]](<%= item.DOI %>)<%
}
})
%>
I meant is it possible to export rich-text quick copy using eta template code? I currently export it as plain text ( [xxx](http://xxx) ) and use pandoc to convert it into rich-text.
<% it.items.forEach(function(item) {
const att = (item.attachments || []).find(a => a.url)
if (att) {
%><a href="<%= att.url %>">@<%= item.citationKey %></a><%
}
else if (item.url) {
%><a href="<%= item.url %>">@<%= item.citationKey %></a><%
}
else {
%><a href="<%= item.DOI %>">@<%= item.citationKey %></a><%
}
})
%>
but drag&drop / copy&paste would tell the receiving application it is getting plaintext. There isn't a way to tell the receiving application "and interpret that as HTML/RTF". If the application auto-detects it, that would work, otherwise you'd just get the markup in your text.