Problem using latexdiff and pdflatex with custom command
(OPs answer, moved from the question.)
I thought it would be more complex, but I found a solution. Using --exclude-textcmd
allows the ignoring of tags. It works now.
--exclude-textcmd="section,subsection"
It's difficult without an MWE, but I would assume that the difficulty is with hyperref
, which tries to include underlined/crossed out text as hyperlink given that it is part of a chapter.
The solution is to use texorpdfstring
, which tells hyperref to use plain text for the hyperlinks. I can't remember the exact commands that latexdiff
definds, but try something like that:
% Redefine these commands for chapter/sections and change below
\DeclareRobustCommand{\hsout}[1]{\texorpdfstring{\sout{#1}}{#1}}
\DeclareRobustCommand{\hwave}[1]{\texorpdfstring{\uwave{#1}}{#1}}
%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\textcolor{blue}{\hwave{#1}}}}% DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\textcolor{red}{\hsout{#1}}}}% DIF PREAMBLE
...
I had a problem with
\section{\DIFdelbegin \DIFdel{Conclusion}\DIFdelend \DIFaddbegin \DIFadd{Conclusions}\DIFaddend }
and Jörg's solution did not work for me. What worked was a manual substitution:
\section{\texorpdfstring{\DIFdelbegin \DIFdel{Conclusion}\DIFdelend \DIFaddbegin \DIFadd{Conclusions}\DIFaddend }{Conclusions}}