@ -55,7 +55,7 @@ If "--" is used for NEW, then diff against the working directory.
Options:
Options:
--help this help message
--help this help message
--main <file.tex> name of the main LaTeX file
--main <file.tex> name of the main LaTeX file (must be in current directory!)
--no-view don't display the resulting PDF file
--no-view don't display the resulting PDF file
--bibtex, -b run bibtex as well as latex
--bibtex, -b run bibtex as well as latex
(pdflatex,bibtex,pdflatex,pdflatex)
(pdflatex,bibtex,pdflatex,pdflatex)
@ -363,6 +363,7 @@ log_cmd () {
fi
fi
}
}
# main is relative to initial_dir (if returned)
if test -z "$main" ; then
if test -z "$main" ; then
printf "%s" "No --main provided, trying to guess ... "
printf "%s" "No --main provided, trying to guess ... "
main=$(git grep -l '^[ \t]*\\documentclass')
main=$(git grep -l '^[ \t]*\\documentclass')
@ -398,7 +399,10 @@ git_dir="$(git rev-parse --git-dir)" || die "Not a git repository?"
cd "$(git rev-parse --show-cdup)" || die "Can't cd back to repository root"
cd "$(git rev-parse --show-cdup)" || die "Can't cd back to repository root"
git_dir=$(cd "$git_dir"; pwd)
git_dir=$(cd "$git_dir"; pwd)
main=$git_prefix/$main
# make main relative to git root directory
if test -n "$git_prefix" ; then
main=$git_prefix$main
fi
mainbase=$(basename "$main" .tex)
mainbase=$(basename "$main" .tex)
maindir=$(dirname "$main")
maindir=$(dirname "$main")