#!/usr/bin/env bash # # Author: Lilian BESSON # Email: Lilian.BESSON[AT]ens-cachan[DOT]fr # Date: 23-08-2016 # # A small wrapper around the output of pdflatex and latex. # Can be save to ~/bin/pdflatex for example. # version='1.5' LANG='en' GREP="grep --color=always --line-buffered" COLUMNS=$(tput cols) nbcols=${COLUMNS:-194} echo -e "${reset}$u$yellow .: Starting: PDF LaTeX :.$reset" # | fmt -w ${nbcols} \ ( /usr/bin/pdflatex -shell-escape -synctex=1 -file-line-error $* 2>&1 ) \ | $GREP -vP "^\s*((\[|\]|\(|\))\s*)+$" \ | GREP_COLOR="01;35" $GREP -P "^[dD]ocument [cC]lass.*$|$" \ | GREP_COLOR="01;34" $GREP -P "^<[^>]+>|$" \ | GREP_COLOR="02;34" $GREP -P "<[^>]+>|<[^>]+>+|^[^>]*>+|[^>]+>+|<+[^>]+>*$|<<[^>]*>>|<[^>]+>|$" \ | GREP_COLOR="02;31" $GREP -P "{[^}]+}|{[^}]+}+|^[^}]*}+|[^}]+}+|{+[^}]+}*$|{[^}]+}|$" \ | GREP_COLOR="01;30" $GREP -P "^\([^\)]+\)+|^\([^\)]+$|^[^\)]+\)+|^\([^\)]+\)*|\([\)]+\)|$" \ | GREP_COLOR="01;32" $GREP -P "^.*[oO]ption:.*$|$" \ | GREP_COLOR="01;30" $GREP -P "^[a-z\.]+\.tex$|$" \ | GREP_COLOR="01;31" $GREP -P "\[[0-9]+\]|<[0-9]+>|$" \ | GREP_COLOR="4;02;33" $GREP -P "\`[^']*'|$" \ | GREP_COLOR="4;01;33" $GREP -P ".*[vV]ersion.*$|.*[gG]ometry.*$|$" \ | GREP_COLOR="01;34" $GREP -P "[oO]verfull.*$|$" \ | GREP_COLOR="01;31" $GREP -P "(^[^:]*:\d+: )|(^l\.\d+ )|(^! LaTeX Error: )|$" \ | GREP_COLOR="05;01;33" $GREP -P "((LaTeX|pdfTeX).*[wW]arning(:|)).*$|([pP]ackage [^\s]+ [wW]arning(:|)).*$|([cC]lass [^\s]+ [wW]arning(:|)).*$|$" \ | GREP_COLOR="01;33" $GREP -P ".*[wW]ritten on .*$|.*[wW]ritting [^\.]*\.[a-z]+.*$|$" \ | GREP_COLOR="01;35" $GREP -P "use .*$|$" \ | GREP_COLOR="4;36" $GREP -P "(\./)?$1(\.[a-z]+)*|(\./)?$1\.pdf|$" \ | GREP_COLOR="05;01;31" $GREP -P "line [0-9]+|$" # | fmt -w ${nbcols}