From: Vivien Maisonneuve Date: Tue, 11 Feb 2014 09:45:45 +0000 (+0100) Subject: Colorization script X-Git-Url: https://scm.cri.mines-paristech.fr/git/pipstransfo.git/commitdiff_plain/d590e817155c77bbfb0c2c1fb2fdf1beb1e945ae Colorization script --- diff --git a/bin/latex-colorize b/bin/latex-colorize new file mode 100755 index 0000000..5a46c16 --- /dev/null +++ b/bin/latex-colorize @@ -0,0 +1,15 @@ +#!/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 diff --git a/latexmkrc b/latexmkrc index a973307..5a277e8 100644 --- a/latexmkrc +++ b/latexmkrc @@ -1,3 +1,4 @@ +$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)";