Johan Blixt-Dackhammar wrote:
Thank you very much. I am however not experienced with the commands required for that operation. I would highly appreciate a finished code for this! Thanks.
Ok, Allan and I have put together a script that will do it for you. What it does is first asks the user for a new name to save the file in, then makes a temporary directory in /tmp, and runs latex, leaving the output in the temporary directory, then it copies the pdf file to the specified location, and then deletes the temporary directory.
Copy the attached script into a new command, set input to nothing, and output to nothing or tooltip or however you want latex errors displayed, and set the scope to text.latex.
-Jacob
#!/bin/bash
TM_TMPDIR=$(mktemp -d)
PDFNAME=$(osascript -e 'tell app "SystemUIServer"' -e activate -e 'return POSIX path of (choose file name with prompt "Name the PDF:" default name "'"${TM_FILENAME%.*}"'.pdf" default location the path to desktop)' -e 'end tell')
if [[ $? != 0 ]]; then osascript -e 'tell app "TextMate" to activate' &>/dev/null & rm -rf "$TM_TMPDIR" exit fi
pdflatex -output-directory "$TM_TMPDIR" -jobname "latex-job" "$TM_FILEPATH"
mv "$TM_TMPDIR/latex-job.pdf" "$PDFNAME" rm -rf "$TM_TMPDIR"
open "$PDFNAME"