I am trying to utilize latexdiff
to highlight the changes between different version of a document. One thing that I have run into is that sometimes graphics in figures change. Obviously, latexdiff
can't tell if two images with the same filename are different, so I resorted to just renaming the files. What I've noticed though is that, although latexdiff generates the diff markup inside the figure environment, I don't see any output margin bar next to it.
I tried manipulating the FLOATSAFE/TRADITIONALSAFE/IDENTICAL configuration options – TRADITIONALSAFE had no change, and IDENTICAL just broke the compilation step (not surprising). The following is an MWE:
Given the two tex files:
a.tex
\documentclass[11pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[scale=0.1]{a}
\caption{Figure A}
\label{fig:a}
\end{figure}
\end{document}
b.tex
\documentclass[11pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[scale=0.1]{b}
\caption{Figure B}
\label{fig:b}
\end{figure}
\end{document}
And using command:
latexdiff -t CHANGEBAR a.tex b.tex >diff.tex
I get:
diff.tex:
\begin{document}
\begin{figure}
\centering
\DIFdelbeginFL %DIFDELCMD < \includegraphics[scale=0.1]{a}
%DIFDELCMD < %%%
\DIFdelendFL \DIFaddbeginFL \includegraphics[scale=0.1]{b}
\DIFaddendFL \caption{Figure \DIFdelbeginFL \DIFdelFL{A}\DIFdelendFL \DIFaddbeginFL \DIFaddFL{B}\DIFaddendFL }
\DIFdelbeginFL %DIFDELCMD < \label{fig:a}
%DIFDELCMD < %%%
\DIFdelendFL \DIFaddbeginFL \label{fig:b}
\DIFaddendFL \end{figure}
\end{document}
I'm wondering if anyone has come up with a decent workaround. Ideally, the whole figure would have a changebar – I don't really care if it's the caption or the picture that changed, just that the figure somehow changed.
Best Answer
You can use the changebar package but need to change the \DIFaddbegin/end and \DIFaddbegin/end commands rather than \DIFadd/del as is done by the -t option.
With the following preamble your MWE worked; adjust option of changebar package to your driver.
I obtained this by running
latexdiff -f IDENTICAL --show-preamble
and then editing the middle block by hand. Use --preamble / -p option to read in this preamble. If you like to use the changebars only in figures (really floating environments, also including tables), change the \DIFaddbeginFL etc. commands instead