How come compiling my .tex file with my alias is lagging? 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.
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.