--- /dev/null
+#!/bin/bash
+
+COLOR_ERROR='01;31'
+COLOR_WARNING='01;33'
+COLOR_OUTPUT='01;32'
+
+PCRE_ERROR='(^[^:]*:\d+: )|(^l\.\d+ )|(^! LaTeX Error: )'
+PCRE_WARNING='(LaTeX Warning(:|))|(Package [^\s]+ Warning(:|))'
+PCRE_OUTPUT='^Output written on .*\.pdf \(.*\)\.$'
+
+if [ -t 1 ]; then
+ ($* -file-line-error 2>&1) | perl -pe "s/${PCRE_ERROR}/\033[${COLOR_ERROR}m\$&\033[0m/gs;s/${PCRE_WARNING}/\033[${COLOR_WARNING}m\$&\033[0m/gs;s/${PCRE_OUTPUT}/\033[${COLOR_OUTPUT}m\$&\033[0m/gs"
+else
+ $*
+fi
+$ENV{PATH} = "bin:$ENV{PATH}";
$pdf_mode = "1";
-$pdflatex = "pdflatex -interaction=nonstopmode -halt-on-error -file-line-error -synctex=1";
+$pdflatex = "latex-colorize pdflatex -interaction=nonstopmode -halt-on-error -file-line-error -synctex=1";
$clean_ext = "bbl synctex.gz synctex.gz(busy)";