Citation Keys

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

Set your own, fixed citation keys

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”.

Drag and drop/hotkey citations

You can drag and drop citations into your LaTeX/Markdown/Orgmode editor, and it will add a proper \cite{citekey}/[@citekey]/[[zotero://select...][@citekey]. The 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.

Find duplicate keys through integration with Report Customizer

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.

Configurable citekey generator

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

  1. last name of first author without spaces, in lowercase
  2. year of publication if any,
  3. a letter postfix in case of a clash (this part is always added, you can’t disable it)

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:

AbstractNote AccessDate ApplicationNumber Archive
ArchiveLocation ArtworkMedium ArtworkSize Assignee
Attachments AudioFileType AudioRecordingFormat BillNumber
BlogTitle BookTitle CallNumber CaseName
Code CodeNumber CodePages CodeVolume
Committee Company ConferenceName Country
Court Date DateAdded DateDecided
DateEnacted DateModified DictionaryTitle Distributor
DocketNumber DocumentNumber DOI Edition
EncyclopediaTitle EpisodeNumber Extra FilingDate
FirstPage ForumTitle Genre History
Institution InterviewMedium ISBN ISSN
Issue IssueDate IssuingAuthority ItemType
JournalAbbreviation Label Language LegalStatus
LegislativeBody LetterType LibraryCatalog ManuscriptType
MapType Medium MeetingName Month
NameOfAct Network Notes Number
NumberOfVolumes NumPages Pages PatentNumber
Place PostType PresentationType PriorityNumbers
ProceedingsTitle ProgrammingLanguage ProgramTitle PublicationTitle
PublicLawNumber Publisher References Related
Reporter ReporterVolume ReportNumber ReportType
Rights RunningTime Scale Section
Series SeriesNumber SeriesText SeriesTitle
Session ShortTitle Source Studio
Subject System Tags ThesisType
Title University Url Version
VideoRecordingFormat Volume WebsiteTitle WebsiteType

Advanced usage

BBT adds a few fields, flags and filter functions that JabRef (perhaps wisely) doesn’t. These are:




Usage note: the functions condense, skipwords, capitalize and 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.

Generation of stable keys, and syncing

Better BibTeX versions after 0.6.8 generate stable citation keys across your entire library. These stable keys come in two flavors:

  1. ‘soft’ keys, which auto-update whenever the relevant data from the reference does, and
  2. ‘pinned’ or ‘fixed’ keys, which don’t.

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.