How to color strings in LaTeX that match regular expressions

I am currently using the LaTeX list package to display a block of code and a diff file compared to the previous version.

Both blocks are colored by lists, as if they were code (what they are), but I would like to color diff in the same way as emacs diff-mode - red for lines matching ^-, green for ^\+etc.

Does anyone know if there is a package to achieve this, can listings do this, or is it possible to write a LaTeX command for this? (more precisely - where can I find a good source of information on the latter?)

Thanks,

Hood

+3
source share
2 answers

, Pygments , texments ( ) , .

, , , . , , udiffs , , .

, , , . , , .

, , , udiff. ; , diff, , , , GenericTokens; , .

+2

, sed, awk, Python [lang choice], Latex.

0

Source: https://habr.com/ru/post/1727315/


All Articles