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 compiles my documents into a .pdf file using pdfLaTeX?

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

EDIT: I posted the question on SuperUser and I found a good suggestion about using latexmk+folderactions, so go to Dropbox + Latex: automated pdf compile [SU] for details.

  • 2
    It seems that its being in your dropbox folder is irrelevant. It certainly won't be possible to have you upload a file to dropbox and get it compiled "server side" as it were. So it would be being compiled on your machine when you put it in a particular folder, whether or not that folder is synced. – Seamus Aug 9 '10 at 15:14
  • Ok let's add a real scenario: I have a mac mini @home and a dropbox @home and @work (of course on on the web too). I would like to attach a script to the home compile-tex folder inside my dropbox and have the script compile every "thing" (.tex+resources or .zip) i put inside this special folder either locally from my mac mini finder or remotely from my office through the dropbox. I can setup the mac mini as always on since it draws only few watts. – microspino Aug 9 '10 at 15:52
  • I guess this is more of an OS X specific question then a TeX question. You might find better help at superuser.com – Caramdir Aug 9 '10 at 16:50
  • I’m almost certain that this question would be much better asked on Super User than here. – Konrad Rudolph Aug 10 '10 at 9:38

You can add a Folder Action to your dropbox: when something new arrives it'll fire off an AppleScript to fire off the commands to compile the file.

In Finder, right click on the folder. Go to Services and then Folder Actions Setup. You can then select which action (you can add yours to show up in the options).


Just a recent update. There is an app for the iPad - Tex Touch that allows this. On the developers site it has instructions about how to set up a dropbox folder with an action so a file synched off the iPad can be compiled on your home machine and returned to the iPad as a PDF.


You can compile file .tex from the command line by just typing pdflatex file.tex, assuming all your resources (graphics, style files) are where the .tex file says they are.

If you can assume that then you could just write a shell script that checks the directory for all .tex files then, if the timestamp on the corresponding .pdf file is older then run pdflatex on it.

This should just be a couple of lines of shell code. Like Caramdir suggests, the people at superuser can help you write that script.

Still, chances are the compile will break. So then you have to worry about getting those error messages back to you and not trying to re-compile it again and again.


To make things much easier for yourself, you could use Rubber as the compiler. Rubber handles all the dependency stuff for you, so there's no need to reinvent the wheel.

It's a command-line tool, so you can combine it with any mechanism, such as the previously-mentioned Folder Actions (if you're using a Mac), or anything else. You might want to write a wrapper which checks the exit status, and pops up the .log file if it fails, too. (Or, since you're on Mac, a Growl notification?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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