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
516 stars 73 forks source link

Errors when using siunitx and "-t pdfcomments" option #100

Open giacomociani opened 7 years ago

giacomociani commented 7 years ago

Thanks for the fantastic tool. I just discovered it existence and I think it is wonderful.

However, I have an issue with a document using siunitx (and based on Revtek 4.1). When I run latexdiff with no option and then compile (Im using texstudio with miktek and default options), a nice marked-up pdf is generated. However, if I try to use the "-t pdfcomment" option, the resulting document gives an error at compilation time on the first usage of "\SI{...}" (the specific error depends on the exact usage of \SI).

Based on what I could understand from the documentation, latexdiff seems to be able to work with suinitx and should somehow "protect" the corresponding commands, but that doesn't seem to work. Or, more probably, I am doing something wrong...

I'm attaching a simple example case: latexdiffTest1 and latexdiffTest2 are the old and new versions, latexdiffTest is the result of latexdiff with no option and latexdiffTestComm is the result with the "-t pdfcomments" option. PDF and compilation logs are also attached. latexdiffTest.zip

ftilmann commented 7 years ago

Thanks for the nice words.

The reason is presumably some incompatibility between the pdfcomment and SIunitx packages Because of the large number of latex packages and markup-style, the combinations and potential for things to go wrong is nearly endless, though, and trying to address all of them myself is an exercise in futility. I therefore mostly concentrate on the default underlining markup style, and even here simply not all packages can be supported (the 'protection' mentioned in the manual is needed for combining with the ulem package used for underlining). You will therefore understand that I won't fix this myself. If you really would like to use this combination I would suggest contacting the maintainers of pdfcomment and/or siunitx and pointing out the incompatibility (and you should construct an example that demonstrates this without the latexdiff commands). I will leave the issue open in case you or somebody else finds a solution or at least a hint of a workaround but assign a low priority to indicate I will not be working on it myself. If you can modify the diff file manually so that it works, you can also repost, and I might be able to automatise that within latexdiff (depends on the exact changes necessary)