Standard Zotero BibTeX citations keys are fully auto-generated, using an algorithm that usually generates unique keys. For serious LaTeX users, “usually” presents the following problems:
For a LaTeX author, the citation keys have their own meaning, fully separate from the other reference data, even if people usually pick a naming scheme related to them. As the citation key is the piece of data that connects your bibliography, this is a piece of data you want to have control over. BBT offers you this control:
You can also
You can fix the citation key for a reference by adding the text “bibtex: [your citekey]” (sans quotes) anywhere in the “extra” field of the reference, or by using biblatexcitekey[my_key]. You can generate a fixed citation key by selecting references, right-clicking, and selecting “Generate BibTeX key”.
You can drag and drop citations into your LaTeX/Markdown/Orgmode editor, and it will add a proper
cite command is
configurable for LaTeX by setting the config option in the Preferences. Do not include the leading backslash. This feature requires a one-time setup: go to Zotero preferences, tab Export, under Default Output Format, select “Better BibTeX Quick Copy”, and choose the Quick Copy format under the
Citation keys preferences for BBT.
The plugin will generate BibTeX comments to show whether a key conflicts and with which entry. BBT integrates with Zotero: Report Customizer to display the BibTeX key plus any conflicts between them in the zotero report.
BBT also implements a new citekey generator for those entries that don’t have one set explicitly; the formatter follows the JabRef key formatting syntax in the Better BibTeX preferences (you can get there via the Zotero preferences, or by clicking the Better BibTeX “Preferences” button in the addons pane.
A common pattern is
[auth:lower][year], which means
The default key pattern is
[zotero], which implements the key generator of the standard Bib(La)TeX exporters (even
though having underscores in your keys is not handled gracefully by all versions of LaTeX’s bibliography processors) in
order to ease migration from existing exports.
note that changing the pattern will cause all your non-fixed keys to be regenerated
If you want to get fancy, you can set multiple patterns separated by a vertical bar, of which the first will be applied that yields a non-empty string. If all return a empty string, a random key will be generated. Note that in addition to the ‘special’ fields listed JabRef also allows all ‘native’ fields as key values; the plugin does the same but allows for Zotero native fields (case sensitive!) not Bib(La)TeX native fields. The possible fields are:
BBT adds a few fields, flags and filter functions that JabRef (perhaps wisely) doesn’t. These are:
edtr, … and all the author-related fields that mimic the JabRef equivalents also have capitalized versions (so
Edtr, …) which follow the same algorithm but do not have any cleaning (diacritic folding, space removal, stripping of invalid citekey characters) applied. These can be used to pass through the filters specified below much like the fields from the table above. See also “usage note” below.
journal: returns the journal abbreviation, or, if not found, the journal title, If ‘automatic journal abbreviation’ is enabled in the BBT settings, it will use the same abbreviation filter Zotero uses in the wordprocessor integration. You might want to use the
abbrfilter (see below) on this.
library: returns the name of the shared group library, or nothing if the reference is in your personal library
0: a pseudo-function that sets the citekey disambiguation postfix to numeric (-1, -2, etc, like the standard Zotero Bib(La)TeX translators do) rather than alphabetic (a, b, c). Does not add any text to the citekey otherwise.
>X: a pseudo-function which aborts the current pattern generation if what came before it is X characters or less (
[>0]is a typical use. You’d typically use this with something like
[auth][>0][year]|[title][year]which means if there’s no author you get
title-yearrather than just
+initialsadds initials to any author name function. Specify using e.g. [auth+initials]
nopunct: removes punctuation
condense: this replaces spaces in the value passed in. You can specify what to replace it with by adding it as a parameter, e.g
condense,_will replace spaces with underscores. Parameters should not contain spaces unless you want the spaces in the value passed in to be replaced with those spaces in the parameter
skipwords: filters out common words like ‘of’, ‘the’, … the list of words can be seen and changed by going into
about:configunder the key
extensions.zotero.translators.better-bibtex.skipWordsas a comma-separated, case-insensitive list of words. If you want to strip words like ‘Jr.’ from names, you could use something like
jrto the skipWords list. Note that this filter is always applied if you use
title(which is different from
select: selects words from the value passed in. The format is
select,1,4would select the first four words. It is important to note that `select’ works only on values that have the words separated by whitespace, so the caveat below applies.
ascii: removes all non-ascii characters
fold: tries to replace diacritics with ascii look-alikes. Removes non-ascii characters it cannot match
alphanum: clears out everything but unicode alphanumeric characters (unicode character classes
capitalize: uppercases the first letter of each word
postfix: postfixes with its parameter, so
postfix,_will add an underscore to the end if, and only if, the value it is supposed to postfix isn’t empty
prefix: prefixes with its parameter, so
prefix,_will add an underscore to the front if, and only if, the value it is supposed to prefix isn’t empty. If you want to use a reserved character (such as
\), you’ll need to add a backslash (
\) in front of it.
Usage note: the functions
select rely on whitespaces for word handling. The JabRef functions strip
whitespace and thereby make these filter functions sort of useless. You will in general want to use the fields from the
table above, which give you the values from Zotero without any changes.
Better BibTeX versions after 0.6.8 generate stable citation keys across your entire library. These stable keys come in two flavors:
The pinned keys show up in the ‘extra’ field of your references, and sync across libraries. The citation key is shown in
the details pane of the reference, and in the
extra column of the references list if you have enabled it in the BBT
preferences. In the details pane, soft keys are displayed in italics; in the references list, soft keys have an asterisk
after the key. The soft keys do not sync, but they’re present in a separate
database so partial exports will know to generate keys not already in use (even if that is a ‘soft’ use), and so these
soft keys will reliably survive restarts of Zotero.
Quite a bit of trickery is involved in generating these stable keys, and some of this trickery could cause an undue burden on the Zotero sync infrastructure. To prevent such strain on the Zotero sync servers, the following restrictions are in place:
I am terribly sorry having to do this, but not doing this would risk sync being permanently impossible, as the Zotero server will kick you out if a sync takes too long.