latexdiff with \cite commands gives output with apparently mismatched braces

This year (2020) LaTeX underwent some internal changes that introduce incompatibilities with some packages. It seems that ulem.sty is one of them, with the current version ulem 2019/11/18 pre-dating the changes in the LaTeX format.

The differences file produced by latexdiff loads ulem.sty and uses the command \sout (strike out), which leads to the error.

\RequirePackage[normalem]{ulem} %DIF PREAMBLE
...
\providecommand{\DIFdeltex}[1]{{\protect\color{red}\sout{#1}}} %DIF PREAMBLE

As a workaround, until the incomaptibility gets fixed, run latexdiff with the option -t CFONT, which avoids the use of \sout (proposed by @Ant in the comments).

Alternatively, add

\RequirePackage[2019/11/18]{latexrelease}

as the first line in the differences file. This will set back the LaTeX format to a state that is compatible.


Germot already provided a good answer. However, it was not entirely satisfactory. The -t CFONT option changes the formatting (it only uses colour, removing strike-out and underlining). And while setting the latexrelease version to 2019/11/18 worked fine with OP's MWE, it failed in a more complex document.

So I sought to get rid of the real culprit, the \hspace{0pt}.

Since v1.0.1, latexdiff encloses citation (and a few other things such as siunitx commands) in \mbox commands in order to circumvent incompatibilities with ulem styling (the \sout and \uwave used by default). However, this implies that line breaks no longer work within citations. This was fixed in v1.2.1 by adding the \hspace{0pt} after the \mbox. The changelog states that “change should not cause adverse behaviour otherwise”. Well, now it does!

My temporary fix was to edit the latexdiff source (texmf-dist/scripts/latexdiff/latexdiff.pl), and replace the \hspace{0pt} with a \hskip0pt. The resulting PDF is identical to the one obtained with older versions.


tl; dr:

Find latexdiff.pl in your texlive installation directory¹, and replace line 2734²:

push(@$retval,"\\mbox{$AUXCMD\n\\" . $1 . $2 . $3 ."}\\hspace{0pt}$AUXCMD\n" );

by

push(@$retval,"\\mbox{$AUXCMD\n\\" . $1 . $2 . $3 ."}\\hskip0pt$AUXCMD\n" );

¹ E.g. /usr/share/texmf-dist/scripts/latexdiff/latexdiff.pl.
² Assuming you have latexdiff v1.3.1.1.