-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
Description
If I have a line of text that uses math mode via pairs of $$, and an \mbox within that block, which contains its own $$ math mode block within the \mbox, then latexdiff's parsing seems to match the opening $ outside of the \mbox with the opening $ within the \mbox.
I'm not sure if there's an easy workaround, but if there is then I didn't manage to find it (I ended up removing the entire \mbox and using \text to make the diff work for my immediate use case, but that's kind of a tedious process).
What I ran:
$ latexdiff --version
This is LATEXDIFF 1.3.5a (Algorithm::Diff 1.201, Perl v5.38.2)
(c) 2004-2024 F J Tilmann
$ cat 1.tex
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
$1 \mbox{$a$}$
\end{document}
$ cat 2.tex
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
$2 \mbox{$a$}$
\end{document}
$ latexdiff 1.tex 2.tex > diff.texWhat I expected:
[...]
\begin{document}
\DIFdelbegin \DIFdel{$1 \mbox{$a$}$}\DIFdelend \DIFaddbegin \DIFadd{$2 \mbox{$a$}$}\DIFaddend
\end{document}
What I got:
[...]
\begin{document}
\DIFdelbegin \DIFdel{$1 \mbox{$}\DIFdelend \DIFaddbegin \DIFadd{$2 \mbox{$}\DIFaddend a$}$
\end{document}
This leads to the error:
Runaway argument?
{$1 \mbox {$}\DIFdelend \DIFaddbegin \DIFadd {$2 \mbox {$}\DIFaddend \ETC.
! File ended while scanning use of \DIFdel.
<inserted text>
\par
<*> diff.tex
?