Is there a clever way to cause the unix make command to run a tex variant as many times as are required to resolve all references? I've used tex for a long time, and I still don't know which of all those extra files (.aux, .log, etc) should be checked, so I usually just run (pdf)latex 3 times, but that is slow for a 400 page document. I am thinking that a fragment such as the line below might be a starting point ... maybe I should just string 3 or so of these together?

(pdflatex oar | grep -vq 'here were undefined references')

I've used in the past this Makefile, from Yannick Copin.

But, I guess latexmk also has some advantage over make (although I like using custom Makefile).

| improve this answer | |
  • @Yannick: Thanks. I like make because I'm doing a lot of extra things in there, besides the *tex work. Maybe I should use latexmk and make together, though. – dank Jan 5 '11 at 11:53
  • 1
    @dan, definitely, having make use latexmk to build *tex documents is the way to go. – Juan A. Navarro Jan 5 '11 at 12:00
  • @dan Yes, I also use custom Makefile for compiling extra stuff (like Asymptote code) and calling external program, e.g. pdfnup. Never tried to combine latexmk and make, though. – chl Jan 5 '11 at 12:13
  • It's a pity that the link to the Makefile example is broken now (Forbidden response), so that we cannot study this answer and learn something. – imz -- Ivan Zakharyaschev Oct 30 '15 at 16:09

You also get an undefined reference, when it is an unknown one ...

You can delete the time stamp line from the logfile and then build the md5 sum or whatever. When it didn't change then you have no changes in the document. You can also speedup your compilation time, when you do not build a pdf in the first or two run: pdflatex -draftmode ..., then only the aux|idx|...-files will be created to get correct labels/references.

| improve this answer | |
  • Thanks, I didn't know about -draftmode. It speeds up my compilation by 10 percent. – dank Jan 5 '11 at 11:51
  • +1 for -draftmode . – lockstep Jan 5 '11 at 11:51
  • (+1) All good things to know, thx. – chl Jan 5 '11 at 12:23

See latexmake and UltimateLatexMakefile for instance. See also Tools for automating document compilation.

| improve this answer | |

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.