Closed sim590 closed 5 years ago
Same thing happens with newcommand
also.
After making some more tests, I have discovered that it's because it doesn't like that I name my command \cap
which is already defined. I think that there is still an issue here. At least, I can go around it, but this is a bug.
EDIT: it is about redefining math commands. For example: \cup
,\cap
,\exists
, etc.
latexdiff only promises to properly process LaTeX, not TeX. Also, it expects all command arguments to be be surround by braces, even if this is not required by latex itself, e.g.
\newcommand{\mycommand}{This is my command}
should process correctly (except that -- as you noticed -- the fact that \cap
normally has a different definition might cause problems later down the line). However
\newcommand\mycommand{This is my command}
will not work (I am not sure if it would be acceptable in latex, I have never used this form).
These limitations are clearly stated in the manual. I will therefore close the issue for now, if you still have problems with the first form, feel free to reopen.
As a workaround, you can surround the offending part of the text with special environment \DIFnomarkup, i.e.
\centering
\begin{DIFnomarkup}
\def\cap{titi}
\end{DIFnomarkup}
\caption{ . Name}
and define in your preamble the environment DIFnomarkup to do absolutely nothing at all.
\newenvironment{\DIFnomarkup}{}{}
(I did not test this, if this workaround does not work as expected, feel free to start a new issue, or reopen this one).
As to your new title - yes, redefining any standard commands with a totally different meaning has great potential to confuse latexdiff. Dealing with this in a universal way would require including the full internal processing of TeX into consideration, so basically this will never be fixed, as way too complicated.
When using a
\def
instruction,latexdiff
inserts macros between\def
and its argument.First file:
Second file:
The diff file:
The output of (
pdflatex
):