ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
513 stars 72 forks source link

when changing \begin{math}-->\begin{equation}: no differences are displayed in pdf #244

Closed ouboub closed 2 years ago

ouboub commented 2 years ago

Hi Old file

\documentclass[12pt]{article}
\begin{document}
\begin{math}
  \int f dx =0
\end{math}
\end{document}

New file:

\begin{document}
\begin{equation}
  \int f dx =0
\end{equation}
\end{document}

using latexdiff-1.3.0

with

/usr/local/bin/latexdiff-vc --so --math-markup=3  --driver=pdftex

changing math-markup from 3 to 2, to, 1, to 0.

then the corresponding diff files give me a pdf without any visible differences. What is the problem? replace-equation-diff0.pdf

ftilmann commented 2 years ago

Sorry for the long latency in reacting. Actually when I tested it, I got error messages on compiling the DIFF file with --math-markup equal to 1 (WHOLE) or 2 (COARSE), as latexdiff did not know about the math environment. This is now fixed by 0d71987 and compilable code results from all math markup modes. The way it's displayed is not quite perfect, though. In FINE (3) mode, the change remains invisible. This is more or less a feature. Format changes are generally not highlighted, and rather the formatting of the new text is adopted (also e.g. changes to type for text). However, this change is marked in the source file, of course.

In WHOLE or COARSE math markup modes, the equation is shown as deleted (without equation number) and added (with equation number). It's not quite good, as also the deleted equation is shown in display math format rather than as inline text format. This would not be difficult to fix, in principle, but would add yet another special case, so in striking a balance with regard to code maintainability I opted to live with this slight imperfection. Correct markup in inline text format will result from use of either $..$ or \(...\) instead of math environment (and the change will then show up for all choices of --math-markup option except NONE. If you feel strongly that correct (i.e. inline) math formatting is important for deleted math environment, please open a new issue.

PS I hope you do not mind that I used your MWE in constructing an example for a test in testsuite