Closed torik42 closed 2 years ago
Sorry for the long latency in reacting. Commit 0d71987 now should ensure that compilable code will result from just changing the equation environment with --math-markup=FINE (3). The processing flow is rather different for math-markup 3 on one side and 1 (WHOLE) or 2 (COARSE) on the other.
Unfortunately, it does not achieve the 'ultimate solution'. In FINE mode, you will essentially see the new version of the equation but the change is only visible in the source (this is consistent with general behaviour with regard to format changes, e.g. changes in font family or series are also not visible, depending on the chosen subtype). In WHOLE or COARSE modes, the equation will be shown as deleted and added, which clues you off that something in the formatting was changed; if change is from unnumbered to numberered this will be clear, but if it's from numbered to unnumbered, both equations will be shown as unnumbered. The highlighting of the equation number as you propose is visually intuitive but I can't think of a way to achieve this with any elegance in general. In WHOLE mode it would be the easiest, in COARSE I can also see a relatively straighforward way, but in FINE mode one would have to deal with a lot of special cases.
If it's important to you then open a separate issue on marking up equation numbers (for deleted equation one would also have to manipulate equation numbers to keep the numbers consistent with the new document (which I think they should be, although I guess that's arguable), copying your ideas of how this might be tackled. But I cannot guarantee that I will find the time to address this.
Applying latexdiff to
and
with option
--math-markup=3
results in the following invalid Latex code (skipping the preamble for better readability)The same also happens for any other changes to the equation type. I don’t know whether this is a known issue and what is the intended behaviour. But I think it is quite common to change the equation type when finalizing a document (i.e. when only small changes occur), most often to remove or add numbering. Since
--math-markup=2
produces valid Latex code, when changing the equation type, one could hopefully copy that behaviour.If only the star is changed, the ultimate solution—in my opinion—would be to use
mathtool
s\usetagform
(or redefining\tagform@
if onlyamsmath
is loaded) to add the markup from\DIFadd
(if the star is removed) and\DIFdel
(if the star is added) to the equation number. I have not used perl before and don’t know the codebase. But if you think this is feasible and could be detected easily I could try to come up with the Latex part and try to implement it. In that case, please point me to where these things are handled.