Skip to content

Instantly share code, notes, and snippets.

@Romern
Last active May 6, 2018 12:39
Show Gist options
  • Save Romern/05d95cfd723d903b82415d2ad4d39d8e to your computer and use it in GitHub Desktop.
Save Romern/05d95cfd723d903b82415d2ad4d39d8e to your computer and use it in GitHub Desktop.
LaTeX Error Search: Finds typod commands in your tex file using the \show command
FILE=$1
if [ -z $1 ]; then
echo "ERROR: First input parameter must be the file!"
exit
fi
COMMANDS="$(grep -E -o '\\[a-zA-Z]+' $1 | sed 's/\\/\\show\\/g')"
HEADER="$(sed '/\\begin{document}/q' $1)"
echo $HEADER >> temp.tex
echo $COMMANDS >> temp.tex
echo '\end{document}' >> temp.tex
latexmk -interaction=nonstopmode temp.tex &> /dev/null
grep '=undefined' temp.log
rm temp.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment