TeX - LaTeX Asked on December 12, 2020
I have run into a problem with the markup that latexdiff adds around cite
commands. The MWE below, which is supposed to have been generated by latexdiff, doesn’t compile because LaTeX doesn’t recognise the closing brace for DIFdel
:
ERROR: Extra }, or forgotten endgroup.
The culprit is hspace{0pt}
: commenting this out prevents this error.
I have solved my immediate problem by manually deleting the string hspace{0pt}
from the difference file wherever it occurs, but obviously I’d rather not do this every time.
I have two questions: (1) why does LaTeX find a problem with the braces here in the first place, since they look matched to my human eyes (and to emacs!)? And (2) is there a way to prevent latexdiff from generating code that fails to compile in this way?
documentclass{article}
usepackage{hyperref}
% 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{DIFdeltex}[1]{{protectcolor{red}sout{#1}}} %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
providecommand{DIFdelbegin}{} %DIF PREAMBLE
providecommand{DIFdelend}{} %DIF PREAMBLE
%DIF HYPERREF PREAMBLE %DIF PREAMBLE
providecommand{DIFdel}[1]{texorpdfstring{DIFdeltex{#1}}{}} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF
begin{document}
DIFdelbegin DIFdel{Some textmbox{%DIFAUXCMD
cite{reference}}hspace{0pt}%DIFAUXCMD
, and some more text.}
DIFdelend
bibliography{my_bib}
end{document}
old.tex
documentclass{article}
usepackage{hyperref}
begin{document}
Some text cite{reference}, and some more text.
bibliography{my_bib}
end{document}
new.tex
documentclass{article}
usepackage{hyperref}
begin{document}
bibliography{my_bib}
end{document}
latexdiff old.tex new.tex > diff.tex
This year (2020) LaTeX underwent some internal changes that introduce incompatibilities with some packages. It seems that ulem.sty
is one of them, with the current version ulem 2019/11/18
pre-dating the changes in the LaTeX format.
The differences file produced by latexdiff
loads ulem.sty
and uses the command sout
(strike out), which leads to the error.
RequirePackage[normalem]{ulem} %DIF PREAMBLE
...
providecommand{DIFdeltex}[1]{{protectcolor{red}sout{#1}}} %DIF PREAMBLE
As a workaround, until the incomaptibility gets fixed, run latexdiff
with the option -t CFONT
, which avoids the use of sout
(proposed by @Ant in the comments).
Alternatively, add
RequirePackage[2019/11/18]{latexrelease}
as the first line in the differences file. This will set back the LaTeX format to a state that is compatible.
Correct answer by gernot on December 12, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP