Customizing the BibTeX key generator

In the 'Key pattern' tab in Preferences, one can set the fields used in auto generation of BibTex labels. The pattern can be set for each of the standard entry types.

Key patterns

The pattern can contain any text you wish, in addition to field markers that indicate that a specific field of the entry should be inserted at that position of the key. A field marker generally consists of the field name enclosed in square braces, e.g. [volume]. If the field is undefined in an entry at the time of key generation, no text will be inserted by the field marker.

Several special field markers are offered, which extract only a specific part of a field. These are listed below. Feel free to suggest new special field markers.

Special field markers:

Note: If there is no author (as in the case of an edited book), then all of the above [auth...] markers will use the editor(s) (if any) as a fallback. Thus, the editor(s) of a book with no author will be treated as the author(s) for label-generation purposes. If you do not want this behaviour, i.e. you require a marker which expands to nothing if there is no author, use pureauth instead of auth in the above codes. For example, [pureauth], or [pureauthors3].

A field name (or one of the above pseudo-field names) may optionally be followed by one or more modifiers. Modifiers are applied in the order they are specified.

If you haven't defined a key pattern for a certain entry type, the Default key pattern will be used. You can change the default pattern - its setting is above the list of entry types in the Key pattern section of the Preferences dialog.

The default key pattern is [auth][year], and this could produce keys like e.g. Yared1998 If the key is not unique in the current database, it is made unique by adding one of the letters a-z until a unique key is found. Thus, the labels might look like:

Yared1998
Yared1998a
Yared1998b

Regular expression replace

After the key pattern has been applied to produce a key, you can choose to have the key generator search for occurences of a specific regular expression, and replace it with a string. The regular expression and replacement string are entered in the text fields below the list of key patterns. If the replacement string is empty, matches of the regular expression will simply be removed from the generated key.