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

Latexdiff fails to handle \begin{rcases}...\end{rcases} #250

Open jdpipe opened 2 years ago

jdpipe commented 2 years ago

I'm using:

  (c) 2004-2018 F J Tilmann

I have the following diff code generated by Latexdiff:

\item Outflow conditions for velocity\DIFdelbegin \DIFdel{and temperatureon the open boundary, }\begin{displaymath} \DIFdel{\begin{rcases} \frac{\partial u}{\partial x}=\frac{\partial v}{\partial y}=\frac{\partial T}{\partial x}=\frac{\partial T}{\partial y}=0 }\ \DIFdel{\mathrm{at} \; y=0, \ x=\mathrm{L},\ \mathrm{and}\ y=\mathrm{H} \end{rcases}
}\end{displaymath}%DIFAUXCMD \DIFdelend \DIFaddbegin \DIFadd{, temperature, turbulent kinetic energy and turbulent dissipation energy, }\begin{multline} \DIFadd{\frac{\partial u}{\partial x}=\frac{\partial v}{\partial y}=\frac{\partial T}{\partial x}=\frac{\partial T}{\partial y} =}\\DIFadd{\frac{\partial k}{\partial x}=\frac{\partial k}{\partial y}=\frac{\partial \omega}{\partial x}=\frac{\partial \omega}{\partial y}=0 \quad \forall \; \mathbf{x} \in B_\mathrm{o} }\end{multline}\DIFaddend

This code seems to be incorrect, and causes problems with pdflatex.

As far as I can tell, the problem is that the \begin{rcases} and \end{rcases} code should be outside the \DIFdel{...} blocks, as follows:

\item Outflow conditions for velocity\DIFdelbegin \DIFdel{and temperatureon the open boundary, }\begin{displaymath}\begin{rcases} \DIFdel{ \frac{\partial u}{\partial x}=\frac{\partial v}{\partial y}=\frac{\partial T}{\partial x}=\frac{\partial T}{\partial y}=0 }\ \DIFdel{\mathrm{at} \; y=0, \ x=\mathrm{L},\ \mathrm{and}\ y=\mathrm{H} }\end{rcases} \end{displaymath}%DIFAUXCMD \DIFdelend \DIFaddbegin \DIFadd{, temperature, turbulent kinetic energy and turbulent dissipation energy, }\begin{multline} \DIFadd{\frac{\partial u}{\partial x}=\frac{\partial v}{\partial y}=\frac{\partial T}{\partial x}=\frac{\partial T}{\partial y} =}\\DIFadd{\frac{\partial k}{\partial x}=\frac{\partial k}{\partial y}=\frac{\partial \omega}{\partial x}=\frac{\partial \omega}{\partial y}=0 \quad \forall \; \mathbf{x} \in B_\mathrm{o} }\end{multline}\DIFaddend

If I apply this change by hand, the diff.tex code compiles fine. Perhaps the rcases syntax needs to be added somewhere in the Latexdiff algorithm.

ftilmann commented 2 years ago

Thanks for the report. The description is clear enough, but for developer convenience would you mind providing the MWE for this example with old and new file (including preamble) in order to facilitate easy testing of any fix.
Also, thanks for providing the version, but next time also post the line above the one you posted, which gives the actual version number; the copyright string does not uniquely map to a version. I should warn that my rate of dealing with issues has become pretty slow due to other commitments, so necessarily expect any quick fix. You can play around with the --math-markup option as work arounds (though I acknowledge that this is not really satisfactory,