Saturday, November 4

So Levi wrote last night asking for some help with the citations in his dissertation. He's using LaTeX, with BibTeX (what else?) for the cites. Figuring out why it wasn't working (he was using an outdated style file) was more painful than it should have been, but I learned a few things in the process.

I was going to do a detailed write-up here, but when I began contemplating the level of exposition it would take to make a useful and interesting narrative (even playing fast and loose with the meaning of interesting), I became incredibly discouraged.

Instead, I will just list some things that might be useful if you find yourself trying to do APSR-style cites and LaTeX keeps crapping out on you.

+

harvard.sty, apsr, biblatex, et cetera.

  • Look for references to a command called \harvardand. On my system, typing exit at the ? prompt after LaTeX stops on an undefined control sequence (here's a screenshot) opens vim to the appropriate line of the offending file, which is so useful it almost hurts. If you find that LaTeX does not know what your .bbl file is talking about when it says \harvardand, you probably have an older version of harvard.sty.
  • Here is a Harvard citation package for use with LaTeX 2e, a re-implementation of the original Harvard package. Probably you just need to replace harvard.sty from the newer archive.
  • harvard.ps is useful documentation for this.
  • Once you have the right style file, you need to run latex and bibtex a bunch of times. I know, this is obvious and you already get the general idea about resolving all those references from that time you spent 16 hours wrestling with LaTeX's table-of-contents features. I only mention it because some other poor slob might have forgotten. Not you. Never. Anyway, on my system, this meant doing: pdflatex dissertation; bibtex dissertation; pdflatex dissertation; pdflatex dissertation. Or at least I think it did, because honestly I couldn't tell you whether all of those iterations are actually necessary. Like a chicken which has been fed in synch with random flappings or peckings and returns again and again to the same behavior in hopes of further reward, I'm just doing what works.

On a related note, biblatex looks cool:

The biblatex package is a complete reimplementation of the bibliographic facilities provided by LaTeX in conjunction with BibTeX. It redesigns the way in which LaTeX interacts with BibTeX at a fairly fundamental level. With biblatex, BibTeX is only used to sort the bibliography and to generate labels. Instead of being implemented in BibTeX's style files, the formatting of the bibliography is entirely controlled by TeX macros. Good working knowledge in LaTeX should be sufficient to design new bibliography and citation styles. There is no need to learn BibTeX's postfix stack language. Just like the bibliography styles, all citation commands may be freely (re)defined.

Unfortunately, it's not going to work with something like harvard.sty or any related bibliography style files you happen to be using, though it offers a number of citation styles out of the box, and you could probably implement new ones without too much suffering.

ze bigger piktur

So anyway, I had no idea before today how BibTeX bibliographies and citations are supposed to work. Now I more or less get it, and it seems nifty, in a convoluted and moderately hackish way. You've got this structured text file that defines the publications you're citing, like so:

@book{AtlasNarodovMira1964,
  Editor = {Bruk, Salomon I.},
  Publisher = {Moscow: Academy of Science USSR},
  Title = {Atlas Narodov Mira (Atlas Of The Peoples Of The World)},
  Year = {1964}}

And then in your document you say something like \cite{AtlasNarodovMira1964}, and when you run bibtex over all this, it resolves the references and pulls everything you've cited into a bibliography (pushed through a stylesheet in yet another language, unless you're using the above-mentioned biblatex), and there you are. It's ugly, and yet it's kind of elegant.

I think possibly the thing I like best about this is that none of it is in XML.

Is there any reason to believe the world would be a better place if it were? I mean,

<book id="AtlasNarodovMiral1964">
  <editor>Bruk, Salomon I.</editor>
  <publisher>Moscow: Academy of Science USSR</publisher>
  <title>Atlas Narodov Mira (Atlas of the Peoples of the World)</title>
  <year>1964</year>
</book>

isn't that bad, but it's mostly just wordier, and who wants to type it by hand? Especially when you'd really be doing

<book id="AtlasNarodovMiral1964">
  <editor>Bruk, Salomon I.</editor>
  <publisher>
    <loc>Moscow</loc>
    <name>Academy of Science USSR</name>
  </publisher>
  <title lang="ru">Atlas Narodov Mira</title>
  <title lang="en">Atlas of the Peoples of the World</title>
  <year>1964</year>
</book>

Yeah, standard tools, semantic whatever. The odd thing is, this isn't even a domain where XML wouldn't make sense. I'm sure there's an XML bibliography format or eight floating around, and they probably aren't all that awful, verbosity aside. Maybe I'm just becoming allergic to angle brackets.

Or possibly I'm becoming allergic to the clouds of obfuscatory philosophical noise that seem to surround most anything XML-based. For years I operated under the impression that I was missing something really deep in all the discussion I read, which seemed odd for a format that, at the heart of things, is about putting words marked with angle brackets around other words. Since I started encountering XML situations where I could say gosh, this is kind of stupid, I've stopped thinking of most of it as depth. It's more of a mushy, all-consuming vagueness.

I mean, something like LaTeX... LaTeX is sometimes not much less ugly than XML, even though I have a personal affinity for curly brackets, and it breaks all over the place in ways that just make no goddamn conceptual sense. But it does have this kind of earthy physicality to it.