Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align environment changed to eqnarray #149

Closed
vtraag opened this issue Apr 26, 2018 · 2 comments
Closed

align environment changed to eqnarray #149

vtraag opened this issue Apr 26, 2018 · 2 comments

Comments

@vtraag
Copy link

vtraag commented Apr 26, 2018

When the amsmath package gets loaded through a documentclass (or another package possibly?), changes in align environments are changed to eqnarray environments when diffed.

old.tex:

\documentclass[amsmath]{revtex4-1}
\begin{document}
\begin{align}
  a &= b & x &= y	
\end{align}
\end{document}

new.tex:

\documentclass[amsmath]{revtex4-1}
\begin{document}
\begin{equation}
  x \sim y
\end{equation}
\end{document}

Generated diff of the align environment:

\DIFdelbegin \begin{eqnarray*}
  \DIFdel{a }&\DIFdel{= b }& \DIFdel{x }&\DIFdel{= y	
}\end{eqnarray*}

In this case, it is only a minor problem, and compiling diff.tex only produces
LaTeX Error: Too many columns in eqnarray environment.

In the actual context of a full article, the reported errors become more severe, and more difficult to track down.

Workaround

A workaround is easy: load the amsmath explicitly in new.tex. I just wanted to document this here, since it took me quite some time to come up with this workaround.

Perhaps this can be solved in latexdiff in some way, but I can imagine it would be rather difficult to detect whether amsmath may have been loaded through some third package or documentclass. Nonetheless, the error of a missing align environment may be somewhat easier to recognize and correct for if necessary.

@ftilmann
Copy link
Owner

Another workaround: You can explicitly hint to latexdiff that amsmath package is loaded by using option --packages=amsmath. However, this overrides automatic detection completely (probably a behaviour that ought to be changed).

@ftilmann
Copy link
Owner

Having said this, I just committed a modification to the automatic package scanning subroutine that now also treats options to \documentclass as potential package names, so the code you provided should now work without the workaround (commit 3e56ad7 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants