latexdiff icon indicating copy to clipboard operation
latexdiff copied to clipboard

siunitx new macros are not recognized

Open joe6302413 opened this issue 1 year ago • 4 comments

Following the update of siunitx v3, new macros, such as \qty, \qtyrange and \qtylist, are introduced to replace the old macros starting with \SI. The current package does not recognize the new macros and provide \mbox protection.

The issue can be worked around by using --append-mboxsafecmd='qty,qtyrange,num,qtylist,qtyproduct...etc', but it would be easier to update the package behavior with siunitx since it is one of the most used package.

joe6302413 avatar May 04 '23 11:05 joe6302413

Thanks for letting me know. I guess for many years latexdiff will have to support old and new syntaxes. As I am not an active user of siunitx, would you be able to provide the list of commands, patterns, which would need to be protected. You started making this list but the "..etc" suggest there are more. If you had a short test document with the new SIunitx commands would be great (my installation of texlive still has the old siunitx).

ftilmann avatar May 04 '23 20:05 ftilmann

Sorry for mispress the closing button, but hope my reply will make it closer to close.

I have tested all the combinations (not good at perl nor latex). It seems the current stable version can take care of some of the siunitx commands (see the "already safe cmd.txt"). I have no clue what makes a command safe or mbox safe, but I presume that a safecmd should not be in mboxsafecmd as they require less treatment. Here I have listed all the commands to my knowledge into safecmd and mbox safecmd (see the files).

My testing tex file is attached as siunitx_test and siunitx_test_old with random changes in the inputs.

Hope these are helpful. Thank you.

siunitx_safecmd.txt siunitx_mboxsafecmd.txt already safe cmd.txt

siunitx_test.txt siunitx_test_old.txt

joe6302413 avatar May 16 '23 11:05 joe6302413

Thanks for contributing PR. This solves the issue

ftilmann avatar May 29 '23 14:05 ftilmann

Dear @joe6302413 and @ftilmann, First of all, thanks for solving this issue.

Sadly, I noticed that the solution does not work if the corresponding siunitx-command is using options, e.g. \num[round-mode=places, round-precision=2, exponent-mode=scientific]{123456789}.

I've modified the testing files to make life easier, but I don't know how to fix this issue. Maybe you have an idea?

siunitx_test.txt siunitx_test_old.txt

snaunheim avatar Jul 19 '23 08:07 snaunheim