Track changes in figures

changeslatexdiff

I'm using latexdiff to track changes between two version of a manuscript, which is working fine. I also need to track changes in figures that I include through includegraphics.

In other words, for

\documentclass{article}
\begin{document}
Hello world!
\includegraphics{somefig}
\end{document}  

and

\documentclass{article}
\begin{document}
Hello brave new world!
\includegraphics{somefig-v2}
\end{document}

I would like the output of latexdiff – or of some alternative – to not just highlight the added "brave new", but also to indicate in some way, e.g., through change bars in the margin, that the figure has changed.

The manual of changes (version 4.2.1 of July 15, 2021) states in Section 6.1 that figures cannot be marked.

Can I get latexdiff to do what I want? If not, are there any other packages or tools that can do what I'm looking for?

Best Answer

This should work out of the box. Check out the option --graphics-markup of latexdiff. By default, the example above should show the figure with a blue frame around. Note that latexdiff only looks at the command and does not consider the content of the graphics file. So in your example it would work as "somefig-v2" is different from "somefig" but it would not notice if somefig itself is changed (e.g. when comparing files in different directories). Also, if options to includegraphics are being used, a change in the options will make the figure appear to be changed to latexdiff.

With --graphics-markup=both the old figure would be shown with a red cross-out superimposed. This has the potential to disrupt the formatting so is turned off by default.