I added this line to my document to redefine l@chapter later:
\let\oldlchapter\l@chapter
Now latexdiff creates this, which doesn't compile:
\let\oldlchapter\DIFadd{\l@chapter
}
What can I do to fix this?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI added this line to my document to redefine l@chapter later:
\let\oldlchapter\l@chapter
Now latexdiff creates this, which doesn't compile:
\let\oldlchapter\DIFadd{\l@chapter
}
What can I do to fix this?
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.')*';
\let-statement and one without it, that result in this erroneous code. Apart from that, it is to be expected thatlatexdiff(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.