Skip to content

Citation Keys

friflaj edited this page Jun 25, 2014 · 36 revisions

BBT offers you control over your citation keys.

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 editor, and it will add a proper \cite{citekey}. The actual command is configurable by setting the config option in the BBT preferences (see below). Do not include the leading backslash. This feature requires a one-time setup: go to zotero preferences, tab Export, under Default Output Format, select "LaTeX Citation".

If you want even more convenience (and you're on Windows), install AutoHotKey, modify the Zotero sample macro, and add it to your AutoHotKey.ahk. If you use this macro unmodified, when you select one or more entries in Zotero, it will copy them, bring TeXMaker to the forground, and paste your citation at the cursor. Caution: this macro does not check that you are in Zotero when you activate it, nor that TeXMaker is actually running.

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, with a twist; 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! but the first letter may be capitalized to disambiguate a field from a pattern function), 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 filter functions that JabRef (perhaps wisely) doesn't. These are:

  • 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', ...
  • select: 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. 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.

Caveat: most functions on the item already strip whitespace and thereby make these functions sort of useless; these are mostly useful for when you use any of the options from the table above with the initial letter uppercased, which will make sure a function doesn't take precedence over direct-field access.

Duplicate keys

In case you have ambiguous keys (both resolve to Smith2013 for example), drag and drop won't yield the same keys as export (which does disambiguate them). You will have to either:

  • Set an explicit cite key for at least one of them, or
  • Configure your generator to generate non-ambigous keys (see above)
  • Disable conflict resolution in the preferences. If you disable this (it's enabled by default), BBT will not add postfixes to your keys on generation to disambiguate them. This makes the keys more stable, but you'll have to keep a keen eye on key conflicts yourself. BibLaTeX will report them, but they're not fatal errors, and they're not always easy to spot in the compilation log
Clone this wiki locally