Skip to content

Instantly share code, notes, and snippets.

@lukekrikorian
Created November 10, 2020 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukekrikorian/4efcb61c2a755be492ce63339bcfada8 to your computer and use it in GitHub Desktop.
Save lukekrikorian/4efcb61c2a755be492ce63339bcfada8 to your computer and use it in GitHub Desktop.
PATH="$PATH:/usr/texbin:/Library/TeX/texbin:/Library/TeX/Distributions/Programs/texbin"
name=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*/\1/'`
# latexcalc
if [[ $name == *"Test"* || $name == *"Lesson"* ]]; then
latexcalc -o "temp.tex" "$CR_FILENAME"
else
cp "$CR_FILENAME" "temp.tex"
echo "Doesn't appear to be have math"
fi
# biber
if grep -q biblatex "$CR_FILENAME"; then
latex -halt-on-error "temp.tex" > /dev/null
biber "temp" > /dev/null
else
echo "Doesn't appear to be have a bibliography"
fi
output=$(pdflatex -halt-on-error "temp.tex")
status=$?
if [[ $status -eq 0 ]]; then
mv "temp.pdf" "$name.pdf"
rm temp.* 2> /dev/null
echo "$PWD/$name.pdf"
else
>& 2 echo "$output"
fi
exit $status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment