After running a script to use latexdiff on a multiple input latex file I am left with a diff.tex file that is generating the following error:

./diff.tex:7009: LaTeX Error: \begin{description} on input line 6390 ended by \end{document}.


6384     \clearpage
6385         %DIF > \startchap
6386         %DIF > \subsection{Extensions}
6387         %DIF > \color{red}
6388         %DIF > \emph{Ticket \#1}
6389         %DIF > % Input FILES/extensions.tex
6390         \DIFaddbegin \bAPI{INFO\_ABOUT\_Extensions}{Info about extensions.}
6391         \synC   %DIF > Synopisis for C
6393         \DIFadd{void FOO(int BAR); %DIF > *\synCE    %DO NOT DELETE. THIS LINE IS NOT A COMMENT
6394         }

Which from the input file extensions.tex is:

\bAPI{INFO\_ABOUT\_Extensions}{Info about extensions.}
\synC   %Synopisis for C


After managing to get the latex document to compile by inserting an extra \eAPI macro at the end of line 6390, I came across a number of errors throughout the document involving latexdiff macros not working within the environments of the \synC macro.

  \begin{lstlisting} [language={C}, backgroundcolor=\color{gray}, lineskip=2pt, morekeywords={size_t}, aboveskip=0pt, belowskip=0pt]  


Edit: Initially I was not sure exactly where the error was being caused. Cleaning out the Dif insertions allowed me to compile the diff file. Latexdiff appears to be marking up the lstlisting environment inside the \synC macro. I've tried is there an option in latexdiff to ignore whole environments?, https://tex.stackexchange.com/questions/136454/using-latexdiff-math-markup-for-not-comparing-equations, and Macro, new command or new environment for code? but latexdiff is still marking up the lstlisting environment.

I've tried using \lstnewenvironment to change the macro but have yet to figure out why latexdiff is not excluding the lstlisting environment in my macro.

language={C}, backgroundcolor=\color{gray}, lineskip=2pt, morekeywords={size_t}, aboveskip=0pt, belowskip=0pt



  • 4
    Rather than make LaTeXdiff handle that unpleasant macro, it might be better to fix the macro. It uses \bf inappropriately for two reasons; it uses manual line breaks inappropriately, and -- most importantly -- it starts an environment but doesn't close it. It is just asking for all kinds of problems, and not just with diff scripts. – jon Apr 17 '15 at 21:05
  • Is this related to TeX.SX? It's rather about fixing external programs. – user31729 Apr 23 '15 at 7:03
  • The error in question is related to link . Latexdiff is trying to mark inside the lstlisting environment in my synC macro, causing all sorts of ugliness including marking some %*\synCE macros into %DIF < *\synCE. Which is what left my lstlisting environment open until the end of the document. – Eric Mitchell Apr 29 '15 at 14:08

Your Answer

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

Browse other questions tagged or ask your own question.