latexdiff
latexdiff copied to clipboard
CTRADITIONAL fails with changes in formulas (without --math-markup=off)
I really like CTRADITIONAL, and I know I can use it with --math-markup=off. But it would be awesome, if I could use it also for all formulas. Here is a minimal example:
% tmp1.tex
\documentclass{article}
\begin{document}
\[ x = a_1 \]
\end{document}
% tmp2.tex
\documentclass{article}
\begin{document}
\[ x = b_2 \]
\end{document}
When I run pdflatex on the diff I get
! Missing $ inserted.
<inserted text>
$
l.46 \[ x = \DIFdelbegin \DIFdel{b_3 }
\DIFdelend \DIFaddbegin \DIFadd{a_1 }\...
Unfortunately, I believe footnotes in display equations simply don't work, so this cannot easily be achieved. So I don't really see a way to address this, sorry
What about using \footnotemark and \footnotetext? Or would this require too many changes (I have no clue about the internals of latexdiff)?
Yes, this would probably be possible, but not easy to implement - one would have to keep a running tally of deleted parts in maths environments, and then add the \footnotetext later, and also keep track of the correct numbering. Timewise, I probably won't be able to tackle this. Always happy to accept appropriate pull requests, though
I ran into this problem now. The solution is to protect the text within the \DIFdel when inside a math environment. So, in the previous example you should do a \DIFdel{$b_3 $} instead of simply passing the parameter. However, I'm not sure if you know when you are inside of a math environment to do something like this.