3

I'm in the middle of a "drop a file here and compile it using Latex" project. I have a dropbox and I would like to drop a .tex file in a specific folder and have a script that compiles It for me. I'm on MAC OS X (Snow Leopard). Can you point me on a .sh script or an Automator one (a Tutorial would be good too) that compile my documents into a PDF using pdflatex?

How could I handle the latex document dependencies like .sty, images, whatever?

1

1 Answer 1

2

You want to use latexmk, which is a perl script that automatically handles latex document dependencies and figures out how many times to call pdflatex, bibtex, etc to fully compile the document. You want something like:

latexmk -pdf paper

where paper.tex is the main .tex file for your document. This will compile paper.tex to paper.pdf, calling everything it needs to on the way. There are two ways to do the automated recompile you want:

  1. The UNIX-y way: open a terminal, call latexmk -pdf -pvc paper and leave the terminal window open. This doesn't quite do what you want but rather puts latexmk into continuous update mode. Whenever you save any of the files that paper.tex depends on, it will automatically recompile in the background.

  2. The more Mac-y way: create a folder action that calls latexmk -pdf on .tex files whenever they get saved to your dropbox folder. I don't have an Applescript that does it, but it should be straightforward to modify the add - new item alert.scpt that comes with Snow Leopard to do exactly this.

1

You must log in to answer this question.

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