I'm using Vim to write LaTeX on my Mac.
I could make a shortcut to execute
pdflatex (it should be possible right?) and see the result on Preview. But it steals the focus when it updates to the new pdf, so it's quite annoying.
What do you suggest?
When I write my Latex Documents I use always this small Makefile i've written. You can execute it the same way Patrick proposed it. (:!make c or :!make C or :!make pdf or :!make clean)
EXTENSIONS:=aux bbl blg cut dvi log out pdfsync ps synctex.gz tdo toc tex~ backup xmpi fls fdb_latexmk lof lot MAIN:=main.tex PDF_NAME:=pdf_name default: pdf pdf: latexmk -pdf -jobname="$(PDF_NAME)" -shell-escape $(MAIN) clean: latexmk -c $(MAIN) @for i in $(EXTENSIONS); \ do \ for file in `find . -name "*.$$i"`; do rm $$file; done; \ done; \ rm -rf _minted* C: make clean; \ rm *.pdf c: make C; \ make; \ make clean;
On Ubuntu at least,
evince foo.pdf &, started from the terminal, refreshes its display when it notices that foo.pdf has changed, without stealing focus. From within
:!make then does what you want. I don't have a Mac to play with, but some Mac pdf viewer may behave like this too.
The best way I've found so far is to type
:!pdflatex [insert rest of command here] within vim to compile it, then view it with Skim. If you change the file while it is open in Skim, Skim will ask if you want to display the current file automatically once, so choose the affirmative option, and then you can watch it update in the background each time you compile. Also, don't forget that
:!! will repeat the last shell command, so you don't have to type out the compile command each time.