latexdiff icon indicating copy to clipboard operation
latexdiff copied to clipboard

CTRADITIONAL fails with changes in formulas (without --math-markup=off)

Open jbrea opened this issue 5 years ago • 4 comments
trafficstars

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 }\...

jbrea avatar Nov 28 '19 17:11 jbrea

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

ftilmann avatar Nov 29 '19 16:11 ftilmann

What about using \footnotemark and \footnotetext? Or would this require too many changes (I have no clue about the internals of latexdiff)?

jbrea avatar Nov 29 '19 17:11 jbrea

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

ftilmann avatar Nov 30 '19 20:11 ftilmann

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.

adinriv avatar Feb 28 '20 18:02 adinriv