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

Bug when combining \sqrt with scientific notation and number-mode=match, with workaround #721

Closed
bamford opened this issue Feb 14, 2024 · 2 comments
Assignees
Labels
bug Something isn't working hotfix A change that will be addressed in a hotfix

Comments

@bamford
Copy link

bamford commented Feb 14, 2024

I have been trying to typeset $\sqrt{3}\times10^{10}~m^{-1}$ using \qty, similar to \qty{3e10}{m^{-1}}, in a document that uses \sisetup{number-mode=match}.

Using parse-numbers=false almost works:

\sisetup{number-mode=match}
The number is not \qty{3e10}{m^{-1}}, but rather \qty[parse-numbers=false]{\sqrt{3}\times10^{10}}{m^{-1}}.

produces:
Screenshot 2024-02-14 at 20 16 05
which somehow typesets the $\sqrt{3}$ in the text font, but the $\times 10^{10}$ in the math font!

Presumably this is unintended behaviour, that someone with knowledge of the internals of siunitx may be able to fix.

After some experimentation I found that adding the number-mode=math option and wrapping the number in \text{} produes the desired output, although I’m not sure why! So, this is a workaround:

\sisetup{number-mode=match}
The number is not \qty{3e10}{m^{-1}}, but rather \qty[number-mode=math, parse-numbers=false]{\text{\sqrt{3}\times10^{10}}}{m^{-1}}.

which produces:
Screenshot 2024-02-14 at 20 16 27

I'm using LuaLaTeX with TeX Live 2023 on Overleaf.

@josephwright josephwright self-assigned this Feb 14, 2024
@josephwright josephwright added bug Something isn't working hotfix A change that will be addressed in a hotfix labels Feb 14, 2024
@josephwright
Copy link
Owner

I've corrected the behaviour here: you get everything in math mode - that is the documented approach when not parsing numbers.

@bamford
Copy link
Author

bamford commented Feb 15, 2024

That was fast! Many thanks @josephwright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hotfix A change that will be addressed in a hotfix
Projects
None yet
Development

No branches or pull requests

2 participants