# Latexdiff and biblatex citation commands

I'm having trouble getting latexdiff to work when using the biblatex citation commands \parencite and \textcite.

Take old.tex:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year    = "1993",
journal = "TUGBoat",
volume  = "14",
number  = "3",
pages   = "342--351"
}
@book{goossens93,
author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title     = "The LaTeX Companion",
year      = "1993",
}
\end{filecontents}
\usepackage[style=apa,backend=biber]{biblatex}
\begin{document}

\textcite{greenwade93} is the best article on \LaTeX \parencite{goossens93}.

\printbibliography

\end{document}



and new.tex:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year    = "1993",
journal = "TUGBoat",
volume  = "14",
number  = "3",
pages   = "342--351"
}
@book{goossens93,
author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title     = "The LaTeX Companion",
year      = "1993",
}
\end{filecontents}
\usepackage[style=apa,backend=biber]{biblatex}
\begin{document}

\textcite{goossens93} is the best book on \LaTeX \parencite{greenwade93}.

\printbibliography

\end{document}


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

\documentclass[a4paper]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Sun Jul 26 18:28:46 2020
%DIF ADD new.tex   Sun Jul 26 18:28:55 2020
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year    = "1993",
journal = "TUGBoat",
volume  = "14",
number  = "3",
pages   = "342--351"
}
@book{goossens93,
author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title     = "The LaTeX Companion",
year      = "1993",
}
\end{filecontents}
\usepackage[style=apa,backend=biber]{biblatex}
%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{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                      %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

\printbibliography

\end{document}


which, when compiled with pdflatex yields:

The problem is that latexdiff puts the markup commands within the \textcite command, which obvious doesn't work. Adding natbib=true to the biblatex options and changing \textcite to \citet and \parencite to \citep gives the correct output:

The documentation (section 4) says:

The following packages trigger special behaviour:
...
apacite, biblatex
Redefine the commands recognised as citation commands.

Is this a bug in latexdiff or am I missing something?

I'd be happy to use the natbib commands instead, but I am using the code from this answer to to include the author name in the hyperlink.

EDIT: turns out that the code from moewe to include the author(s) in the citation links works perfectly fine when using the natbib command instead of the standard biblatex ones. I have no idea how that works, but it solves my immediate problem.

• Either latexdiff does not detect biblatex correctly or it detects it correctly, but does not handle its commands correctly. In either case I'd say this is a bug or limitation of biblatex. I suggest you contact the author about this. – moewe Jul 26 at 19:41
• @moewe I guess you meant to write it is a bug in latexdiff. Indeed it is; or better was - I just fixed it on the github repository. So the answer is either use the master from github repository of latexdiff or wait for the next release. – frederik Jul 27 at 16:34
• @frederik Oh yeah, absolutely. Muscle memory: I type biblatex way too often. Sorry for the confusion. Thanks for catching that. – moewe Jul 27 at 18:04

You can add the option --exclude-textcmd=textcite to force latexdiff to treat the \textcite command correctly (from latexdiff v1.3.2 this behaviour will be the default if biblatex package is used)
• After making my post I tried this but with textcite in quotes. Is that not the correct syntax? Because that didn't work. – avs Jul 27 at 17:21