Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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] %%%
\DIFdel{explanation of }\DIFdelend \DIFaddbegin \item[A first thing] \DIFadd{an explanation of first }\DIFaddend 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)?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.