Scribble citations for art history dissertation (AJA style)

19 views
Skip to first unread message

Christopher Lemmer Webber

unread,
Mar 19, 2020, 11:46:49 AM3/19/20
to Racket Users, Morgan Lemmer-Webber
Hello,

As some of you know (since we talked about it in a racketcon talk a
couple of year ago), my spouse Morgan (cc'ed) is writing her art history
dissertation in Scribble. She's getting close to finishing it (yay!)
and we've been very happy with Scribble for this use in general, except
for one thing that we've been procrastinating on... the apparent
inflexibility of Scribble's bibliography support.

As far as I can tell, both scriblib bibliographies and the
scribble/manual bibliography toolings both just assume "welp, here's the
citation style we support, and we're going to hardcode that":

(define (bib-entry #:key key
#:title title
#:is-book? [is-book? #f]
#:author [author #f]
#:location [location #f]
#:date [date #f]
#:url [url #f])
(make-a-bib-entry
key
(make-element
"bibentry"
(append
(if author `(,@(decode-content (list author)) ", ") null)
(if is-book? null '(ldquo))
(if is-book?
(list (italic title))
(decode-content (list title)))
(if location '(",") '("."))
(if is-book? null '(rdquo))
(if location
`(" " ,@(decode-content (list location)) ,(if date "," "."))
null)
(if date `(" " ,@(decode-content (list date)) ".") null)
(if url `(" " ,(link url (tt url))) null)))))

I was... really surprised when I saw this. What I thought was the more
"Racket'y way" would be to store it as abstract data that then could be
rendered to the appropriate style (that's what BibTeX and everything
else does). So it seems like:

1) This is very inflexibly tied to a specific citation style... the
format we need is preferably AJA, but Chicago Style or MLA also
are acceptable.
https://www.ajaonline.org/submissions/references
2) What about new fields? There are some citations we're pulled in
from Morgan's Zotero database that have important fields that
don't appear to be in the bib-entry.

I wonder if I'm missing something? Maybe the bibtex system is what I
should look at, but I'll admit that I really don't understand how it
works based on its documentation.

I suppose if worst comes to worst I can roll my own thing or kludgily
fork one from scribble's modules but I'd rather not if possible.

Thoughts welcome. Thank you!

- Chris

Matthew Flatt

unread,
Mar 19, 2020, 12:26:15 PM3/19/20
to Christopher Lemmer Webber, Racket Users, Morgan Lemmer-Webber
At Thu, 19 Mar 2020 11:46:44 -0400, Christopher Lemmer Webber wrote:
> What I thought was the more "Racket'y way" would be to store it as
> abstract data that then could be rendered to the appropriate style
> (that's what BibTeX and everything else does).

Well, perhaps the Rackety way is to store it as abstract *code*. That
abstraction is what the `make-bib`, etc., functions are meant to be.

But you're absolutely right that the language of `make-bib` should be
more extensible. Currently, `location` is clearest the extension point,
but there are still just a bunch of predefined locations, instead of a
protocol for adding new ones. And `location` by itself is probably not
enough extensibility.

And you're right that the way that language renders to references and a
bibliography needs to be configurable and extensible. You can pick
among a few styles in `define-cite`, but that mostly just controls the
way references render, not the bibliography.

You could build something new and better --- or maybe just different
and more applicable to your case. But if you're interested in improving
and generalizing `scribble/scriblib`, I'd be happy to work with you on
it.

Christopher Lemmer Webber

unread,
Mar 19, 2020, 12:38:45 PM3/19/20
to Matthew Flatt, Racket Users, Morgan Lemmer-Webber
Matthew Flatt writes:

> At Thu, 19 Mar 2020 11:46:44 -0400, Christopher Lemmer Webber wrote:
>> What I thought was the more "Racket'y way" would be to store it as
>> abstract data that then could be rendered to the appropriate style
>> (that's what BibTeX and everything else does).
>
> Well, perhaps the Rackety way is to store it as abstract *code*. That
> abstraction is what the `make-bib`, etc., functions are meant to be.

I'm not sure what "store it as abstract code" means in this case; I
could interpret that a number of ways...

But maybe you mean that the interface, at least, is mostly abstract. I
agree with that.

> But you're absolutely right that the language of `make-bib` should be
> more extensible. Currently, `location` is clearest the extension point,
> but there are still just a bunch of predefined locations, instead of a
> protocol for adding new ones. And `location` by itself is probably not
> enough extensibility.

Yes I think so.

> And you're right that the way that language renders to references and a
> bibliography needs to be configurable and extensible. You can pick
> among a few styles in `define-cite`, but that mostly just controls the
> way references render, not the bibliography.
>
> You could build something new and better --- or maybe just different
> and more applicable to your case. But if you're interested in improving
> and generalizing `scribble/scriblib`, I'd be happy to work with you on
> it.

Thank you for your clear response, as well as your offer to collaborate
on it.

I will spend the rest of the day looking at what scriblib's bibliography
stuff does in further detail and think about how to accomplish what we
need. It could be that what I do is build a quicker proof of concept
that accomplish *Morgan's* needs so we can get her dissertation out the
door, and then upon examining that, we can think about how to generalize
it for something more universal. How does that sound?

Matthew Flatt

unread,
Mar 19, 2020, 12:40:19 PM3/19/20
to Christopher Lemmer Webber, Racket Users, Morgan Lemmer-Webber
At Thu, 19 Mar 2020 12:38:39 -0400, Christopher Lemmer Webber wrote:
> I will spend the rest of the day looking at what scriblib's bibliography
> stuff does in further detail and think about how to accomplish what we
> need. It could be that what I do is build a quicker proof of concept
> that accomplish *Morgan's* needs so we can get her dissertation out the
> door, and then upon examining that, we can think about how to generalize
> it for something more universal. How does that sound?

That sounds like a good plan.

Philip McGrath

unread,
Mar 19, 2020, 12:55:26 PM3/19/20
to Matthew Flatt, Christopher Lemmer Webber, Racket Users, Morgan Lemmer-Webber
For a general solution, I'd take a look at the Citation Style Language (https://citationstyles.org/), which is an XML language for defining how to render citations and bibliographies. A major advantage is that it has libre style definitions for a dizzying variety of house styles, including AJA (https://github.com/citation-style-language/styles/blob/master/american-journal-of-archaeology.csl), many of which seem to be maintained by the relevant publishers. It also integrates with Zotero and its competitors, as well as many other tools.

I'm quite interested in working on this and some related issues as well, though properly digging into it keeps getting pushed aside by other things.

But I agree that a general solution might be best deferred until after the dissertation—best wishes, Morgan!

-Philip

Christopher Lemmer Webber

unread,
Mar 19, 2020, 1:00:07 PM3/19/20
to Philip McGrath, Matthew Flatt, Racket Users, Morgan Lemmer-Webber
Philip McGrath writes:

> On Thu, Mar 19, 2020 at 12:40 PM Matthew Flatt <mfl...@cs.utah.edu> wrote:
>
>> At Thu, 19 Mar 2020 12:38:39 -0400, Christopher Lemmer Webber wrote:
>> > I will spend the rest of the day looking at what scriblib's bibliography
>> > stuff does in further detail and think about how to accomplish what we
>> > need. It could be that what I do is build a quicker proof of concept
>> > that accomplish *Morgan's* needs so we can get her dissertation out the
>> > door, and then upon examining that, we can think about how to generalize
>> > it for something more universal. How does that sound?
>>
>> That sounds like a good plan.
>>
>
> For a general solution, I'd take a look at the Citation Style Language (
> https://citationstyles.org/), which is an XML language for defining how to

Oh wow, this is cool.

> render citations and bibliographies. A major advantage is that it has libre
> style definitions for a dizzying variety of house styles, including AJA (
> https://github.com/citation-style-language/styles/blob/master/american-journal-of-archaeology.csl),
> many of which seem to be maintained by the relevant publishers. It also
> integrates with Zotero and its competitors, as well as many other tools.
>
> I'm quite interested in working on this and some related issues as well,
> though properly digging into it keeps getting pushed aside by other things.

Oh that's great!

> But I agree that a general solution might be best deferred until after the
> dissertation—best wishes, Morgan!

:)

> -Philip

Christopher Lemmer Webber

unread,
Mar 19, 2020, 1:32:34 PM3/19/20
to Philip McGrath, Matthew Flatt, Racket Users, Morgan Lemmer-Webber
Philip McGrath writes:

> For a general solution, I'd take a look at the Citation Style Language (
> https://citationstyles.org/), which is an XML language for defining how to
> render citations and bibliographies. A major advantage is that it has libre
> style definitions for a dizzying variety of house styles, including AJA (
> https://github.com/citation-style-language/styles/blob/master/american-journal-of-archaeology.csl),
> many of which seem to be maintained by the relevant publishers. It also
> integrates with Zotero and its competitors, as well as many other tools.

I might also want to explain what we did about moving from Zotero, where
Morgan originally managed her citations, over to a more
Racket/Scribble-centric approach. This was motivated by Zotero breaking
in some mysterious way between Debian releases and us shrugging our
shoulders and saying "ok, let's just define this in Racket-land".

- I wrote some code that walked through the Zotero XML export to write
out some Racket code that represented the citations instead. It's
pretty gnarly.

- The outputted citations look like:

(define-bibitem Piranomonte2002
(ref-type "Book")
(contributors
(authors
(author "Piranomonte, Marina.")))
(titles (title "Il santuario della musica e il bosco sacro di Anna Perenna"))
(dates (year "2002") (pub-dates (date "2002")))
(pub-location "Milano")
(publisher "Electa")
(isbn "88-370-2126-7 978-88-370-2126-9")
(remote-database-name "http://worldcat.org")
(language "Italian"))

(define-bibitem Pensabene-et-al2001
(ref-type "Book")
(contributors
(authors
(author "Pensabene, Patrizio.")
(author "Falzone, Stella.")
(author "Angelelli, Claudia.")))
(titles
(title
"Scavi del Palatino I : l'area sud-occidentale del Palatino tra l'età protostorica e il IV secolo a.C., scavi e materiali della struttura ipogea sotto la cella del Tempio della Vittoria"))
(dates (year "2001") (pub-dates (date "2001")))
(pub-location "Roma")
(publisher "\"L'Erma\" di Bretschneider")
(isbn "88-8265-119-3 978-88-8265-119-0")
(remote-database-name "http://worldcat.org")
(language "Italian"))

So basically we converted the entire Zotero file over like this, and
Morgan then started maintaining this Racket file instead for her
Bibliography instead.

- The above "citations" include a bunch of fields that don't always
exist in Scribble's system (eg "language" or "isbn" above). These
are actually then stored in an sxml-like alist for now (for
historical intermediate purposes of converting from the Zotero stuff
to this) but a different structure would be better.

- I then have utilities like "record-sxml->bib-entry" that convert
these sxml'ish structures over to a bib entry... it's a lossy
conversion, but this allows Morgan to maintain fields she needs that
aren't currently handled by Scribble's bibliography tools.

It's a mess, but it does work and did provide us a path from Zotero ->
maintaining stuff directly in Racket. Of course the main problems right
now are that converting to bib-entry is lossy / doesn't render to the
right format, but the fact that we still have the data before that
conversion means we can just swap out that code once we have something
better.

I'm posing this not as "this is the right way to do it" but as an
opening for a conversation... especially in that right now, the auto-bib
struct makes some very specific assumptions about what fields are
available:

(define-struct auto-bib (author date title location url note is-book? key specific))

The right solution is to provide something more open-ended / extensible
to the needs of the particular domain the user is coming from.

This is what makes me unsure about how to convert scriblib's existing
code... it's making a lot of assumptions. How to un-assume? I'm not
sure yet though.

Thoughts welcome, of course.
Reply all
Reply to author
Forward
0 new messages