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

eqnarray environment changed into align* #216

Closed smihael closed 2 years ago

smihael commented 3 years ago

Changes in eqnarray environments are changed to align* environments when diffed.

old.tex:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Some text:
\begin{eqnarray}
a &=& 1 + 2, \label{eq:a}\\
b &=& 3 + 4, \label{eq:b}
\end{eqnarray}
Some additional text:
\begin{eqnarray}
c &=& 1 + 2, \label{eq:c}\\
d &=& 3 + 4, \label{eq:d}
\end{eqnarray}
\end{document}

new.tex:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\end{document}

Generated diff of the eqnarray environment:

 \DIFdelbegin \DIFdel{Some text:
}\begin{align*}
\DIFdel{a }&\DIFdel{=}& \DIFdel{1 + 2, \label{eq:a}}\\
\DIFdel{b }&\DIFdel{=}& \DIFdel{3 + 4, %DIFDELCMD < \label{eq:b}%%%
}\end{align*}%DIFAUXCMD
\DIFdel{Some additional text:
}\begin{align*}
\DIFdel{c }&\DIFdel{=}& \DIFdel{1 + 2, \label{eq:c}}\\
\DIFdel{d }&\DIFdel{=}& \DIFdel{3 + 4, %DIFDELCMD < \label{eq:d}%%%
}\end{align*}%DIFAUXCMD
%DIFDELCMD <  %%%
\DIFdelend

The generated code won't compile with error "Package amsmath Error: Multiple \label's: label 'eq:a' will be lost. }\end{align}" My current workaround is to manually replace all occurrences of align back to eqnarray.

I'm using LATEXDIFF 1.3.0 (Algorithm::Diff 1.15 fast, Perl v5.30.0) shipped with KDE neon (Ubuntu 18.04 derivative).

quentin-ag commented 3 years ago

I face the same bug with the gather environment (instead of eqnarray), and the version 1.3.1.1 of latexdiff.

ftilmann commented 2 years ago

This issue has been fixed with commit 12ddc9e660fca68b8ab45fc4a074f66d81576be1 and will be available in versions 1.3.3 and higher