42

I need to highlight the difference between two rather complex math tex-files and get a lot of errors. The files are complex in the math equations, fair enough to get errors, but what if I would like latexdiff to only compare the text OUTSIDE the \begin{align} ... \end{align} environment? Can one specify to exclude/ignore certain environments?

Mensch
  • 65,388
Jakob
  • 421

1 Answers1

53

Yes there is a way to do this. latexdiff has a class of environments that it regards as pictures and which it does not check. The value is stored in PICTUREENV and its default is (?:picture|DIFnomarkup)[\w\d*@]*. Writing a config file ld.cfg containing

PICTUREENV=(?:picture|DIFnomarkup|align)[\w\d*@]*

adds the align environment to this list. If this config file is placed in the current directory you can now run

latexdiff -c ld.cfg old.tex new.tex >diff.tex

and the content of your align environments will now be ignored.

Andrew Swann
  • 95,762
  • 15
    Note that you do not need to put it in a separate config file. You could also do latexdiff --config="PICTUREENV=(?:picture|DIFnomarkup|align)[\w\d*@]*" – Rabarberski Aug 27 '13 at 09:11
  • @Rabarberski Indeed, remember double dash before config. However, the command starts getting long and one has to be careful about escaping. – Andrew Swann Aug 27 '13 at 09:16
  • --config doesn't work for me from the Bash. I get sh: 1: Syntax error: "(" unexpected Something went wrong in latexdiff. Deleting chp1/chp1-diff134.tex and abort. What can I do? – Frank Breitling Sep 07 '16 at 15:19
  • @FrankBreitling In the shell you to either escape the many special characters or use single quotes instead. It really is easier with a config file. – Andrew Swann Sep 07 '16 at 16:58
  • @AndrewSwann I tried single quotes too, with the same result. Oh, actually I was using latexdiff-svn. Seems like latexdiff-cv doesn't have this option. – Frank Breitling Sep 07 '16 at 17:25
  • 3
    As it turned out, this was a bug which got resolved by the developer ftilmann after I reported it. Now it works as of version 1.2.0. For older version use the workaround with additonal single quotes like latexdiff '--config="PICTUREENV=(?:picture|DIFnomarkup|align)[\w\d*@]*"'. – Frank Breitling Sep 08 '16 at 10:11