# latexdiff fails on description environments

This example fails to generate a valid .tex:

### test.tex

\documentclass[a4paper]{report}
\begin{document}
\begin{description}
\item[thing] explanation of thing
\end{description}
\end{document}


### test_modified.tex

\documentclass[a4paper]{report}
\begin{document}
\begin{description}
\item[A first thing] an explanation of first thing
\end{description}
\end{document}


Executing

latexdiff test.tex test_modified.tex > test_diff.tex
pdflatex test_diff.tex


yields

! LaTeX Error: Something's wrong--perhaps a missing \item.
l.25 ...


Here is the block of interest in the generated .tex:

\begin{document}
\begin{description}
\DIFdelbegin %DIFDELCMD < \item[thing] %%%
\end{description}
\end{document}


So latexdiff has inserted code before the \item, and the compiler does not like it.

Now the manpage says latexdiff has options to exclude commands. I tried to add

--exclude-safecmd="\\\item"


in the command line invoking latexdiff, with no success.

Has anyone ever tweaked the options of latexdiff and could say how to circumvent the bug (e.g. tell latexdiff to skip this kind of environment)?

-

Ok, I spent some more time looking for a way to solve this, and the solution is to define a dummy command that does nothing:

\newcommand{\diffblock}[1]{#1}


Just put the whole description in this block:

\diffblock{
\begin{description}
\item[A first thing] an explanation of first thing
\end{description}
}


And add --append-safecmd="diffblock" in the latexdiff options.

It understands it should treat it as a whole block and does not attempt to insert its own code inside the block.

-