[racket] "and" in author names in scriblib

From: Joe Gibbs Politz (joe at cs.brown.edu)
Date: Fri Jul 11 08:56:31 EDT 2014

On Fri, Jul 11, 2014 at 12:36 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> Oh, I'm not sure of the best way, but way that should work is if you
> port that one by hand. Just remove it from the bibtex file in question
> and write out the corresponding call to make-bib. (I hope you'll find
> that Matthew's API is a lot less painful and error-prone than
> bibtex's!).
>
> You should be able to define the result of the call to make-bib:
>
> (define a-paper (make-bib ... #:author (authors (author-name "Edward L." ....))
>
>  and then:
>
>    @citet[a-paper]
>
> in your paper...

Thanks, a version of this worked, though I couldn't figure out how to
do it with exactly what you suggested.  Using a combination of
define-cite and define-bibtex-cite* worked.  Now I have:

(define deci (make-bib ...))

(define special-keys
  (hash "deci-self-determination" deci))

(define-cite autobib-cite _ generate-bib #:style number-style)
(define-bibtex-cite* "built-bib.bib" autobib-cite _ ~cite-id citet-id)

(define (~cite . keys)
  (if (> (length keys) 1)
    (apply ~cite-id keys)
    (cond
      [(hash-has-key? special-keys (first keys))
       (autobib-cite (hash-ref special-keys (first keys)))]
      [else (~cite-id (first keys))])))

And I use ~cite in my document.

The only downside here is that I can't figure out how to mix the two
kinds of citations in a single cite list, so I have the single-element
hack you see here, but that can be worked around for now.

One suggestion --- it may be worth extending define-bibtex-cite(*) to
allow taking a bibdb as an argument, or binding the bibdb that's
created internally to something externally visible.  This would let a
client get at the autobib structures that scriblib/bibtex creates, and
more freely mix autobib cites with key-based cites.

Either way, thanks!


>
> On Thu, Jul 10, 2014 at 10:29 PM, Joe Gibbs Politz <joe at cs.brown.edu> wrote:
>>> You can just edit the file in your copy of racket and then run 'raco setup'.
>>
>> Good point, thanks, that'll work in a pinch for the final build.
>>
>> Still open to other ideas, because among myself and my co-authors
>> there are probably half a dozen machines that this might end up
>> getting built on, so something that works without editing Racket would
>> be a plus.
>>
>> On Thu, Jul 10, 2014 at 10:03 PM, Robby Findler
>> <robby at eecs.northwestern.edu> wrote:
>>> Oh, and of course you could just use:
>>>
>>>    (authors (author-name "Edward L." "Deci")
>>>            (author-name "Robert J." "Vallerand")
>>>            (author-name "Luc G." "Pelletier")
>>>            (author-name "Richard M." "Ryan"))
>>
>> Where can I put that?  Right now all the bib info is in a bibtex file
>> and being imported via define-bibtex-cite with a lot of other
>> citations, so I'm not sure how to override that only partially with
>> this list.  Can I add new citations to the thing that gets generated
>> from define-bibtex-cite, so I can keep all the existing citations in
>> bibtex and just write this one out in the long form?
>>
>> Sorry for my ignorance, the bibtex/citation stuff in Scribble is a bit
>> magical to me and usually just works for the most part, so I don't
>> actually understand what's going on underneath.
>>
>> Thanks!

Posted on the users mailing list.