I was wondering if it is possible to have latexdiff ignore all lstlistings from my documents when finding diffs. Most of my listings contain special characters. That works rather nicely within an lstlisting but when latexdiff tries to compare, such listings end up outside of the lstlisting and therefore need to be escaped manually. Is there a way to go around that?
[Tex/LaTex] latexdiff and lstlisting
latexdifflistings
Best Answer
You can use the approach given in https://tex.stackexchange.com/a/73649/15925 to tell
latexdiff
to ignore thelstlisting
environment. Placingin
ld.cfg
and runninglatexdiff -c ld.cfg j1.tex j2.tex >diff.tex
wherej1.tex
isand
j2.tex
isproduces
diff.tex
containing:and compiling to give:
As you can see changes in the text are highlighted, whereas the code is just that from the second file.
EDIT As asmeurer points out, you can avoid a config file by writing the command line
and this may be particularly relevant in a script or a makefile.