ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
514 stars 72 forks source link

adding 'subsection' not supported #200

Closed christian-rauch closed 4 years ago

christian-rauch commented 4 years ago

Adding a subsection like

\subsection{Data Collection}

will produce a diff output

\DIFaddbegin \subsection{\DIFadd{Data Collection}}

which causes compilation issues:

./thesis-diffexamination.tex:1549: Argument of \UL@word has an extra }.<inserted text> 
                \par 
l.1549 ...in \subsection{\DIFadd{Data Collection}}
ftilmann commented 4 years ago

This example should work, and the problems must arise due to interaction with one of the packages used. To be able to diagnose this issue you would need to provide a complete (but minimal) working example.

Having said this, I vaguely remember errors like this occurred with the hyperref package. Normally latexdiff recognizes if this package is included and modifies its markup to ensure compatibility but if hyperref is not included directly but loaded by another package, this mechanism will fail. So you MIGHT have luck with --packages=hyperref option, but of course I am not sure if this really is the problem.

Failing that, --exclude-textcmd=subsection will suppress the markup in subsection, but it would be a pity because normally this works.

christian-rauch commented 4 years ago

The --packages=hyperref option indeed solves the problem. I am running latexdiff-vc --packages=hyperref -r <git_tag> thesis.tex --flatten.

Does this help to fix the issue in the script to detect and work around this?

I am unable to create a smaller reproducible example with the template that I am using.

ftilmann commented 4 years ago

Thanks for letting me know and good to know it could help you. Without knowing which actual package or template this causes it, I cannot immediately address this, and because of the overhead I do not want to add the extra layer of commands for every run of latexdiff. I have a long term plan to let latexdiff scan included package for other packages loaded subsequently, which would probably help. I will close the issue for now, as there is no direct way to continue investigating it (and you managed to solve your problem)