Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Patch to bibtex-autokey that implements a key format commonly used on CEUR-WS (e.g. see http://ceur-ws.org/Vol-1032/CSP2013.bib). It uses crossref instead of year: eg Alexiev:TPDL2012 instead of Alexiev:2012
--- bibtex-orig.el 2014-01-08 17:19:01.808353200 +0200
+++ bibtex.el 2014-01-08 17:45:06.771864000 +0200
@@ -1066,4 +1066,13 @@
:type 'boolean)
+(defcustom bibtex-autokey-use-crossref-instead-of-year nil
+ "If non-nil then use the crossref field instead of the year.
+Eg if crossref={TPDL2012} then the autokey could become Alexiev:TPDL2012 instead of Alexiev:2012. Nice!
+In this case bibtex-autokey-year-length is ignored,
+and you better set bibtex-autokey-name-separator to \":\" and may want to set bibtex-autokey-titlewords to 0.
+See `bibtex-generate-autokey' for details."
+ :group 'bibtex-autokey
+ :type 'boolean)
+
(defcustom bibtex-autokey-titlewords 5
"Number of title words to use for the automatically generated reference key.
@@ -2685,8 +2694,9 @@
(defun bibtex-autokey-get-year ()
- "Return year field contents as a string obeying `bibtex-autokey-year-length'."
- (let ((yearfield (bibtex-autokey-get-field "year")))
- (substring yearfield (max 0 (- (length yearfield)
- bibtex-autokey-year-length)))))
+ "Return year field contents as a string obeying `bibtex-autokey-year-length' and `bibtex-autokey-use-crossref-instead-of-year'."
+ (if bibtex-autokey-use-crossref-instead-of-year (bibtex-autokey-get-field "crossref")
+ (let ((yearfield (bibtex-autokey-get-field "year")))
+ (substring yearfield (max 0 (- (length yearfield)
+ bibtex-autokey-year-length))))))
(defun bibtex-autokey-get-title ()
@@ -2770,8 +2780,10 @@
The year part:
- 1. Build the year part of the key by truncating the content of the year
+ 1. If `bibtex-autokey-use-crossref-instead-of-year' then use the crossref field.
+ Eg if crossref={TPDL2012} then the autokey could become Alexiev:TPDL2012 instead of Alexiev:2012.
+ 2. Build the year part of the key by truncating the content of the year
field to the rightmost `bibtex-autokey-year-length' digits (useful
values are 2 and 4).
- 2. If the year field (or any other field required to generate the key)
+ 3. If the year field (or any other field required to generate the key)
is absent, but the entry has a valid crossref field and
`bibtex-autokey-use-crossref' is non-nil, use the field of the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.