Diffing this file with itself will the first \begin{verbatim} to be replaced with a \begin{DIFverbatim} and the last \end{verbatim} to be replaced with a \end{DIFverbatim}, but the first \end{verbatim} and the second \begin{verbatim} are left as is, so the middle non-verbatim text gets included in the spurious DIFverbatim block.
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{verbatim}
first _
block _
\end{verbatim}
non verbatim text
\begin{verbatim}
second block
\end{verbatim}
\end{document}
\begin{document}
\DIFmodbegin
\begin{DIFverbatim}[alsolanguage=DIFcode]
first _
%block _
\end{verbatim}
non verbatim text
\begin{verbatim}
second block
\end{DIFverbatim}
\DIFmodend
\end{document}
As you can see, despite not actually having a diff, they get wrapped in a DIFverbatim block and each line after a line ending with underscore gets preceded with a % sign, which maybe is related to why the first \end{verbatim} is ignored? I don't really know what is going on.
If I only have one line ending with underscore in the verbatim block, the first \end{verbatim} will get the \end{DIFverbatim} instead of the second.
Diffing this file with itself will the first
\begin{verbatim}
to be replaced with a\begin{DIFverbatim}
and the last\end{verbatim}
to be replaced with a\end{DIFverbatim}
, but the first\end{verbatim}
and the second\begin{verbatim}
are left as is, so the middle non-verbatim text gets included in the spuriousDIFverbatim
block.Running
latexdiff strange.tex strange.tex | tail -n15
outputs:As you can see, despite not actually having a diff, they get wrapped in a
DIFverbatim
block and each line after a line ending with underscore gets preceded with a%
sign, which maybe is related to why the first\end{verbatim}
is ignored? I don't really know what is going on.If I only have one line ending with underscore in the verbatim block, the first
\end{verbatim}
will get the\end{DIFverbatim}
instead of the second.