latexdiff icon indicating copy to clipboard operation
latexdiff copied to clipboard

--math-markup=0 does not understand subequations

Open bersbersbers opened this issue 8 years ago • 1 comments

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:

  • Extra white space is introduced after equation; this is a possible duplicate of Issue 79; can be reproduced using this MWE:
  • In addition, math is still highlighted
\documentclass[twocolumn]{article}
\usepackage{amsmath,color}
\providecommand{\DIFaddbegin}{\protect\color{blue}} %DIF PREAMBLE
\begin{document}
\begin{subequations}\DIFaddbegin\begin{align}
		Y
\end{align}\end{subequations}

Hence

\end{document}

Hypothesis:

  • I think subequations would need to be added to one of the lists of math environments.

bersbersbers avatar Feb 02 '17 15:02 bersbersbers

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?

Fifis avatar Jun 16 '24 13:06 Fifis