Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
    
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? –  patrix Apr 7 '12 at 18:14
add comment

1 Answer

up vote 1 down vote accepted

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.
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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