#!/usr/bin/env bash for i in "$@"; do i="${i//.pdf/.tex}"; ( pdflatex "$i" && pdflatex "$i" && /bin/mv -i -f "${i%tex}log" "${i%tex}aux" "${i%tex}synctex.gz" "${i%tex}out" /tmp/ 2> /dev/null ) || ( clear; chktex "$i"; notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')" ); /bin/mv -i -f "${i%tex}snm" "${i%tex}nav" /tmp/ 2> /dev/null; PDFCompress "${i%tex}pdf"; done