Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

cite_key Pattern DSL

crossmem generates citation keys using a pattern DSL inspired by Better BibTeX. The pattern is configured in ~/.crossmem/config.toml:

[cite_key]
pattern = "[auth:lower][year][shorttitle:1:nopunct]"

Syntax

A pattern is a string of tokens (inside [brackets]) and literal characters (outside brackets).

[field:modifier1:modifier2]literal_text[field2]

Tokens

TokenDescriptionExample output
authFirst author’s last nameVaswani
authorsAll authors’ last names concatenatedVaswaniShazeer
yearPublication year2017
shorttitleFirst N significant words from title (stop words filtered)attention
titleFull titleAttention Is All You Need

shorttitle behavior

shorttitle filters out common stop words (a, an, the, is, are, was, for, of, with, …) and takes the first N remaining words. N is specified as a numeric modifier.

Example with title “Attention Is All You Need”:

  • [shorttitle:1]attention
  • [shorttitle:3]attentionneed (after filtering “Is”, “All”, “You”)

Modifiers

Modifiers are appended to the token with : separators and applied in order:

ModifierDescriptionExample
lowerLowercaseVASWANIvaswani
upperUppercasevaswaniVASWANI
nopunctRemove all non-alphanumeric charactershello-world!helloworld
condenseRemove all whitespacehello worldhelloworld
N (digit)For shorttitle: take first N words. For other fields: take first N whitespace-delimited words.[shorttitle:1] → first significant word

Examples

Default pattern

pattern = "[auth:lower][year][shorttitle:1:nopunct]"
PaperGenerated key
Vaswani et al., “Attention Is All You Need”, 2017vaswani2017attention
LeCun et al., “Deep Learning”, 2015lecun2015deep

All authors

pattern = "[authors:lower][year]"
PaperGenerated key
Vaswani & Shazeer, “Attention Is All You Need”, 2017vaswanishazeer2017

With literal separator

pattern = "[auth:lower]_[year]"
PaperGenerated key
Vaswani et al., 2017vaswani_2017

Full title condensed

pattern = "[title:condense:lower]"
PaperGenerated key
“Attention Is All You Need”attentionisallyouneed

Multi-word short title

pattern = "[auth:lower][year][shorttitle:3:nopunct]"
PaperGenerated key
Vaswani et al., “Attention Is All You Need”, 2017vaswani2017attentionneed

Collision resolution

If a generated key collides with an existing entry, crossmem appends a suffix:

  1. Try a through z: vaswani2017attentionvaswani2017attentiona
  2. If all 26 letters exhausted, append _<count>: vaswani2017attention_27