How can I create a command that creates the PDF file from Latex without creating any other files (logs etc.). Preferrably this command would also let me choose where to save the output document with the standard saving dialog window.
Johan Blixt-Dackhammar wrote:
How can I create a command that creates the PDF file from Latex without creating any other files (logs etc.). Preferrably this command would also let me choose where to save the output document with the standard saving dialog window.
The way I would do it is to create a temp folder in `/tmp` by using `mktemp -d`. Then save your file there, process it, move the pdf wherever you want, and remove the directory when processing is done.
For the dialog, you can use the applescript's "choose file name".
-Jacob
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.
On 5/19/06, Jacob Rus jrus@fas.harvard.edu wrote:
Johan Blixt-Dackhammar wrote:
How can I create a command that creates the PDF file from Latex without creating any other files (logs etc.). Preferrably this command would also let me choose where to save the output document with the standard saving dialog window.
The way I would do it is to create a temp folder in `/tmp` by using `mktemp -d`. Then save your file there, process it, move the pdf wherever you want, and remove the directory when processing is done.
For the dialog, you can use the applescript's "choose file name".
-Jacob
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
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"