Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Proposal) new package option: redefine \qty command #447

Closed
yuishin-kikuchi opened this issue May 22, 2021 · 15 comments
Closed

(Proposal) new package option: redefine \qty command #447

yuishin-kikuchi opened this issue May 22, 2021 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@yuishin-kikuchi
Copy link

New version, siunitx v3 (2021-05-20) avoids overwriting \qty command of physics package.
On the other hand, \qty command of physics package is a just alias of \quantity command.
Thus, even if siunitx overwrites \qty, \quantity still can be used.
And \newcommand{\qtty}{\quantity} works fine.

So, I propose new package option(s):
% (load physics before siunitx)
\usepackage[qty]{siunitx} % when physics package loaded, overwrite \qty.

@josephwright josephwright self-assigned this May 22, 2021
@josephwright josephwright added the enhancement New feature or request label May 22, 2021
@syvshc
Copy link

syvshc commented May 23, 2021

yeah, package physics and siunitx both are important in my article. Now I have to use \usepackage{siunitx}[=v2], but I don't know if this option will disappear

@josephwright
Copy link
Owner

I've supported v1-from-v2 for 10+ years - I expect \usepackage{siunitx}[=v2] to stay for the life of v3, which I expect to be 'for ever' (I don't imagine ever doing another re-write).

@deadundead
Copy link

You should be able to fix it this way:
download the direct install archive from CTAN, and put the file siunitx.sty into your document folder.
Then change the code according to this commit.
deadundead@741a1f1
I believe the author has his reasons for not using '\RenewDocumentCommand', but I needed that to work.
This will override the physics package \qty command.

@boyoungzheng
Copy link

I prefer to have \qty from physics not overwritten. Change the name from \qty to \qtty or siqty or whatever in siunitx would work better for me.

@boyoungzheng
Copy link

It looks like I need to use \SI etc. for now. But I cannot find the old documentation anywhere. Can you please help? Thanks!

@josephwright
Copy link
Owner

@boyoungzheng As described in Compatibility with other packages, you will need to use \SI with the physics package. I will be retaining \SI in perpetuity - I simply don't recommend it for new documents. (The physics package is highly problematic, and so I don't recommend it either!)

@josephwright
Copy link
Owner

@boyoungzheng I will not be providing name other than \qty/\SI, but I am still thinking about how best to cover the various requirements of back-compability but also allowing use of \qty from siunitx with the physics package loaded.

@boyoungzheng
Copy link

Thanks for the reply! I understand I have to use \SI for my need. The problem is, I cannot find the old user manual explaining the use of it. Maybe add the old user manual to the v2 branch here?

@josephwright
Copy link
Owner

@boyoungzheng Like I said, I would strongly hope that no new documents are using physics. The \SI command is (essentially) the same as \qty: that's why I only mention \SI very briefly in the latest manual.

@josephwright
Copy link
Owner

I will improve the advice for v3.1 - there will be a clear instruction on how to proceed in the log. I don't feel I can go any further: physics is entitled to use the command name \qty, and as the semantics are entirely different, I can't simply no allow loading of both packages (cf. units, for example).

@guillaume-mueller
Copy link

For me it remains one issue : the warning (which I suppose refers to what you call the "log") stays whatever I do.

How to clear it ?

@josephwright
Copy link
Owner

For me it remains one issue : the warning (which I suppose refers to what you call the "log") stays whatever I do.

How to clear it ?

What message?

@guillaume-mueller
Copy link

Package siunitx Warning: Detected the "physics" package: omitting definition of \qty. If you want to use \qty with the siunitx definition, add \AtBeginDocument{\RenewCommandCopy\qty\SI} to your preamble.

@josephwright
Copy link
Owner

@guillaume-mueller This can be done using message redirection

\ExplSyntaxOn
\msg_redirect_name:nnn{siunitx}{physics-pkg}{none}
\ExplSyntaxOn

@TheFermi0n
Copy link

@guillaume-mueller This can be done using message redirection

\ExplSyntaxOn
\msg_redirect_name:nnn{siunitx}{physics-pkg}{none}
\ExplSyntaxOn

The last line should be \ExplSyntaxOff

\ExplSyntaxOn
\msg_redirect_name:nnn{siunitx}{physics-pkg}{none}
\ExplSyntaxOff

Thanks for this one. I can finally use \qty from physics package. This package is hardwired in my project. I also needed the siunitx package for the units where I can luckily still use the \SI command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants