[Tex/LaTex] Customizing latexdiff default (UNDERLINE) output styling

changesformattinghighlightinglatexdiffstrikeout

I'm using latexdiff to highlight the differences between two versions of a tex document, using the default style which is UNDERLINE. This style formats added text in blue with a wavy underline, and removed text in red with a strikethough.

I'm interested in formatting the output such that added text is in blue but without the wavy underline (and removed text is in red as before). Is there a command for achieving this? I wasn't able to figure it out from the man page.

Another way would be to modify the CCHANGEBAR style, which formats added text in blue and removed text in red but without the strikethrough, to add the strikethrough to the removed text (my question is how).

Best Answer

There is no standard option to do this, but you can create your own preamble file for latexdiff to replace the highlighting commands. All you need to do after a standard run of latexdiff is to copy the lines latexdiff writes in to the header of the diff file and change those that do not fit your style. In your case the command to change is \DIFadd that by default is

\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE

The wavy underlining is generated by \uwave{...}, so removing this we get

\providecommand{\DIFadd}[1]{{\protect\color{blue}#1}}

A complete preamble file is then

\RequirePackage[normalem]{ulem}
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1}
\providecommand{\DIFadd}[1]{{\protect\color{blue}#1}}
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                    
\providecommand{\DIFaddbegin}{}
\providecommand{\DIFaddend}{}
\providecommand{\DIFdelbegin}{}
\providecommand{\DIFdelend}{}
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}}
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}}
\providecommand{\DIFaddbeginFL}{}
\providecommand{\DIFaddendFL}{}
\providecommand{\DIFdelbeginFL}{}
\providecommand{\DIFdelendFL}{} 

which if you call this preamble.tex can be used by latexdiff via

latexdiff -p preamble.tex old.tex new.tex > diff.tex

With new.tex

\documentclass{article}

\begin{document}

The text now starts with this.

\end{document}

and old.tex

\documentclass{article}

\begin{document}

The text started with this.

\end{document}

this generates a diff.tex that produces

Sample output

Related Question