I added this line to my document to redefine l@chapter later:


Now latexdiff creates this, which doesn't compile:


What can I do to fix this?

  • 2
    For people to be able to analyze the problem, you should provide two simple documents, one with the \let-statement and one without it, that result in this erroneous code. Apart from that, it is to be expected that latexdiff (and any other program with this functionality) fails at some point; marking differences in macro definitions in a way that does not break the code is probably beyond that point.
    – gernot
    Commented Jan 2, 2017 at 9:08

1 Answer 1


First of all, latexdiff is designed to work with LaTeX document syntax, not raw TeX commands such as \let. In this case, a small change to latexdiff leads to the correct behaviour (see below - this has been implemented in the development version of latexdiff on GitHub and will be contained in versions 1.2.1 up (not yet released as of January 3, 2017).

More generally, use environment \DIFnomarkup (which you need to define to do nothing) to protect TeX commands from processing by latexdiff. see latexdiff manual or man pages for a more detailed explanation.

Required change to latexdiff:

Find the line:

  my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat_n . '\}|\(' . $coords .'\))'.$extraspace.')*';

and add one @ character such that it reads:

  my $cmdoptseq='\\\\[\w\d@\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat_n . '\}|\(' . $coords .'\))'.$extraspace.')*';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .