Fix citation disabiguation when authors differ.

original commit: 29cfc48c5e9361fa1608a315f0558311e416a0d2
This commit is contained in:
Vincent St-Amour 2012-11-10 14:49:38 -05:00
commit 8193c3e1ec
12 changed files with 209 additions and 55 deletions

View File

@ -890,7 +890,7 @@
(list (make-element (if (include-navigation?)
"version"
"versionNoNav")
(list "Version: " v)))
v))
d
ri))))))
@ -1597,7 +1597,7 @@
(list name)))))))
(define in-plt?
(let ([roots (map explode (list (find-doc-dir) (find-collects-dir)))])
(let ([roots (map explode (filter values (list (find-doc-dir) (find-collects-dir))))])
(lambda (path)
(ormap (lambda (root)
(let loop ([path path] [root root])

View File

@ -966,33 +966,37 @@
[(#\u207a) "$^+$"]
[(#\u207b) "$^-$"]
[else
;; Detect characters that can be formed with combining characters
;; and translate them to Latex combinations:
(define s (string-normalize-nfd (string c)))
(define len (string-length s))
(cond
[(len . > . 1)
(define combiner (case (string-ref s (sub1 len))
[(#\u300) "\\`{~a}"]
[(#\u301) "\\'{~a}"]
[(#\u302) "\\^{~a}"]
[(#\u303) "\\~~{~a}"]
[(#\u304) "\\={~a}"]
[(#\u306) "\\u{~a}"]
[(#\u307) "\\.{~a}"]
[(#\u308) "\\\"{~a}"]
[(#\u30a) "\\r{~a}"]
[(#\u30b) "\\H{~a}"]
[(#\u30c) "\\v{~a}"]
[(#\u327) "\\c{~a}"]
[(#\u328) "\\k{~a}"]
[else #f]))
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
(if (and combiner
(= 1 (string-length base)))
(format combiner (char-loop (string-ref base 0)))
c)]
[else c])])
[(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul
(format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)]
[else
;; Detect characters that can be formed with combining characters
;; and translate them to Latex combinations:
(define s (string-normalize-nfd (string c)))
(define len (string-length s))
(cond
[(len . > . 1)
(define combiner (case (string-ref s (sub1 len))
[(#\u300) "\\`{~a}"]
[(#\u301) "\\'{~a}"]
[(#\u302) "\\^{~a}"]
[(#\u303) "\\~~{~a}"]
[(#\u304) "\\={~a}"]
[(#\u306) "\\u{~a}"]
[(#\u307) "\\.{~a}"]
[(#\u308) "\\\"{~a}"]
[(#\u30a) "\\r{~a}"]
[(#\u30b) "\\H{~a}"]
[(#\u30c) "\\v{~a}"]
[(#\u327) "\\c{~a}"]
[(#\u328) "\\k{~a}"]
[else #f]))
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
(if (and combiner
(= 1 (string-length base)))
(format combiner (char-loop (string-ref base 0)))
c)]
[else c])])])
c)])))
(loop (add1 i)))))))

View File

@ -154,6 +154,10 @@ table td {
font-size: xx-small; /* avoid overlap with author */
}
.version:before, .versionNoNav:before {
content: "Version ";
}
/* ---------------------------------------- */
/* Margin notes */

View File

@ -11,6 +11,8 @@
\usepackage[htt]{hyphenat}
\usepackage[usenames,dvipsnames]{color}
\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}
\IfFileExists{tocstyle.sty}{\usepackage{tocstyle}\usetocstyle{standard}}{}
\IfFileExists{CJK.sty}{\usepackage{CJK}}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Configuration that is especially meant to be overridden:
@ -139,12 +141,13 @@
\newenvironment{refcolumnleft}{\begin{refcolumn}}{\end{refcolumn}}
% Macros used by `title' and `author':
\newcommand{\titleAndVersionAndAuthors}[3]{\title{#1\\{\normalsize Version #2}}\author{#3}\maketitle}
\newcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1\\{\normalsize Version #2}}#3\maketitle}
\newcommand{\titleAndVersionAndAuthors}[3]{\title{#1\\{\normalsize \SVersionBefore{}#2}}\author{#3}\maketitle}
\newcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1\\{\normalsize \SVersionBefore{}#2}}#3\maketitle}
\newcommand{\titleAndEmptyVersionAndAuthors}[3]{\title{#1}\author{#3}\maketitle}
\newcommand{\titleAndEmptyVersionAndEmptyAuthors}[3]{\title{#1}\maketitle}
\newcommand{\SAuthor}[1]{#1}
\newcommand{\SAuthorSep}[1]{\qquad}
\newcommand{\SVersionBefore}[1]{Version }
% Useful for some styles, such as sigalternate:
\newcommand{\SNumberOfAuthors}[1]{}

View File

@ -400,7 +400,12 @@ The recognized @tech{style properties} are as follows:
not @racket[""] may be used when rendering a document; at a
minimum, a non-@racket[""] version is rendered when it is
attached to a part representing the whole document. The default
version for a document is @racket[(version)].}
version for a document is @racket[(version)]. In rendered form,
the version is normally prefixed with the word ``Version,'' but
this formatting can be controlled by overriding
@tt{.version:before} and/or @tt{.versionNoNav:before} in CSS
for HTML rendering or by redefining the @tt{\SVersionBefore}
macro for Latex rendering (see @secref["config"]).}
@item{@racket[document-date] structure --- A date for the part,
normally used on a document's main part for for Latex

View File

@ -168,18 +168,20 @@ otherwise.}
@defstruct[title-decl ([tag-prefix (or/c #f string?)]
[tags (listof string?)]
[version (or/c string? #f)]
[style any/c]
[style style?]
[content content?])]{
See @racket[decode] and @racket[decode-part]. The @racket[_tag-prefix]
and @racket[_style] fields are propagated to the resulting
See @racket[decode] and @racket[decode-part]. The @racket[tag-prefix]
and @racketidfont{style} fields are propagated to the resulting
@racket[part]. If the @racketidfont{version} field is not @racket[#f],
it is propagated as a @racket[document-version] style property on the
@racket[part].}
@defstruct[part-start ([depth integer?]
[tag-prefix (or/c #f string?)]
[tags (listof string?)]
[style any/c]
[style style?]
[title content?])]{
Like @racket[title-decl], but for a sub-part. See @racket[decode] and

View File

@ -757,7 +757,28 @@ If @racket[#:id [src-id dest-id-expr]] is supplied, then
@racket[dest-id-expr] produces the identifier to be documented in
place of @racket[src-id]. This split between @racket[src-id] and
@racket[dest-id-expr] roles is useful for functional abstraction of
@racket[defproc].}
@racket[defproc].
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defproc[(make-sandwich [ingredients (listof ingredient?)])
sandwich?]{
Returns a sandwich given the right ingredients.
}
@defproc[#:kind "sandwich-maker"
(make-reuben [ingredient sauerkraut?] ...
[#:veggie? veggie? any/c #f])
sandwich?]{
Produces a reuben given some number of @racket[ingredient]s.
If @racket[veggie?] is @racket[#f], produces a standard
reuben with corned beef. Otherwise, produces a vegetable
reuben.
}
}|
}
@defform[(defproc* maybe-kind maybe-id
([prototype
@ -765,16 +786,29 @@ place of @racket[src-id]. This split between @racket[src-id] and
pre-flow ...)]{
Like @racket[defproc], but for multiple cases with the same
@racket[id].
@racket[id].
When an @racket[id] has multiple calling cases, they must be defined
with a single @racket[defproc*], so that a single definition point
exists for the @racket[id]. However, multiple distinct @racket[id]s
can also be defined by a single @racket[defproc*], for the case that
it's best to document a related group of procedures at once.}
it's best to document a related group of procedures at once.
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defproc[((make-pb&j)
(make-pb&j [jelly jelly?]))
sandwich?]{
Returns a peanut butter and jelly sandwich. If @racket[jelly]
is provided, then it is used instead of the standard (grape)
jelly.
}
}|
}
@defform/subs[(defform maybe-kind maybe-id maybe-literals form-datum
@defform/subs[(defform maybe-kind maybe-id maybe-literals form-datum
maybe-contracts
pre-flow ...)
([maybe-kind code:blank
@ -831,14 +865,48 @@ auxiliary grammar specified using @racket[defform/subs].
The typesetting of @racket[form-datum], @racket[subform-datum], and
@racket[contract-expr-datum] preserves the source layout, like
@racket[racketblock].}
@racket[racketblock].
@defform[(defform* maybe-kind maybe-id maybe-literals [form-datum ...+]
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defform[(sandwich-promise sandwich-expr)
#:contracts ([sandwich-expr sandwich?])]{
Returns a promise to construct a sandwich. When forced, the promise
will produce the result of @racket[sandwich-expr].
}
@defform[#:literals (sandwich mixins)
(sandwich-promise* [sandwich sandwich-expr]
[mixins ingredient-expr ...])
#:contracts ([sandwich-expr sandwich?]
[ingreient-expr ingredient?])]{
Returns a promise to construct a sandwich. When forced, the promise
will produce the result of @racket[sandwich-expr]. Each result of
the @racket[ingredient-expr]s will be mixed into the resulting
sandwich.
}
}|
}
@defform[(defform* maybe-kind maybe-id maybe-literals [form-datum ...+]
maybe-contracts
pre-flow ...)]{
Like @racket[defform], but for multiple forms using the same
@racket[_id].}
@racket[_id].
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defform*[((call-with-current-sandwich expr)
(call-with-current-sandwich expr sandwich-handler-expr))]{
Runs @racket[expr] and passes it the value of the current
sandwich. If @racket[sandwich-handler-expr] is provided, its result
is invoked when the current sandwich is eaten.
}
}|
}
@defform[(defform/subs maybe-kind maybe-id maybe-literals form-datum
([nonterm-id clause-datum ...+] ...)
@ -849,7 +917,22 @@ Like @racket[defform], but including an auxiliary grammar of
non-terminals shown with the @racket[_id] form. Each
@racket[nonterm-id] is specified as being any of the corresponding
@racket[clause-datum]s, where the formatting of each
@racket[clause-datum] is preserved.}
@racket[clause-datum] is preserved.
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defform/subs[(sandwich-factory maybe-name factory-component ...)
[(maybe-name (code:line)
name)
(factory-component (code:line #:protein protein-expr)
[vegetable vegetable-expr])]]{
Constructs a sandwich factory. If @racket[maybe-name] is provided,
the factory will be named. Each of the @racket[factory-component]
clauses adds an additional ingredient to the sandwich pipeline.
}
}|
}
@defform[(defform*/subs maybe-kind maybe-id maybe-literals [form-datum ...+]
@ -935,7 +1018,17 @@ Like @racket[specspecsubform], but with a grammar like
Like @racket[defproc], but for a parameter. The
@racket[contract-expr-datum] serves as both the result contract on the
parameter and the contract on values supplied for the parameter. The
@racket[arg-id] refers to the parameter argument in the latter case.}
@racket[arg-id] refers to the parameter argument in the latter case.
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defparam[current-sandwich sandwich sandwich?]{
A parameter that defines the current sandwich for operations that
involve eating a sandwich.
}
}|
}
@defform[(defboolparam id arg-id pre-flow ...)]{
@ -950,7 +1043,16 @@ Like @racket[defproc], but for a non-procedure binding.
If @racket[#:kind kind-string-expr] is supplied as
@racket[maybe-kind], it is used in the same way as for
@racket[defproc], but the default kind is @racket["value"].}
@racket[defproc], but the default kind is @racket["value"].
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defthing[moldy-sandwich sandwich?]
Don't eat this. Provided for backwards compatibility.
}
}|
}
@deftogether[(
@ -974,7 +1076,18 @@ If @racket[#:kind kind-string-expr] is supplied as
Similar to @racket[defform] or @racket[defproc], but for a structure
definition. The @racket[defstruct*] form corresponds to @racket[struct],
while @racket[defstruct] corresponds to @racket[define-struct].}
while @racket[defstruct] corresponds to @racket[define-struct].
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defstruct[sandwich ([protein ingredient?] [sauce ingredient?])]{
A strucure type for sandwiches. Sandwiches are a pan-human foodstuff
composed of a partially-enclosing bread material and various
ingredients.
}
}|
}
@defform[(deftogether [def-expr ...] pre-flow ...)]{
@ -984,7 +1097,18 @@ single definition box. Each @racket[def-expr] should produce a
definition point via @racket[defproc], @racket[defform], etc. Each
@racket[def-expr] should have an empty @racket[pre-flow]; the
@tech{decode}d @racket[pre-flow] sequence for the @racket[deftogether]
form documents the collected bindings.}
form documents the collected bindings.
Examples:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@deftogether[(@defthing[test-sandwich-1 sandwich?]
@defthing[test-sandwich-2 sandwich?])]{
Two high-quality sandwiches. These are provided for convenience
in writing test cases
}
}|
}
@defform/subs[(racketgrammar maybe-literals id clause-datum ...+)

View File

@ -242,7 +242,8 @@
[(date<? b a) #f]
[else (string-ci<? (auto-bib-key a) (auto-bib-key b))]))))
(define (ambiguous? a b)
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
(and (string-ci=? (author-element-cite (extract-bib-author a))
(author-element-cite (extract-bib-author b)))
(auto-bib-date a)
(auto-bib-date b)
(date=? a b)))

View File

@ -29,6 +29,7 @@
(define herefigure-style (make-style "Herefigure" figure-style-extras))
(define figureinside-style (make-style "FigureInside" figure-style-extras))
(define legend-style (make-style "Legend" figure-style-extras))
(define figure-target-style (make-style "FigureTarget" figure-style-extras))
(define centertext-style (make-style "Centertext" figure-style-extras))
(define figure-style (make-style "Figure" figure-style-extras))
@ -52,7 +53,7 @@
figure-style
(list
(make-nested-flow content-style (list (make-nested-flow figureinside-style (decode-flow content))))
(make-paragraph centertext-style (list (make-element legend-style (list (Figure-target tag) ": " caption)))))))
(make-paragraph centertext-style (list (make-element legend-style (list (make-element figure-target-style (list (Figure-target tag) ": ")) caption)))))))
(define (*figure style tag caption content)
(make-nested-flow
@ -65,7 +66,7 @@
(list
(make-paragraph
plain
(list (make-element legend-style (list (Figure-target tag) ": " caption))))))))))
(list (make-element legend-style (list (make-element figure-target-style (list (Figure-target tag) ": ")) caption))))))))))
(define (figure* tag caption . content)
(*figure centerfiguremulti-style tag caption content))

View File

@ -12,6 +12,8 @@
\vspace{4pt}
\legend{#1}}
\newcommand{\FigureTarget}[1]{#1}
\newlength{\FigOrigskip}
\FigOrigskip=\parskip

View File

@ -12,11 +12,18 @@
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep")
#:date "2012"))
@(define c (make-bib #:title "Diss 3"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep" "Peep2")
#:date "2012"))
According to the following people,
@cite[a]
@cite[b]
@cite[c]
@citet[a]
@citet[b]
@citet[c]
@cite[a b]
@cite[b a]
@citet[a b]

View File

@ -1,9 +1,10 @@
According to the following people,  (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)
al. 2012b)  (Little et al. 2012c) Little et al. (2012a) Little et
al. (2012b) Little et al. (2012c)  (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.
Little, Bo, and Peep. Diss 1. PhD dissertation, NEU, 2012a.
Little, Bo, and Peep. Diss 2. PhD dissertation, NEU, 2012b.
Little, Bo, Peep, and Peep2. Diss 3. PhD dissertation, NEU, 2012c.