BBT's Citation key formula: Special characters , (comma) and () (parentheses)
Hello,
I am setting up Better BibTeX's Citation key formula. When a paper has three authors, my desired citekey format is
I looked at BBT's citekey configuration at https://retorque.re/zotero-better-bibtex/citing/#generating-citekeys, and the Citation key formula I came up with was:
But with this formula, the generated citekey is
Strangely, in place of , (comma) and () (parentheses), I tried in the formula using other special characters like ; (semicolon), - (dash), or [] (square brackets), and the citekey would show these special characters with no problem. So my questions are:
- How can I change my Citation key formula so that
- Are there reasons against using
Thank you.
I am setting up Better BibTeX's Citation key formula. When a paper has three authors, my desired citekey format is
Author1name,Author2name,andAuthor3name(Year)
. A real example would be a paper by Graham, Michaely, and Roberts published in 2003 should have the citekey Graham,Michaely,andRoberts(2003)
. I looked at BBT's citekey configuration at https://retorque.re/zotero-better-bibtex/citing/#generating-citekeys, and the Citation key formula I came up with was:
authors(n=3,sep=",and",min=3,max=3).replace(/,and/,',') + year.prefix('(').postfix(')')
.But with this formula, the generated citekey is
Author1nameAuthor2nameandAuthor3nameYear
; or using the real example, GrahamMichaelyandRoberts2003
. In other words, the special characters ,
(comma in between author names) and ()
(parentheses around the year) are missing in the citekey output.Strangely, in place of , (comma) and () (parentheses), I tried in the formula using other special characters like ; (semicolon), - (dash), or [] (square brackets), and the citekey would show these special characters with no problem. So my questions are:
- How can I change my Citation key formula so that
,
and ()
show up in the citekey output? - Are there reasons against using
,
or ()
in citekeys in general that I'm unaware of?Thank you.
You can't with Better BibTeXyou shouldn't, but you can. If you go into Zotero's hidden prefs you can search forextensions.zotero.translators.better-bibtex.citekeyUnsafeChars
and remove the characters you want to have passed through. You will most likely end up with unparsable output though.- Per your suggestion, I will not remove any unsafe characters in the hidden preferences. For anyone curious, the current list of unsafe characters in that preference is
\"#%'(),={}~
.- I have discarded the idea of using commas and parentheses. But this still leaves the question of which special characters are valid in citekeys for compilation. I searched around and found Pandoc could generally accept
_:.#$%&-+?<>~/
(https://pandoc.org/MANUAL.html#citation-syntax). Crossing off BBT's unsafe list from Pandoc's accepted list gave me a subset of characters to choose from. There is still LaTeX to consider, which I believe the characters it allows would vary by the tool. Then that's something for me to experiment with.Thank you for helping me with my questions, and I greatly appreciate this awesome plugin you made and continue to develop!