Sort bibliographies by authors' last names.

(Tweaked by Vincent.)

original commit: 3caf0aca23a293271dd7245f42b28dccaab535f6
This commit is contained in:
J. Ian Johnson 2012-04-03 17:56:15 -04:00 committed by Vincent St-Amour
parent d327ca1190
commit 743e0afbfb
4 changed files with 39 additions and 9 deletions

View File

@ -161,12 +161,16 @@
(define render-date-bib (or maybe-render-date-bib default-render-date-bib))
(define render-date-cite (or maybe-render-date-cite default-render-date-cite))
(define (author/date<? a b)
;; comparing just the authors causes non-deterministic render order. Use entire key.
(or (string-ci<? (auto-bib-key a) (auto-bib-key b))
(and (string-ci=? (auto-bib-key a) (auto-bib-key b))
(auto-bib-date a)
(auto-bib-date b)
(date<? a b))))
;; comparing just the authors causes non-deterministic render order.
;; We still have to use the authors first in order for last name order.
;; If there is a collision for names, then disambiguate with the keys and then the date.
(or (string-ci<? (extract-bib-key a) (extract-bib-key b))
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
(or (string-ci<? (auto-bib-key a) (auto-bib-key b))
(and (string-ci=? (auto-bib-key a) (auto-bib-key b))
(auto-bib-date a)
(auto-bib-date b)
(date<? a b))))))
(define (ambiguous? a b)
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
(auto-bib-date a)

View File

@ -0,0 +1,19 @@
#lang scribble/base
@(require scriblib/autobib)
@(define-cite cite citet gen)
@(define a (make-bib #:title "Diss 1"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors (author-name "Little Bo" "Peep") (author-name "Samwise" "Gamgee"))
#:date "2012"))
@(define b (make-bib #:title "Diss 2"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors (author-name "Ayo" "Shucks"))
#:date "2012"))
Order matters. Must sort by last names.
@cite[b]
@cite[a]
@(gen)

View File

@ -0,0 +1,7 @@
Order matters. Must sort by last names.  (Shucks 2012)  (Peep and Gamgee
2012)
Bibliography
Little Bo Peep and Samwise Gamgee. Diss 1. PhD dissertation, NEU, 2012.
Ayo Shucks. Diss 2. PhD dissertation, NEU, 2012.

View File

@ -10,8 +10,8 @@ al. 2010, part II)  (Felleisen et al. 2010)
Bibliography
And no date. Look ma, no authors.
Dorai Sitaram. Programming in Schelog. 1993.
http://www.ccs.neu.edu/~dorai/schelog/schelog.html
Look ma, no authors.
Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics
Engineering with PLT Redex. MIT Press, 2010.
Look ma, no authors.
Dorai Sitaram. Programming in Schelog. 1993.
http://www.ccs.neu.edu/~dorai/schelog/schelog.html