0

Note: I asked this question on Stackoverflow a month ago, but I'm deleting it and re-posting it here because I got no answers there.


I recently discovered latexdiff, and it has generally been a satisfaction. However, I have been encountering problems using it with the IEEEeqnarray environment from the IEEEtrantools package (which I use a lot). Here is a minimal example of this problem.

File a.tex:

\documentclass{article}

\usepackage{IEEEtrantools}

\begin{document}

\begin{IEEEeqnarray*}{rCl}
a^2 &=& b
\end{IEEEeqnarray*}

Some text.

More text.

Even more text.

\end{document}

File b.tex:

\documentclass{article}

\usepackage{IEEEtrantools}

\begin{document}

Some text.

More text.

Even more text.

\begin{IEEEeqnarray*}{rCl}
a^2 &=& b
\end{IEEEeqnarray*}

\end{document}

Output of latexdiff a.tex b.tex (I'll spare you the preamble):

\begin{document}

\DIFdelbegin %DIFDELCMD < \begin{IEEEeqnarray*}{rCl}
%DIFDELCMD < %%%
\DIFdel{a^2 }%DIFDELCMD < &%%%
\DIFdel{=}%DIFDELCMD < & %%%
\DIFdel{b
}%DIFDELCMD < \end{IEEEeqnarray*}
%DIFDELCMD < 

%DIFDELCMD < %%%
\DIFdelend Some text.

More text.

Even more text.
\DIFaddbegin 

\begin{IEEEeqnarray*}{rCl}
\DIFadd{a^2 }&\DIFadd{=}& \DIFadd{b
}\end{IEEEeqnarray*}
\DIFaddend 

\end{document}

So it seems that latexdiff is not recognizing that IEEEeqnarray is a math environment since it is removing it, giving compilation errors such as:

! Missing $ inserted.
<inserted text> 
                $
l.31 \DIFdel{a^2 }
                  %DIFDELCMD < &%%%

Is there a way to tell it that IEEEeqnarray is a math environment? If not, what solutions would you suggest?

Thanks!


Update: I tried to modify the latexdiff script itself by adding IEEEeqnarray to the list of eqnarray-like environments. This makes latexdiff treat it correctly as a math environment, but it raises another issue: IEEEeqnarray takes the mandatory alignment argument (rCl in the examples above), but latexdiff does not recognize that, leading to output of the form:

\DIFaddbegin 
\begin{IEEEeqnarray*}{\DIFadd{rCl}}
\DIFadd{a^2 }&\DIFadd{=}& \DIFadd{b
}\end{IEEEeqnarray*}
\DIFaddend 

As you can see, the argument to IEEEeqnarray gets changed to \DIFadd{rCl} which leads to compilation errors:

! Class IEEEtran Error: Invalid character in column specifications.

See the IEEEtran class documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.43 \begin{IEEEeqnarray*}{\DIFadd{rCl}}

Any ideas? I'm not really familiar with perl to comfortably tweak the script much more than that.

  • I don't think there is an easy solution, as latexdiff does not expect maths environments to have arguments. I will look into this on the latexdiff side (I am the author). If you are always using {rCl} as your argument, then you can probably make a work around by defining using \newenvironment to define IEEEeqnarrayrCl and declaring this to latexdiff as an array envirnment using the --config option: --config MATHARRENV=(?:eqnarray|align|alignat|gather|multline|flalign|IEEEeqnarrayrCl)[*]? ). But this possibly implies having to rewrite history and won't work if you like to use different args – frederik Mar 9 '15 at 9:30
  • Feel free to add this as an issue on github.com/ftilmann/latexdiff – frederik Mar 9 '15 at 9:34
  • @frederik I generally use more than just {rCl}, but I guess I could do something of the sort for my most-commonly-used args. I will add this as an issue. Thanks for your answer! – jadhachem Mar 9 '15 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.