1

I am in the process of rewriting a big file, where I need to produce the diff file of the new file with respect to the older version. Owing to the large number of symbols, I find it is good to have a table of symbols for which I want to use the glossaries package and \gls{} command. But the problem is this causes changes being highlighted in the final diff file generated using latexdiff, even though they are not real changes. My question is

  1. Is there a way to make latexdiff skip the changes due to a redefined symbols in the glossaries package? Or
  2. Is there a way to output a latex file where the glossary redefinitions are replaced by their actual latex command?

I will give an example here and I hope it makes it more clear what I want to do.

File1.tex:

\documentclass{article}
\begin{document}
\[
\mathbf{A}
\]
\end{document}

File2.tex (Using glossaries)

\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{matA}  
{  
  name={\ensuremath{\mathbf{A}}},  
  description={Adjacency Matrix}  
} 
\begin{document}
\[
\gls{matA}
\]
\end{document}

To me, these two files are the same and hence the diff file generated as latexdiff file1.tex file2.tex > diff.tex , should generate a diff.tex with no changes. But in reality it does register unnecessary changes. Any help is appreciated.

PS: The only related question I found is is there an option in latexdiff to ignore whole environments? and it has no answers right now.

  • I think it would be too much to demand of latexdiff to know this semantic detail of the glossaries package. Also, in some situation it might actually be the expected outcome that this change is highlighted. So what you propose as option 2 to have a preprocessing script that replaces \gls commands with their definition is the right way forward, in my opinion. Unfortunately I am not aware of such a script. – frederik Nov 9 '16 at 23:26

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.