3

I am working on quite large documents and want to visualize the differences of different versions using latexdiff.

My old document did not use a fancy glossary, while the new one does. Now, latexdiff shows all replacements of any glossary entry within the text, yielding tons of differences, which are actually no differences.

Minimal working example:

old.tex

\documentclass{article}

\newcommand{\foo}[1]{#1}

\begin{document}

Bla.

\end{document}

new.tex

\documentclass{article}

\newcommand{\foo}[1]{#1}

\begin{document}

\foo{Bla}.

\end{document}

latexdiff old.tex new.tex > diff.tex:

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Tue Mar 29 09:47:08 2016
%DIF ADD new.tex   Tue Mar 29 09:47:53 2016

\newcommand{\foo}[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\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}

\DIFdelbegin \DIFdel{Bla}\DIFdelend \DIFaddbegin \DIFadd{\foo{Bla}}\DIFaddend .

\end{document}

How can I make latexdiff ignore any insertion of the command \foo?

I tried to play with the various command-line options for latexdiff (--exclude-safecmd etc) and also with the PICTUREENV variable, but nothing seems to work.

Any ideas?

Daniel
  • 31
  • 3
    using --exclude-safecmd="foo" gives \DIFdelbegin \DIFdel{Bla}\DIFdelend \DIFaddbegin \foo{Bla}\DIFaddend .. Isn't that what you want? Because I don't think it is possible to also deny the marking with \DIFaddbegin, etc. – Stefan Pinnow Mar 30 '16 at 07:50
  • Currently there is no option in latexdiff to achieve this. The only option I can think of is to preprocess the 'new' file to remove the \foo commands using regular expression substitution. Something along the lines of "perl < new.tex -0 -ne 's/\foo{(.*?)}/$1/sg; print' > new_mod.tex" . This will not work if there are further parentheses in the argument to \foo – frederik Mar 30 '16 at 08:53

0 Answers0