LaTeX/BibTeX Tools Worth Knowing

by saurav on May 23, 2011

A couple weeks ago, I was looking around the web for a script that would create a small bib file for just the references cited in a certain TeX manuscript. It took me a while to find the right one (aux2bib), which prompted me to write this post on LaTeX/BibTeX tools that are available but not widely known or used. (Kelle has previously talked about some of the basic LaTeX tools here.) Here are five of my favorites, which I think everybody should consider using:

1) Ultimate LaTeX Makefile: While typing latex/bibtex/latex/latex does the trick, it is inefficient. You should use a makefile which will do all of this in one shot. I prefer the Ultimate LaTeX Makefile (here is an alternative by Chris Munson) but also tend to use my custom bash script, which has latex/bibtex/latex/latex/dvipdfm/aux2bib. (This is arguably similar to the “Typeset” button that the GUI versions of TeX offer.) The Ultimate LaTeX Makefile  has options to produce either a pdf or a ps, tex all documents or just one document in a directory, write to a html file, and delete the various files produced by TeX. The other  reason to use a makefile is not having to produce the bibliography every time you recompile, which is very useful when you are working with large documents.

2) submit_prepare.pl: Marshall Perrin’s perl script prepares your manuscript for submission to the ApJ or ArXiV. The script renames the figures as required by ApJ (e.g. fig1, fig2, …); decreases the resolution of figures and, consequently, the file size (as required for ArXiV submissions); tars everything into a tar.gz file; and removes all comments from the tex file. Especially the first two tasks can be quite time-consuming. This is a great tool to help you get to the “Submit” button.

3) aux2bib: Assuming you maintain a global bibtex file, the number of references it contains easily numbers more than a few hundred. As a result, either storing a copy of the bib file (with the completed paper for your archives) or sending a completely compile-able draft to a collaborator can be a nuisance. David Kotz’s aux2bib makes a sub.bib which includes only the references used in your current draft.

4) ADS-to-BibDesk: I learnt about this Jonathon Sick app from a comment on an AstroBetter post. As the name indicates, this grabs the bibtex, abstract, and PDF for a article from your web browser (Safari or Firefox) and imports it to BibDesk. Having to do this manually is a waste of an astronomer’s time. [Update:] There is also a shell script by Rui Pereira to update the BibDesk references (and pdf) from astro-ph version to the journal version, when it is published.

5) emulateapj: This emulates the ApJ formatting styles and should be very well-known. While it does take a bit of time to convert your aastex to emulateapj, you will have a nicely formatted document at the end. In addition, by uploading fewer pages on to ArXiV, you will save more than a few trees.

I look forward to hearing about more such tools and further automating my LaTeX!

[This post has been reorganized and incorporated in the wiki.]

{ 12 comments… read them below or add one }

1 victor May 23, 2011 at 8:09 am

There are, IMHO, better options than the Ultimate Latex Makefile and aux2bib:
1) latexmk (http://ctan.tug.org/tex-archive/support/latexmk/): can also launch a pdf viewer, watch all the source (and image) files and when it detects changes recompile the document.
3) bibtool (http://www.ctan.org/tex-archive/biblio/bibtex/utils/bibtool/): can do the same as aux2bib but also sort, generate bibtex keys, and many things more.

I also wrote a tool that reads the bibkeys cited in an article and downloads the missing bibtex references from ADS. At some point I will put it online…

Reply

2 saurav May 29, 2011 at 2:59 pm

There are companion tools to aux2bib that do many other things like generating citekeys but bibtool seems to do it all.

I would love to try your other tool; my bibtex database has MANY missing fields, and updating manually is no fun.

3 Chi-kwan Chan May 23, 2011 at 6:53 pm

Hi there, I have a ADS-BibTeX script http://fermi.mycloudnas.com/2011/04/adsbib/ that (more-or-less) combines ADS-to-BibDesk and aux2bib. It probably does the same thing as Victor’s bibtex-from-ADS tool.

Reply

4 saurav May 29, 2011 at 2:56 pm

Very nice tool! I want to note than Chan’s adsbib runs bibtex directly from ADS, assuming your references use the same citekeys that ADS does (e.g., 2009ApJ…701..521C). No need to maintain a local bibliography of your own.

5 Brian Kloppenborg May 23, 2011 at 10:00 pm

Also don’t forget about a Python Script called rubber (https://launchpad.net/rubber) that handles all tasks related to compiling a LaTeX document. From their website:

—–
Rubber is a program whose purpose is to handle all tasks related to the compilation of LaTeX documents. This includes compiling the document itself, of course, enough times so that all references are defined, and running BibTeX to manage bibliographic references. Automatic execution of dvips to produce PostScript documents is also included, as well as usage of pdfLaTeX to produce PDF documents
—–

One of my favorite features is automatic parsing of xfig documents to eps + LaTeX at compile time. Rubber is probably in most package managers on Linux distributions. It’s a Python script so it can, presumably, run on multiple platforms too.

Reply

6 Erik Tollerud May 24, 2011 at 8:23 pm

+1 for Rubber – very useful tool to get out of the latex/latex/bibtex/latex mindset. It works on OS X just fine, too.

I also wanted to mention that astropysics has a tool that has similar functionality to submit_prepare.pl (“prepforpub”), and it’s in python so it’s pretty straightforward to extend to do additional tricks while processing a paper for publication. The documentation for that part is at http://packages.python.org/Astropysics/coremods/publication.html, although it needs to be updated to include the “prepforpub” script.

Reply

7 Kyle Willett May 25, 2011 at 11:58 am

Tool #4 (ADS-to-BibDesk) also works in browsers such as Chrome, at least with my experience. Fantastic tool that I’ve been wanting for a long time.

Latex wishlist: a script that updates your BibDesk/bibtex references from the astro-ph preprint to the published version whenever it appears on ADS …

Reply

8 saurav May 25, 2011 at 12:06 pm

ADS-to-BIbDesk does some that: if you import an article with the same title and author info as the old one, it will delete the older entry. However, if your database could be “synced” periodically, that would be superb! Jonathon Sick, who wrote this app, mentions that he will “eventually” write this.

9 Rui Pereira June 1, 2011 at 2:25 am

Hi. Check the latest version (v2.1) of ADS-to-BibDesk. There’s a new script that does just that. And it would be nice to have someone else testing it :)

10 saurav June 1, 2011 at 3:17 pm

Rui, it works. Thanks! One question: are annotations made in Preview or Acrobat lost when the PDF is updated?

Is it easy to have a fix (optionally) for searching missing fields (e.g., abstract, pdf) and updating them?

11 Rui Pereira June 6, 2011 at 3:56 am

Hi Saurav,

The current development version on my Github fork should be able to detect annotated PDFs from any source, but be aware it is still under testing. About the missing fields, it would in principle be possible but I’m afraid there are no plans to support it for now.

12 saurav June 1, 2011 at 3:11 pm

Dan Foreman-Mackey’s ads_search looks nifty. It allows you to search ADS directly from your computer using something like Alfred but without the need to open a web browser (e.g. a query can looks like “widrow or courteau 1991 2007″).

Reply

Leave a Comment

Previous post:

Next post: