git: update pre-commit-texcheck
authorStefan Huber <shuber@sthu.org>
Mon, 13 Jan 2014 09:47:52 +0000 (10:47 +0100)
committerStefan Huber <shuber@sthu.org>
Mon, 13 Jan 2014 09:47:52 +0000 (10:47 +0100)
Change working directory if tex file is in a sub-directory.

git/pre-commit-texcheck

index 29547feaf9464894aac500d0e39a7a425162218f..dae2418a129913c5bee48a49fa847894814bd6d7 100755 (executable)
@@ -14,11 +14,16 @@ for f in $(find -name "*.tex"); do
     # Only main tex files are interesting
     grep -q "\documentclass" "$f" || continue
 
-    if ! pdflatex -output-directory "$tmpdir" $f < /dev/null > /dev/null; then
+    pushd .
+    cd $(dirname $f)
+
+    if ! pdflatex -output-directory "$tmpdir" $(basename $f) < /dev/null > /dev/null; then
+        popd
         echo >&2 "pdflatex failed on '$f'."
         cleanup
         exit 1
     fi
+    popd
 done
 
 cleanup