Open zyrano opened 2 years ago
Thanks for reporting. List environments are a somewhat known weakness. Any chance of getting a sanitised example of old and new text leading to this outcome. Otherwise this will be hard to debug.
In the following I provide a sanitized example with the following restrictions:
I try no to damage the structure when adjusting the sample text. So hopefully this can be used to reproduce the bug. Furthermore there is additional complexity as we have the single glossary entries in separate files, use a Makefile to generate the glossary.tex and then include generated the glossary.tex in our final documents. So problems may also be caused by this structure / latexpand.
Old:
\chapter{Abkürzungsverzeichnis} \begin{acronym}[lorem] \acro{sample}[Sample]{Beispielprobe} \acroplural{sample}[samples]{Beispielproben} \end{acronym} \longnewglossaryentry{ipsum} { name=ipsum } { \begin{enumerate}[label=\alph*)] \item a cute animal \item[] oder \item some dummy text \item[] oder \item something else \item[] oder \item something totally different \end{enumerate} Depending on the context \dots. } \longnewglossaryentry{yellow}
New:
\chapter{Abkürzungsverzeichnis} \begin{acronym}[lorem] \acro{sample}[Sample]{Beispielprobe} \acroplural{sample}[samples]{Beispielproben} \end{acronym} \printglossaries \bibliographystyle{alpha} \bibliography{../commons/bibliography} \addcontentsline{toc}{chapter}{Literaturverzeichnis} \label{bibliography}} \renewcommand{\glossarypreamble}{\label{chap:glossary}} \makeglossaries \longnewglossaryentry{ipsum} { name=ipsum } { \begin{enumerate}[label=\alph*)] \item a cute animal \item[] oder \item some dummy text \item[] oder \item something else \item[] oder \item something totally different \end{enumerate} Depending on the context \dots. } \longnewglossaryentry{yellow}
Furthermore due to the change with \makeglossaries the sample glossary entry \gls{ipsum} is only contained in the old document but not in the new one while \gls{yellow} is contained in both documents (cause in the old document the whole glossary was printed in the new document only the referenced entries and there is no \gls{ipsum} in the document).
OK, I know it's been some time but I just looked at this again. The example you provided does not reproduce the error, as the argument of \longnewglossaryentry is the same in old.tex and new.tex, and the only difference is the `paragraph' starting with \printglossaries. Also, I am not familiar with glossaries package, nor is latexdiff, so \makeglossaries will not get expanded internally but treated atomistically, i.e. you cannot expect differences to be highlighted there. Nevertheless there should be no errors when compiling Also note that latexdiff does not recognise command arguments if there are not immediately following - it will not recognise commands separated by newlines or spaces. So writing the entry as the following:
\longnewglossaryentry{ipsum}{
name=ipsum
}{
\begin{enumerate}[label=\alph*)]
\item ...
\end{enumerate}
Depending on the context \dots.
}
there probably will no longer be a compilation error (but also no highlighting). Alternatively, use --allow-spaces
option (which can have unwanted side effects).
If you are still interested in this bug, I would need a corrected sanititized example, and this should be a full MWE, i.e. including necessary preamble, \begin{document} etc
I'm experiencing the same bug, I think that it's triggered when all the \item
s start with a latex block. Below a MWE.
old.tex
\documentclass{article}
\begin{document}
Missing item error:
\begin{itemize}
\item {\it first item}
\end{itemize}
\end{document}
new.tex
\documentclass{article}
\begin{document}
Missing item error:
no items here
\end{document}
LATEXDIFF 1.3.2 is generating a diff latex file which includes:
\begin{itemize}%DIFAUXCMD
%DIFDELCMD < \item {\it %%%
\DIFdel{first item}%DIFDELCMD < }
\end{itemize}%DIFAUXCMD
that cannot be compiled because there're no \item
s inside an itemize
environment.
I can confirm that the problem seems to occur when the \item
starts with a Latex block. Here is my MWE, tested on latexdiff 1.3.3.
old.tex
\documentclass{article}
\begin{document}
\begin{enumerate}
\item{First item}
\item{Second item}
\item{Third item}
\end{enumerate}
\end{document}
new.tex
\documentclass{article}
\begin{document}
\begin{enumerate}
\item{1st item}
\item{2nd item}
\item{3rd item}
\end{enumerate}
\end{document}
No diff at all is produced, but the new.tex
items are present in the diff file.
When the same input files are provided without the wrapping curly braces after each \item
command, the script works as expected.
I opened a question on stack exchange with some more information, before I came across this issue. https://tex.stackexchange.com/questions/681408/latexdiff-does-not-diff-enumerate-environment
Hi, first latexdiff is a really great tool, thanks for developing it.
We noticed cases where it produces a .tex which contains bugs/can't be compiled. In our document we had a glossary from which some entries have been removed. Some of these entries contain enumerate environments. However (maybe due to other changes in the defined term) the \begin{enumerate} is removed but orphaned \item statements remain. As I may not provide the file I extract a sample of such a corrupted block but had to replace the text with dummy content.
Version is latexdiff-vc --version This is LATEXDIFF-VC 1.3.0 (c) 2005-2018 F J Tilmann
We also encountered some issues with added chapters but these are negligible for now ...