Citation Keys

Generating citekeys for your references

The BibTeX citations keys generated by the standard Zotero exporters are always generated at time of export, using an algorithm that usually generates unique keys. For serious LaTeX users, “usually” presents the following problems:

  • If a non-unique key is generated, which one gets postfixed with a distinguishing character is essentially non-deterministic.
  • The keys are always auto-generated, so if you correct a typo in the author name or title, the key will change
  • You can’t see the citation keys until you export them

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:

  • Stable citation keys, without key clashes. BBT generates citation keys that take into account other existing keys in your library in a deterministic way, regardless of what part of your library you export, or the order in which you do it.
  • BBT is conservative about citation key changes, and allows you to fix keys to any value of your choosing.
  • Generate citation keys from JabRef(-ish) patterns.

You can also

  • Drag and drop LaTeX citations using these keys to your favorite LaTeX editor
  • Show your citation keys in the reference list view.

Set your own, fixed citation keys

By default, BBT generates the citation key from the item information, and this key may change when you edit the item. Such keys are called dynamic keys, which are marked with an asterisk (*) in the reference list view, and are displayed in italics in the item details.

You can fix the citation key (called pinning in BBT) for an item by adding the text Citation Key: [your citekey] anywhere in the extra field of the reference on a line of its own. You can generate a pinned citation key by selecting one or more items, right-clicking, and selecting Generate BibTeX key, which will add the current citation key to the extra field, thereby pinning it. These keys are shown without the asterisk (*) marker in the middle column, and non-italicized in the details view, to distinguish them from dynamic keys.

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: choose the Quick Copy format under the Citation keys preferences for BBT, and go to Zotero preferences, tab Export, under Default Output Format, select “Better BibTeX Quick Copy: [format you just selected]”.

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 pattern language mostly 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.

The default key pattern is ‚Äč[auth:lower][shorttitle3_3][year]; if you have papers that use keys which were generated by the key generator of the standard Bib(La)TeX exporters of Zotero you may want to use [zotero:clean] instead in order to ease migration from existing exports for people who previously used the standard Zotero Bib(La)TeX exports. You will be offered this choice on first run of BBT.

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 (a, b, c, etc) in case of a clash (this part is always added, you can’t disable it, although you can change it to Zotero-style numeric)

note that changing the pattern used to cause all your non-pinned keys to be regenerated in Zotero 4. In Zotero 5, this is no longer the case; changing a pattern will only affect references being created/changed after you changed the pattern. If you want your keys to update after a pattern change you will have to select your references, right-click, and select Refresh. This will not affect keys you have pinned.

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.

An example application for this behavior is to use the tex.shortauthor from the extra field when defined to generate short citation keys for entries with long group author names, but to default to [auth:lower] otherwise:

[Extra:transliterate:replace=(?\:tex\\.shortauthor\[\:\=\]\\s+(\\w+))|.*,$1,regex:clean:lower][>0][year] | [auth:lower][year]

although this particular case can be handled more succinctly with

[extra=tex.shortauthor:transliterate:clean:lower][>0][year] | [auth:lower][year]

note the non-greedy regex pattern before the non-capturing group. Using this pattern, a reference of the “American Psychological Association” from 2021 and tex.shortauthor: APA in the extra field would get the citekey apa2021. Without the definition in the extra field the generated citekey would be americanpsychologicalassociation2021.

Generating citekeys

To generate your citekeys, you use a pattern composed of functions and filters. Broadly, functions grab text from your item, and filters transform that text. The full list of functions and filters is:


  • auth.auth.ea / edtr.edtr.ea, +initials, +<joinchar>: The last name of the first two authors, and “.ea” if there are more than two.
  • auth.etal / edtr.etal, +initials, +<joinchar>: The last name of the first author, and the last name of the second author if there are two authors or “.etal” if there are more than two.
  • authEtAl / edtrEtAl, +initials, +<joinchar>: The last name of the first author, and the last name of the second author if there are two authors or “EtAl” if there are more than two. This is similar to auth.etal. The difference is that the authors are not separated by “.” and in case of more than 2 authors “EtAl” instead of “.etal” is appended.
  • authForeIni / edtrForeIni: The forename initial of the first author.
  • authIniN / edtrIniN, +initials, +<joinchar>: The beginning of each author’s last name, using no more than N characters.
  • authN_M / edtrN_M, +initials, +<joinchar>: The first N (default: all) characters of the Mth (default: first) author’s last name.
  • authorIni / edtrorIni, +initials, +<joinchar>: The first 5 characters of the first author’s last name, and the last name initials of the remaining authors.
  • authorLastForeIni / edtrorLastForeIni: The forename initial of the last author.
  • authorLast / edtrorLast, +initials, +<joinchar>: The last name of the last author
  • authorsAlpha / editorsAlpha, +initials, +<joinchar>: Corresponds to the BibTeX style “alpha”. One author: First three letters of the last name. Two to four authors: First letters of last names concatenated. More than four authors: First letters of last names of first three authors concatenated. “+” at the end.
  • authorsN / editorsN, +initials, +<joinchar>: The last name of up to N authors. If there are more authors, “EtAl” is appended.
  • authshort / edtrshort, +initials, +<joinchar>: The last name if one author is given; the first character of up to three authors' last names if more than one author is given. A plus character is added, if there are more than three authors.
  • date: The date of the publication
  • extra: A pseudo-field from the extra field. eg if you have Original date: 1970 in your extra field, you can get it as [extra=originalDate], or tex.shortauthor: APA which you could get with [extra=tex.shortauthor]
  • firstpage: The number of the first page of the publication (Caution: this will return the lowest number found in the pages field, since BibTeX allows 7,41,73--97 or 43+.)
  • 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 abbr filter on this.
  • keywordN: Tag number N
  • lastpage: The number of the last page of the publication (See the remark on firstpage)
  • library: returns the name of the shared group library, or nothing if the reference is in your personal library
  • month: the month of the publication
  • origdate: the original date of the publication
  • origyear: the original year of the publication
  • shorttitleN_M: The first N (default: 3) words of the title, apply capitalization to first M (default: 0) of those
  • shortyear: The last 2 digits of the publication year
  • title: Capitalize all the significant words of the title, and concatenate them. For example, An awesome paper on JabRef will become AnAwesomePaperJabref
  • veryshorttitleN_M: The first N (default: 1) words of the title, apply capitalization to first M (default: 0) of those
  • year: The year of the publication
  • zotero: Generates citation keys as the stock Zotero Bib(La)TeX export does. Note that this pattern inherits all the problems of the original Zotero citekey generation – you should really only use this if you have existing papers that rely on this behavior.
  • postfix=<spec>/postfix+1=<spec>: a pseudo-function that sets the citekey disambiguation postfix using an sprintf-js format spec for when a key is generated that already exists. Does not add any text to the citekey otherwise. You must include exactly one of the placeholders %(n)s (number), %(a)s (alpha, lowercase) or %(A)s (alpha, uppercase). For the rest of the disambiguator you can use things like padding and extra text as sprintf-js allows. With +1 the disambiguator is always included, even if there is no need for it because no duplicates exist. The default format is %(a)s.
  • 0: an alias for [postfix=-%(n)s]. Emulates the disambiguator of the standard Zotero exports. When you use [zotero] in your pattern, [zotero][0] is implied
  • >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 would typically use this with something like [auth][>0][year] | [title][year] which means if there's no author you get title-year rather than just year.
  • =typeName: a pseudo-function that aborts the current pattern generation if the Zotero reference type does not equal typeName. You can test for multiple typenames at once by separating them with slashes ([=journalArticle/report]). Valid typeNames are: artwork, attachment, audioRecording, bill, blogPost, book, bookSection, case, classicJM, computerProgram, conferencePaper, dictionaryEntry, document, email, encyclopediaArticle, film, forumPost, gazetteJM, hearing, instantMessage, interview, journalArticle, legalCommentaryJM, letter, magazineArticle, manuscript, map, newspaperArticle, note, patent, podcast, presentation, radioBroadcast, regulationJM, report, standardJM, statute, thesis, treatyJM, tvBroadcast, videoRecording, webpage.
(type names marked JM are only available in Juris-M).

Note: the functions above all have the clean filter (see below) automatically applied to them. If you want more control, auth, authIni, edtr, … and all the author-related fields that mimic the JabRef equivalents also have capitalized versions (so Auth, AuthIni, 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. For all the non-author fields, you can use the unprocessed reference fields directly:

Direct access to unprocessed fields

AbstractNote AccessDate AdminFlagJM AdoptionDateJM
AlbumJM ApplicationNumber Archive ArchiveCollectionJM
ArchiveLocation ArtworkMedium ArtworkSize AssemblyNumberJM
Assignee AudioFileType AudioRecordingFormat BillNumber
BlogTitle BookAbbreviationJM BookTitle CallNumber
CaseName Code CodeNumber CodePages
CodeVolume Committee Company ConferenceDateJM
ConferenceName Country Court DOI
Date DateAmendedJM DateDecided DateEnacted
DictionaryTitle Distributor DivisionJM DocketNumber
DocumentNameJM DocumentNumber Edition EncyclopediaTitle
EpisodeNumber FilingDate FirstPage ForumTitle
GazetteFlagJM Genre History ISBN
ISSN Institution InterviewMedium Issue
IssueDate IssuingAuthority JournalAbbreviation JurisdictionJM
Label Language LegalStatus LegislativeBody
LetterType LibraryCatalog ManuscriptType MapType
Medium MeetingName MeetingNumberJM NameOfAct
Network NewsCaseDateJM NumPages Number
NumberOfVolumes OpeningDateJM OpusJM OriginalDateJM
Pages ParentTreatyJM PatentNumber Place
PostType PresentationType PriorityDateJM PriorityNumbers
ProceedingsTitle ProgramTitle ProgrammingLanguage PublicLawNumber
PublicationDateJM PublicationNumberJM PublicationTitle Publisher
References RegnalYearJM RegulationTypeJM RegulatoryBodyJM
ReignJM ReleaseJM ReportNumber ReportType
Reporter ReporterVolume ResolutionLabelJM Rights
RunningTime Scale Section Series
SeriesNumber SeriesText SeriesTitle Session
SessionTypeJM ShortTitle SigningDateJM StatusJM
Studio Subject SupplementNameJM System
ThesisType Title TreatyNumberJM Type
University Url VersionNumber VideoRecordingFormat
Volume VolumeTitleJM WebsiteTitle WebsiteType

(fields marked JM are only available in Juris-M).


  • +initials adds initials to any author name function. Specify using e.g. [auth+initials]


  • abbr: Abbreviates the text. Only the first character and subsequent characters following white space will be included.
  • alphanum: clears out everything but unicode alphanumeric characters (unicode character classes L and N)
  • ascii: removes all non-ascii characters
  • capitalize: uppercases the first letter of each word
  • clean: transliterates the citation key and removes unsafe characters
  • condense=sep? (string): 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
  • discard: discards the input
  • fold=mode? (‘german’ | ‘japanese’): tries to replace diacritics with ascii look-alikes. Removes non-ascii characters it cannot match
  • format-date=format? (string): formats date as by replacing y, m and d in the format
  • jieba: jieba
  • local-time: transforms date/time to local time. Mainly useful for dateAdded and dateModified as it requires an ISO-formatted input.
  • lower: Forces the text inserted by the field marker to be in lowercase. For example, [auth:lower] expands the last name of the first author in lowercase.
  • nopunct: Removes punctuation
  • nopunctordash: Removes punctuation and word-connecting dashes
  • numeric: returns the value if it’s an integer
  • postfix=postfix (string): 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=prefix (string): 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 : or \), you’ll need to add a backslash (\) in front of it.
  • replace=find (string), replace (string), mode? (‘string’ | ‘regex’): replaces text, case insensitive; :replace=.etal,&etal will replace .EtAl with &etal
  • select=start? (number), n? (number): selects words from the value passed in. The format is select=start,number (1-based), so select=1,4 would select the first four words. If number is not given, all words from start to the end of the list are selected.
  • skipwords:

    filters out common words like ‘of’, ‘the’, … the list of words can be seen and changed by going into about:config under the key extensions.zotero.translators.better-bibtex.skipWords as a comma-separated, case-insensitive list of words.

    If you want to strip words like ‘Jr.’ from names, you could use something like [Auth:nopunct:skipwords:fold] after adding jr to the skipWords list. Note that this filter is always applied if you use title (which is different from Title) or shorttitle.

  • split-ideographs: Treat ideaographs as individual words
  • substring=start? (number), n? (number): (substring=start,n) selects n (default: all) characters starting at start (default: 1)
  • transliterate: transliterates the citation key
  • upper: Forces the text inserted by the field marker to be in uppercase. For example, [auth:upper] expands the last name of the first author in uppercase.
  • >X: a pseudo-filter which aborts the current pattern generation if what came before it is X characters or less ([>0] is a typical use. You would typically use this with something like [auth][journal:>0][year] | [title][year] which means if there's no journal you get title-year rather than just auth+year.
  • (x): The string between the parentheses will be inserted if the field marker preceding this modifier resolves to an empty value. The placeholder x may be any string. For instance, the marker [volume:(unknown)] will return the entry's volume if set, and the string unknown if the entry's volume field is not set.

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. The fields with ** are only available in Juris-M.