1

I have different versions of a latex file that use toggles (from etoolbox). When I use latexdiff to compare the different versions, I can see that latexdiff is (practically) oblivious to changes in values of the toggles. For example, with file1.tex and file2.tex given below, the output of the latexdiff file (after compiling) is simply "content when boolFlag is true".

File 1.tex

\documentclass{article}
\usepackage{etoolbox}

\begin{document} \providetoggle{boolFlag}

\iftoggle{boolFlag} {content when boolFlag is true} {content when boolFlag is false} \end{document}

File2.tex

\documentclass{article}
\usepackage{etoolbox}

\begin{document} \providetoggle{boolFlag} \toggletrue{boolFlag}

\iftoggle{boolFlag} {content when boolFlag is true} {content when boolFlag is false} \end{document}

The expected output is "content when boolFlag is false true".

How to get this correct latexdiff output?

The solutions I expect are

  1. A way to generate a file with replaced content when given the latex file with toggles, and the list of toggle variable values (similar to this, but with LaTeX rather than LuaLaTeX).
  2. Somehow make latexdiff aware of toggles (I suppose this is going to be hard; great if such a solution exists).
  • As the developer/maintainer of latexdiff I would strongly favour solution 1. The only alternative would really be to reimplement the full toggle functionality as an internal pre-processor within latexdiff. Sorry to not be able to help further. – frederik Dec 14 '22 at 10:21
  • @frederik Thanks for the input. Latexdiff reimplementing toggle is a good idea. But, I am afraid audience for this functionality would be too small. How about using tex primitives instead of toggle? I suppose that that's not going to help either. – Cyriac Antony Dec 15 '22 at 01:04

0 Answers0