Skip to content

Instantly share code, notes, and snippets.

@kersny
Created February 27, 2012 18:45
Show Gist options
  • Save kersny/1926118 to your computer and use it in GitHub Desktop.
Save kersny/1926118 to your computer and use it in GitHub Desktop.
reload pdf in Skim on compile
#!/bin/bash
# the first argument should be the tex file, either with or without extension
file="$1"
# run pdflatex and bibtex, and open or reload the pdf in Skim
#pdflatex "${file}" && bibtex "${file}" && pdflatex "${file}" && pdflatex "${file}" && \
/usr/bin/osascript \
-e "set theFile to POSIX file \"${file}\" as alias" \
-e "set thePath to POSIX path of theFile" \
-e "tell application \"Skim\"" \
-e " activate" \
-e " set theDocs to get documents whose path is thePath" \
-e " try" \
-e " if (count of theDocs) > 0 then revert theDocs" \
-e " end try" \
-e " open theFile" \
-e "end tell" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment