2

Is there a way to make latexdiff highlight changes in a captionof?

For example, orig.tex:

\documentclass{article}

\usepackage{caption}
\captionsetup{parindent=\parindent}
\usepackage[demo]{graphicx}

% make demo figure
\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother

\begin{document}

\noindent
\begin{minipage}[c]{\linewidth}
\centering
\includegraphics{}
\captionof{figure}[Title]{\textbf{Title}

Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text

Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
\label{fig:angio}
\end{minipage}

\end{document}

new.tex:

\documentclass{article}

\usepackage{caption}
\captionsetup{parindent=\parindent}
\usepackage[demo]{graphicx}

% make demo figure
\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother

\begin{document}

\noindent
\begin{minipage}[c]{\linewidth}
\centering
\includegraphics{}
\captionof{figure}[Title]{\textbf{Title}

New Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text

New Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
\label{fig:angio}
\end{minipage}

\end{document}

diff.tex produced by doing latexdiff orig.tex new.tex > diff.tex

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL indent.tex    Sun Nov  8 17:48:39 2015
%DIF ADD indent2.tex   Sun Nov  8 17:49:21 2015

\usepackage{caption}
\captionsetup{parindent=\parindent}
\usepackage[demo]{graphicx}

% make demo figure
\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother

\newlength{\savedparindent}
% Save \parindent
\AtBeginDocument{\setlength{\savedparindent}{\parindent}}

%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE %DIF PREAMBLE
\RequirePackage[normalem]{ulem} %DIF PREAMBLE
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                      %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

\noindent
\begin{minipage}[c]{\linewidth}
\centering
\includegraphics{}
\DIFdelbegin %DIFDELCMD < \captionof{figure}[Title]{\textbf{Title}
%DIFDELCMD < 

%DIFDELCMD < Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text
%DIFDELCMD < 

%DIFDELCMD < Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
%DIFDELCMD < %%%
\DIFdelend \DIFaddbegin \captionof{figure}[Title]{\textbf{Title}

New Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text

New Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
\DIFaddend \label{fig:angio}
\end{minipage}

\end{document}

When I open the resulting diff.pdf, there is no markup in the output. Is there a way to get the \DIFadd{} markup to work within captionof (even manually)?

1 Answer 1

1

latexdiff does not know about \captionof and errs on the side of caution by not marking up the arguments of unknown commands.

You can use the --append-textcmd option to tell latexdiff to parse the last argument of any given command.

latexdiff --append-textcmd=captionof old.tex new.tex > diff.tex

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .