diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt index 368b0375..03e4c618 100644 --- a/collects/scriblib/autobib.rkt +++ b/collects/scriblib/autobib.rkt @@ -156,8 +156,9 @@ (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) - (or (string-ci<? (extract-bib-key a) (extract-bib-key b)) - (and (string-ci=? (extract-bib-key a) (extract-bib-key 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)))) diff --git a/collects/tests/scribble/docs/autobib-disambiguation-corner.scrbl b/collects/tests/scribble/docs/autobib-disambiguation-corner.scrbl new file mode 100644 index 00000000..2defae07 --- /dev/null +++ b/collects/tests/scribble/docs/autobib-disambiguation-corner.scrbl @@ -0,0 +1,19 @@ +#lang scribble/base +@(require scriblib/autobib) +@(define-cite cite citet gen-bib) + +@(define a (make-bib #:title "Diss A" + #:is-book? #t + #:location (dissertation-location #:institution "NEU") + #:author (authors "Little" "Bo" "Peep") + #:date "2012")) +@(define b (make-bib #:title "Diss B" + #:is-book? #t + #:location (dissertation-location #:institution "NEU") + #:author (authors "Little" "Bo" "Peep") + #:date "2012")) +@;{Citing ambiguous entries without other single citations} +@;{should not cause a warning} +@cite[a b] + +@gen-bib[] \ No newline at end of file diff --git a/collects/tests/scribble/docs/autobib-disambiguation-corner.txt b/collects/tests/scribble/docs/autobib-disambiguation-corner.txt new file mode 100644 index 00000000..319a0225 --- /dev/null +++ b/collects/tests/scribble/docs/autobib-disambiguation-corner.txt @@ -0,0 +1,6 @@ + (Little et al. 2012a,b) + +Bibliography + +Little, Bo, and Peep. Diss A. PhD dissertation, NEU, (2012a). +Little, Bo, and Peep. Diss B. PhD dissertation, NEU, (2012b). diff --git a/collects/tests/scribble/docs/autobib-disambiguation.scrbl b/collects/tests/scribble/docs/autobib-disambiguation.scrbl new file mode 100644 index 00000000..0bcdc597 --- /dev/null +++ b/collects/tests/scribble/docs/autobib-disambiguation.scrbl @@ -0,0 +1,25 @@ +#lang scribble/base +@(require scriblib/autobib) +@(define-cite cite citet gen-bib) + +@(define a (make-bib #:title "Diss 1" + #:is-book? #t + #:location (dissertation-location #:institution "NEU") + #:author (authors "Little" "Bo" "Peep") + #:date "2012")) +@(define b (make-bib #:title "Diss 2" + #:is-book? #t + #:location (dissertation-location #:institution "NEU") + #:author (authors "Little" "Bo" "Peep") + #:date "2012")) +According to the following morons, +@cite[a] +@cite[b] +@citet[a] +@citet[b] +@cite[a b] +@cite[b a] +@citet[a b] +@citet[b a] + +@gen-bib[] \ No newline at end of file diff --git a/collects/tests/scribble/docs/autobib-disambiguation.txt b/collects/tests/scribble/docs/autobib-disambiguation.txt new file mode 100644 index 00000000..ef90e083 --- /dev/null +++ b/collects/tests/scribble/docs/autobib-disambiguation.txt @@ -0,0 +1,9 @@ +According to the following morons, (Little et al. 2012a) (Little et +al. 2012b) Little et al. (2012a) Little et al. (2012b) (Little et al. +2012a,b) (Little et al. 2012b,a) Little et al. (2012a,b) Little et +al. (2012b,a) + +Bibliography + +Little, Bo, and Peep. Diss 1. PhD dissertation, NEU, (2012a). +Little, Bo, and Peep. Diss 2. PhD dissertation, NEU, (2012b).