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}.
diff.tex
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
6392
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
void FOO(int BAR); %*\synCE %DO NOT DELETE. THIS LINE IS NOT A COMMENT
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.
\newcommand{\synC}{
\textbf{C/C++:}
\begin{lstlisting} [language={C}, backgroundcolor=\color{gray}, lineskip=2pt, morekeywords={size_t}, aboveskip=0pt, belowskip=0pt]
}
\newcommand{\synCE}{
\end{lstlisting}
}
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.
\lstdefinestyle{styC}{
language={C}, backgroundcolor=\color{gray}, lineskip=2pt, morekeywords={size_t}, aboveskip=0pt, belowskip=0pt
}
\lstnewenvironment{formC}[1][]
{\lstset{style=styC,#1}}
{}
\newcommand{\synC}{
\textbf{C/C++:}
\begin{formC}
}
\newcommand{\synCE}{
\end{formC}
}
\bfinappropriately 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:05synCmacro, causing all sorts of ugliness including marking some%*\synCEmacros 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