Skip to content

Citation Keys

friflaj edited this page Jun 29, 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!) 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: the JabRef functions strip whitespace and thereby make these filter functions sort of useless; these are mostly useful for when you use any of the options from the table above.

Usage note: the functions skipwords 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.

Example: mimicking zotero's original key generation, but replacing underscores with points (e.g. because LaTeX may choke on underscores):

Given authors and titles

  • Mercier (2013) The function of reasoning [...]
  • de Groot & van Hell (2005) Handbook of Bilingualism [...]

"[author].[year].[Title:skipwords:select,1,1]" results in

  • "Mercier.2013.function" and
  • "deGroot.2005.Handbook"

Note that when the word from the Title' field that ends up at the beginning after the *skipwords* treatment is a lowercase word, it remains just that. You can change that with the capitalize' function if so desired.

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