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
517 stars 73 forks source link

--math-markup=0 does not understand subequations #83

Open bersbersbers opened 7 years ago

bersbersbers commented 7 years ago

a.tex:

\documentclass[twocolumn]{article}
\usepackage{amsmath,color}

\begin{document}
\begin{subequations}
    \begin{align}
        X
    \end{align}
\end{subequations}

Hence

\end{document}

b.tex:

\documentclass[twocolumn]{article}
\usepackage{amsmath,color}

\begin{document}
\begin{subequations}
    \begin{align}
        Y
    \end{align}
\end{subequations}

Hence

\end{document}

Command: latexdiff -s COLOR --math-markup=0 a.tex b.tex > diff.tex

Result:

\begin{subequations}
    \DIFdelbegin %DIFDELCMD < \begin{align}
%DIFDELCMD <        X
%DIFDELCMD <    \end{align}
%DIFDELCMD < %%%
\DIFdelend \DIFaddbegin \begin{align}
        Y
    \end{align}
\DIFaddend \end{subequations}

Observations:

Hence

\end{document}



Hypothesis:
- I think subequations would need to be added to one of the lists of math environments.
Fifis commented 3 months ago

The same happened for me. The option --math-markup=1 did not help – only 0. Using MATHENV did not improve the situation. The intended solution with MATHENV and MATHARRENV did not work: using MATHARRENV=(?:eqnarray|align|alignat|gather|multline|empheq)[*]?, MATHENV=(?:equation|displaymath|DOLLARDOLLAR|subequations)[*]?", or both won’t help.

Consider this example.

Syntax:

latexdiff --config="MATHARRENV=(?:eqnarray|align|alignat|gather|multline|empheq|subequations)" --math-markup=1 file1.tex file2.tex >> diff.tex

File 1:

Indeed, it is shown in Appendix~\ref{proofs-sec-bounds+estimation-under-MAR} that
\begin{subequations}\label{J-rho}
\begin{empheq}[left={\eqref{HP-system} \implies \empheqlbrace}]{align}
\partial_{\thetastar} \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} J  \label{Jtheta-rho} \\
\partial_\pi \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} 0 \label{Jpi-rho} \\
\partial_\mu \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} 0 \label{Jmu-rho}.
\end{empheq}
\end{subequations}

File 2:

Indeed, as shown in \eqref{J-rho} in the supplement, the Jacobian
$\partial_{\thetastar} \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} J$,
whereas $\partial_\pi \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} 0$
and $\partial_\mu \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} 0 \label{Jmu-rho}$.

latexdiff output:

The result that $\rho$ is free from the influence of estimating $\pi$
suggests that \eqref{cmr-rho-1s} can also deliver an efficient estimator of $\thetastar$.
Indeed, \DIFdelbegin \DIFdel{it is shown in Appendix~\ref{proofs-sec-bounds+estimation-under-MAR} that
}\begin{subequations*}\DIFdel{\label{J-rho}
\begin{empheq}{align}
\partial_{\thetastar} \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} J  \label{Jtheta-rho} \\
\partial_\pi \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} 0 \label{Jpi-rho} \\
\partial_\mu \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}&{=} 0 %DIFDELCMD < \label{Jmu-rho}%%%
.
\end{empheq}
}\end{subequations*}%DIFAUXCMD
\DIFdelend \DIFaddbegin \DIFadd{as shown in \eqref{J-rho} in the supplement, the Jacobian
$\partial_{\thetastar} \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} J$,
whereas $\partial_\pi \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} 0$
and $\partial_\mu \E[\rho(\calA,\thetastar,\pi,\mu) \mid X] \overset{\text{$P_X$-a.s.}}{=} 0 \label{Jmu-rho}$.
}\DIFaddend 

Here, the equation was changed from display subequations with nested empheq to inline with $. The document won’t compile because it creates this non-existent starrd subequations*:

! LaTeX Error: Environment subequations* undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.845 }\begin{subequations*}
                            \DIFdel{\label{J-rho}
?

Is there a way to remedy this predicament without pre-processing?