I'd like to use Apple's Automator in order to create a service (available from the Finder's right-click menu over a file) called "Compile TeX file" that runs a simple command using the selected file as an input.
- Inside a folder (/Volumes/Data/TeX_docs/) I've an exemple.tex file created by Scrivener that is ready for compiling with LaTeX.
- I'd like to right click this file and from the Finder's Service menu choose the option "Compile TeX file"
- Once chosen, this service will execute the command
latexmk -pdf -bibtex exemple.texand so compile the .tex file inside the same folder, creating a .pdf file (This Terminal command is working perfectly right now, so the need to automate this action!)
- After compiling the .tex file, a dialog box appears and asks if I want to delete all the temporary files with a
Yesis chosen, it deletes all TeX temp files (.aux,.bbl,.bcf,.fdb_latexmk,.fls,.log,.out,.run.xml) and keep only the original exemple.tex and the new exemple.pdf file. Otherwise, it does nothing more and I have all the files in the end!