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

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

If this is a desired interface, then I should expose the
'generate-bib' function, because the whole thing is fairly useless
without it. Should I do that?

Jay

On Mon, Mar 25, 2013 at 8:25 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> It seems to me that I'd want to use those other functions so that I can
> write new citations with 'make-bib' but still keep old citations around that
> I've not yet translated. No?
>
> Robby
>
>
>
> On Mon, Mar 25, 2013 at 9:19 AM, Jay McCarthy <jay.mccarthy at gmail.com>
> wrote:
>>
>> 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
>> uses.)
>>
>> 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.
>>
>> Jay
>>
>>
>> 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
>> http://faculty.cs.byu.edu/~jay
>>
>> "The glory of God is Intelligence" - D&C 93
>>
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

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


Posted on the users mailing list.