Does anyone use latexmk on OS X with either Preview or another PDF, dvi, or PS reader?

I've recently switched from Linux and installed MacTex to use Latex. I am used to using Vim to edit the source file and having latex -pvc running so that it will update the preview on xdvi upon save.

I am aware that I can run xdvi using XQuartz, but I have it setup to run fullscreen, so it is not very useful when I don't want to go into X11 mode altogether.

The problem with using Preview is that it will only update from the PDF file when Preview receives focus. I could not figure out if there is a command to trigger Preview to reload the PDF file.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

I think among common PDF viewers for Mac, Skim would be your best bet, but I don't have a mac and haven't tried it.

However, my actual advice would be different. xdotool is also available for Mac. Rather than using latexmk, I'd use a vim autocmd for vim's CursorMoved and CursorMovedI events which saved your file automatically, and then called a script that recompiled your LaTeX source if it's been edited and if there are no errors, uses xdotool to send the keystroke needed to refresh your PDF/DVI display.

But I believe MuPDF is available for Mac as well, and it's probably the fastest PDF viewer out there. Personally, what I do (on Linux) is use a combination of vim scripts and bash scripts so that my file is always compiling as I type, and the MuPDF preview updated whenever compiling finishes without errors. That way the preview updates as I type. There is a lag, so it's not quite WYSIWYG speed, but it's close enough for me.

You can read my method and download the scripts I use here. They're for Linux, but I think it could probably be adapted for Mac. I don't have access to one, so I can only provide so much help, but I think it would be cool if someone tried to make the necessary changes.

Also, there's probably a way to get things going with latexmk too, which I what I used to do, but it turned out to be slower than my own scripts. The LaTeX box plugin interacts with latexmk, and a Mac user I know likes it a lot, but I have never seen its interface with a previewer.

link|improve this answer
I had checked Skim before I posted the question, but on the second look, it turns out to have an option to reload on file change. – Barum Rho Jan 4 '11 at 6:39
For others, I could not find MuPDF for OS X. I can probably run it with XQuartz (an X11 implementation on OS X). My guess is that the same applies to xdotool. And, thank you for the link to your scripts. Although I don't really need as-you-type updates, I like the idea of not having to start and exit latexmk process separately. – Barum Rho Jan 4 '11 at 6:52
I've never tried it, but doesn't the Darwin binary on the MuPDF download page work on Mac? mupdf.com/download I guess you could build from source. Anyway, the scripts were mainly a starting place for inspiration to work out your own system. Good luck! – frabjous Jan 4 '11 at 17:46
feedback

Your Answer

 
or
required, but never shown

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