From bf071c211651c1e81d6e8a91ddd9234ba80a4986 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Mon, 13 Jan 2014 10:47:52 +0100 Subject: [PATCH] git: update pre-commit-texcheck Change working directory if tex file is in a sub-directory. --- git/pre-commit-texcheck | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git/pre-commit-texcheck b/git/pre-commit-texcheck index 29547fe..dae2418 100755 --- a/git/pre-commit-texcheck +++ b/git/pre-commit-texcheck @@ -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 -- 2.39.5