ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
516 stars 73 forks source link

Tikz subfigures #8

Closed apYdr6uxv closed 9 years ago

apYdr6uxv commented 9 years ago

(Subfigure appears to be obsolete, but I don't know if that matters in this case.)

Given the example usage, after a latexdiff --flatten an extra } would be added after every \end{tikzpicture}. There's no pair bracket to it, as deleting the } would solve the issue.

\begin{figure}
\subfigure[Caption1]{\input{figures/figure1/tikz1}
\subfigure[Caption2]{\input{figures/figure2/tikz2}
\subfigure[Caption3]{\input{figures/figure3/tikz3}
\end{figure}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] at (0,0) {
    \includegraphics[width=.5\linewidth]{figures/figure1/figure1.jpeg}
};

... 

\end{tikzpicture}
ftilmann commented 9 years ago

I am afraid I do not quite understand the problem. Can you provide (working) old and new file, what latexdiff produces, and (if not obvious) what it should produce. Ideally I could see the problem without downloading the subfigure package.

apYdr6uxv commented 9 years ago

Sorry!

I looked at the diff file I worked with. The issue is different than what I said in the beginning. The subfigure environment just disappears after a latexdiff. That means the tikzpictures are dumped into the figure, and the sub-captions are lost. The lonely } is there, and had subfigure still existed, it would have paired with the { in the beginning of the environment.

I was about to close this issue, because subfigure is obsolete, but then I tried an example with the subfig package, and the same behaviour is exhibited.

I uploaded some example here.

ftilmann commented 9 years ago

It turned out that this had nothing to with with subfig or subfigure package but was a bug in the flatten subroutine, which dropped the beginning of the line containing the \input command (I tend to use \input's on a line by themselves so never noticed this; I am surprised nobody else has caught this)

I just committed the fix, which only required moving one line in the flatten subroutine dce7a4cb929c9748bf6bd5b9b5e09245c039eecb

apYdr6uxv commented 9 years ago

Many thanks! :+1: