Skip to content

A few neat BibTeX tricks

LaTeX is one of those remarkable things: it seems to be very widely used in the scientific community, yet available user-friendly software is scarcely available (TeXnicCenter doesn’t really seem to be actively developed, LyX doesn’t really provide full support and uses a special, non-LaTeX, file format, and that’s pretty much it), and the documentation is rather sparse. So, you have to google every thing you want to do and find variously hackish tips and tricks… Here are some.

Comments in BibTeX

Comments in LaTeX start with a %. I don’t think they implemented multiline comments. You’d think BibTeX would use the same format? Well, think again. Comments in BibTeX look like:
@Comment{This is my comment}
The good news is: it works on multiple line. The bad news is: it doesn’t work inside another tag. So you can’t have, say:
@Comment{Nice taxonomy of feature selection methods}
title={A review of feature selection techniques in bioinformatics.},
publisher={Oxford Univ Press},
author={Saeys, Yvan and Inza, Iñaki and Larrañaga, Pedro},

But you need to put the comment out of that @article block.

Forcing a specific display of authors’ names

I had a case where one of my reference had as an author the “MAQC Consortium” (or as an alternative, the huge list of all members of this consortium). The default BibTeX behavior, as programmed by the editor, was to treat authors as “firstName lastName”, so I had a reference by “Consortium, M.”, not really what I wanted… It’s possible, however, to manipulate the author field using the \relax command. Its typical use is to modify the way the firstName is abbreviated, ie to keep more than its first letter like {\relax Jo}hn Doe vs {\relax Ja}mes Doe. But it can as well be used on the whole author’s name, like:
author={{\relax MAQC Consortium} and John Doe}
I guess that’s cheating, but it works…

Edit: as mentioned in the comments, it was cheating indeed, the proper way is to enclose it in more brackets, like:
{{MAQC~Consortium}} or even just {{MAQC Consortium}}

Getting a BibTeX entry from any PubMed reference

PubMed let you export entries in “Medline” and XML formats, but don’t offer BibTeX export out of the box. However, there’s a web service, TeXMed, able to export PubMed entries to BibTeX. It works by query so you can get a whole batch of entries at the same time by searching by keywords, but if you only want one specific entry just search for its PMID.

Posted in LaTeX.

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Leo says

    Thanks for sharing.
    The correct way of entering a consortium name would be:
    author={{MAQC~Consortium} and \relax{Jo}hn Doe and \relax{Ja}mes Doe}

    • patheticcockroach says

      Thanks, I had a feeling my way of using relax was a bit hackish. Actually, I just tried and even {{MAQC Consortium}} works fine. Is there any reason for keeping the tilde then?

  2. omarwagih says

    Also checkout pubtex to convert all pubmed ids in your document to bibtex:

Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA