Please see this post for context.

We can use texi2dvi to get LaTeX to compile the correct number of times, and to insert a bibtex call into the loop if necessary. rubber is another wrapper script that can accomplish the same thing. (I've even heard of latexmk through TextMate.)

The problem is that both wrappers fail on a compiler error (pdflatex by default). This is a problem since I'm using org-mode as a front end and I'm often not notified of small errors when using wrappers. Sometimes, changing a document and introducing an error can reset counters and I won't notice the counts are busted until I print out the document.

Running pdflatex many times manually in nonstopmode seems to avoid these problems, and counters work as expected.

Do you know of any more latex wrappers, ones that might be more robust to these small errors? Are there any flags I can pass to the existing wrappers to make them "keep truckin'"?

  • I think my answer below may not address your question, and now I also think I don't understand the question. But leaving the answer for the moment. Can you clarify what behavior you would want from such a wrapper? Why is the wrapper failing on a compiler error a problem? What do you want it to do instead? – Faheem Mitha Mar 3 '11 at 19:51
  • @Faheem the wrapper would ideally do two things (in addition to correctly guessing the right number of times to run each compilation command): 1) not stop on error and 2) be verbose. It doesn't need to do these by default, but the only ones I have used so far are texi2dvi and rubber, and neither seem to have these features. – jrhorn424 Mar 4 '11 at 21:49
  • 1
    If you mean cleanly exit instead of sitting at a prompt, latexmk definitely does. The docs say to put $pdflatex = 'pdflatex -interaction=nonstopmode'; in .latexmkrc, for example. Do you want me to dig out a reference? – Faheem Mitha Mar 4 '11 at 21:58
  • @Faheem: No, thanks for the offer. I hadn't looked at latexmk outside of using it in TextMate a handful of times. I'll try compiling a few documents and look into the latexmk docs. Thanks for the tip! – jrhorn424 Mar 4 '11 at 22:06
  • I added the link I got the incantation above from to my answer below. – Faheem Mitha Mar 4 '11 at 22:12

latexmk can be configured to not stop on an error, and can be run in daemon mode, recompiling when the document is updated. I'm not aware if rubber has these features as well. My impression is that latexmk is the most widely used program that handles this kind of TeX/LaTeX compilation/recompilation, and is quite full-featured and reliable. See also https://stackoverflow.com/questions/738755/dont-make-me-manually-abort-a-latex-compile-when-theres-an-error for a self-described "Mini-tutorial on latexmk".

EDIT: I am currently using SCons to handle my LaTeX builds, since it has reasonable support for TeX, and also I use SCons for my general build needs. A minimal example looks like

env = Environment()
env.Program(target='foo', 'foo.tex')

I think the support for TeX is not as robust in SCons as for example latexmk, but it integrates nicely with the rest of my build if I use it this way, and I can do extra programming if necessary. SCons also runs TeX commands in nonstop mode. It is configurable via environment variables, which is handy.


I last looked at rubber two or three years ago, when I think it did not support pdflatex. It appears to now, but I don't see any documentation for it. It says it supports pdflatex in the newest version.

Clearly texi2dvi won't work-- it produces a dvi which means latex, not pdflatex.

latexmk has worked well for me in the past, though I haven't tried it with org-mode. Though you may want to take a look at this Emacs-org-mode and latexmk

  • thanks for the link! I accidentally ran into that post yesterday when looking for the org-mode tag. Also, you make a great point about texi2dvi. – jrhorn424 Mar 5 '11 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.