Skip to content

Instantly share code, notes, and snippets.

@llaine
Last active August 29, 2015 14:01
Show Gist options
  • Save llaine/bb58650bef829c055f86 to your computer and use it in GitHub Desktop.
Save llaine/bb58650bef829c055f86 to your computer and use it in GitHub Desktop.
LaTeX custom compilator with pdflatex
#!/usr/bin/env sh
# Sick of compiling with hand, this little script might help you
compilator() {
ARGUMENT="$1"
#determine aux name by stripping .tex suffix and adding .aux
AUXNAME="${ARGUMENT%.tex}.aux"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep -i ".*:[0-9]*:.*\|warning"
bibtex -terse "$AUXNAME"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep -i ".*:[0-9]*:.*\|warning"
}
# Will compile all the LaTeX which are inside the url var
url="root/directory/of/all/latex/files"
echo "currently compiling from $url"
cursor=0
find $url -name '*.tex' | while read f ; do
#echo "$f"
path=$(dirname "$f")
echo "$(tput setaf 2)--> $path$(tput sgr0)/$(tput setaf 7)$(basename "$f") $(tput sgr0)"
cd "$path"
echo "$(tput setaf 4)"
compilator $f
echo "$(tput sgr0)"
((cursor++))
done
echo "$(tput setaf 1)[i] : $cursor .tex compiled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment