I have written an alias in ~/.bashrc to compile my tex files into pdfs. I am sure that ~/.bashrc is sourced.

alias p='rm -f *.pdf *.log *.aux;pdflatex *.tex;open *.pdf'

However, after I edit my .tex file in XCode, save, and run the command p in my terminal, the pdf that opens is a previous version, not the latest version. The pdf matching the latest version of my tex file surfaces after I run p several times.

What is causing the lag? My Mac Air runs Lion.

  • Update: pdflatex is working at compiling the right version of my tex. However, the open command seems to be opening an older version of my pdf. Why? – David Faux Apr 7 '12 at 16:19
  • 1
    Are you sure that open really opens the file again? It may just display the already opened pdf from the previous run again. And did you look at the timestamps of your .tex and .pdf files? – nohillside Apr 7 '12 at 18:14

A few thoughts:

  • This question better asked at the TeX.SE site.
  • .tex files need to be compiled multiple times, not just once. Run pdflatex *.tex 3x and then open, and it should work
  • There are much much better LaTeX editors than XCode.
  • The latexmk script is, in my opinion, the best .tex compiler. It handles compiling the file as many times as necessary. rubber is another LaTeX compiler.
  • Thank you. 1) That makes sense, sorry. 2) Why does pdflatex require multiple compilations? That sounds redundant. 3) Thanks, I'll look around. 4) I'll check out latexmk. – David Faux Apr 7 '12 at 18:49
  • pdflatex doesn't require multiple compilations. Your .tex file requires multiple compilations. Reasons might be explained here: tex.stackexchange.com/questions/19638/… and tex.stackexchange.com/questions/35832/… and tex.stackexchange.com/questions/30674/… It isn't redundant, it is the architecture of (La)TeX. It needs one pass to find, for ex, references, and another to build the ToC, etc. – user588 Apr 7 '12 at 19:29
  • Also, perhaps your alias is the issue. You use pdflatex *.tex. Do you have multiple .tex files in this folder? *.tex will, I think, default to alphabetical (complicated by UTF-8, i8n, upper/lowercase, etc.), which might make it compile things in the wrong order if you are compiling multiple things. – user588 Apr 7 '12 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .