1

This is probably a niche conflict between latexdiff and csquotes, but I'd like to get to the bottom of it.

Consider old.tex:

\documentclass{article}

\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
\end{filecontents}
\begin{document}

\textcquote[p.~342]{greenwade93}{Hi}.
\bibliographystyle{plainnat}
\bibliography{\jobname} 
\end{document}

and new.tex:

\documentclass{article}

\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
\end{filecontents}
\begin{document}

Test % That's the only change.
\bibliographystyle{plainnat}
\bibliography{\jobname} 
\end{document}

then latexdiff old.tex new.tex > diff.tex produces

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Wed Jul 15 11:16:30 2020
%DIF ADD new.tex   Wed Jul 15 11:16:21 2020

\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
\end{filecontents}
%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
\providecommand{\DIFmodbegin}{} %DIF PREAMBLE
\providecommand{\DIFmodend}{} %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 LISTINGS PREAMBLE %DIF PREAMBLE
\RequirePackage{listings} %DIF PREAMBLE
\RequirePackage{color} %DIF PREAMBLE
\lstdefinelanguage{DIFcode}{ %DIF PREAMBLE
%DIF DIFCODE_UNDERLINE %DIF PREAMBLE
  moredelim=[il][\color{red}\sout]{\%DIF\ <\ }, %DIF PREAMBLE
  moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ } %DIF PREAMBLE
} %DIF PREAMBLE
\lstdefinestyle{DIFverbatimstyle}{ %DIF PREAMBLE
    language=DIFcode, %DIF PREAMBLE
    basicstyle=\ttfamily, %DIF PREAMBLE
    columns=fullflexible, %DIF PREAMBLE
    keepspaces=true %DIF PREAMBLE
} %DIF PREAMBLE
\lstnewenvironment{DIFverbatim}{\lstset{style=DIFverbatimstyle}}{} %DIF PREAMBLE
\lstnewenvironment{DIFverbatim*}{\lstset{style=DIFverbatimstyle,showspaces=true}}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}

\DIFdelbegin \DIFdel{\textcquote[p.~342]{greenwade93}{Hi}.
}\DIFdelend \DIFaddbegin \DIFadd{Test %DIF >  That's the only change.
}\DIFaddend \bibliographystyle{plainnat}
\bibliography{\jobname} 
\end{document}

which cannot be compiled. The error message returned is

! Extra }, or forgotten \endgroup.
\UL@stop ...z@ \else \UL@putbox \fi \else \egroup 
                                                  \egroup \UL@putbox \fi \if...
l.60 }
      \DIFdelend \DIFaddbegin \DIFadd{Test %DIF >  That's the only change.
? 

I've been through Latexdiff's manual and simply can't find what is wrong with my example…

3

You are using \sout from the ulem package to strike through, and this is quite fragile and can't handle arbitrary input. This here simply explodes:

\documentclass{article}
\usepackage{ulem}
\usepackage{csquotes}
\begin{document}
\sout{\textcquote[p.~342]{greenwade93}{Hi}}
\end{document}

With lualatex you could use the lua-ul package instead which handle these commands without problems:

\documentclass{article}
\usepackage{lua-ul}
\let\sout\strikeThrough
\usepackage{csquotes}
\begin{document}
\sout{\textcquote[p.~342]{greenwade93}{Hi}}
\end{document}

enter image description here

2
  • 2
    I am not using it, Latexdiff is! But I guess a solution is to use another style, with a command like e.g. latexdiff -t CFONT old.tex new.tex > diff.tex.
    – Clément
    Jul 15 '20 at 16:25
  • Or you can use \let reassignment to corresponding macros provided by lua-ul with any undef. control sequence, as Mrs. Fischer showed. Jul 16 '20 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.