[racket] [Scribble] bibdb-bibs empty, bibdb-raw isn't

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Mar 25 10:19:35 EDT 2013

Your bib database is fine. You're just using the library wrong.

The only interface you should use is 'define-bibtex-cite'. The ~cite
and citet functions that are generated create the 'bib' structure for
entries in the BibTex database as you use them. They are then cached
in bibdb-bibs (because autobib requires them to be eq on different

The other functions/structures are just documented in case someone
wants to process BibTex files for some purpose other than using them
in Scribble documents.

At the time I wrote this, define-cite had no options. I've updated the
define-bibtex-cite to support given options to define-cite. This
should allow you to use the #:style option with define-bibtex-cite.


On Sun, Mar 24, 2013 at 12:13 PM, Joe Gibbs Politz <joe at cs.brown.edu> wrote:
> Hi!  I'm trying to use path->bibdb and/or bibtex-parse on a bibtex file, and
> I'm getting a bibdb where bibdb-raw looks good, but bibdb-bibs is an empty
> hash.  I'm not missing some initialization step, am I?  Am I supposed to be
> constructing the bib structs on my own or something?  A little confused...
> (Note: Alternatively, if I could use #:number-style with define-bibtex-cite,
> I'd be all set as well, because *that* seems to parse and generate the right
> bibliography and ~cite works, but doesn't format the citations the way I
> want.)
> Code:
> ======
> #lang racket/base
> (require scriblib/autobib scriblib/bibtex)
> (provide generate-bib ~cite)
> (define-cite _~cite citet generate-bib #:style number-style)
> (define db (bibtex-parse (open-input-file "joe.bib")))
> (define (~cite key)
>   (_~cite (hash-ref (bibdb-bibs db) key (λ () (error 'cite (format "No bib
> entry: ~a\n" key))))))
> ======
>> (bibdb-bibs db)
> #hash()
>> (bibdb-raw db)
> '#hash((... lots of stuff ...))
> Here's joe.bib (could certainly be ill-formed, I notice some encoding issues
> viewing it in my browser, but I use it with bibtex just fine.  Maybe some
> sadness in the formatting is causing a bad parse?  But I'd expect an error
> message if that's the case...)
> http://cs.brown.edu/~joe/public/joe.bib
> Thanks!
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.