improved latexthat.sh