Closed jmollera closed 3 years ago
Update for \qtyrange: setting explicitly the option range-phrase removes the unwanted text "(numerical range)", but the units are still missing.
\sisetup{
range-phrase = \ensuremath{\text{~to~}},
}
\qtyrange{1}{5}{\watt}
--> 1 W to 5 W (CORRECT)
\qtyrange[parse-numbers=false]{1}{5}{\watt}
--> 1 to 5 (INCORRECT)
I don't see the issue with the phrase appearing: can you add your .log
file?
I don't see the issue with the phrase appearing: can you add your
.log
file?
I have attached my log file and a screenshot also.
That looks like a translations
issue, but I'm not sure why as French should be set up. For me with the fix for the unit printing
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[frenchb]{babel}
\usepackage{siunitx}
\begin{document}
\qtyrange{1}{5}{\watt}
\qtyrange[parse-numbers = false]{1}{5}{\watt}
\end{document}
prints
1 W à 5 W for both forms of input. Can you provide an example of your input?
\documentclass{article} \usepackage[T1]{fontenc} \usepackage[frenchb]{babel} \usepackage{siunitx} \begin{document} \qtyrange{1}{5}{\watt} \qtyrange[parse-numbers = false]{1}{5}{\watt} \end{document}
I'm using Catalan in my document. Your example works correctly for me also, but when I substitute "catalan" for "frenchb" in your example, then the text "(numerical range)" appears.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[catalan]{babel}
\usepackage{siunitx}
\begin{document}
\qtyrange{1}{5}{\watt}
\qtyrange[parse-numbers = false]{1}{5}{\watt}
\end{document}
prints 1 W to (numerical range) 5 W.
Adding an explicit setting solves the issue.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[catalan]{babel}
\usepackage{siunitx}
\sisetup{
range-phrase = \ensuremath{\text{~a~}},
}
\begin{document}
\qtyrange{1}{5}{\watt}
\qtyrange[parse-numbers = false]{1}{5}{\watt}
\end{document}
prints 1 W a 5 W.
Ah, I'd mistaken Catalan for French. What's happening there is that translations
, which is used by siunitx
, doesn't know how to translate the term to
(as a range phrase), so you just key the 'key'. You can as you say simply set the value manually, or if there is a Catalan translation you can provide, I can add it to what siunitx
'knows'. (I suspect I also need a translation for 'and'.)
As the part that's in the siunitx
code is fixed, I'm closing.
Thank you for your interest and your prompt answers.
You're not the first one to mistake Catalan for French. The Catalan translation for "to" is "a", and the translation for "and" is "i".
De: Joseph Wright @.> Enviat el: diumenge, 13 de juny de 2021 23:45 Per a: josephwright/siunitx @.> A/c: jmollera @.>; Author @.> Tema: Re: [josephwright/siunitx] \qtylist, \qtyrange and [parse-numbers = false] (#484)
Ah, I'd mistaken Catalan for French. What's happening there is that translations, which is used by siunitx, doesn't know how to translate the term to (as a range phrase), so you just key the 'key'. You can as you say simply set the value manually, or if there is a Catalan translation you can provide, I can add it to what siunitx 'knows'. (I suspect I also need a translation for 'and'.)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/josephwright/siunitx/issues/484#issuecomment-860274360, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASNBI4EA4OAWPFPPMFW7RHDTSURJNANCNFSM46SXK3IQ.
ukenglish, usenglish, french-belgium... are also missing.
\documentclass[ukenglish]{scrbook}
\usepackage{babel}
\usepackage{siunitx}
\begin{document}
\chapter{test}
\numrange{1}{2}
\today
\end{document}
I think it would be nice to have some warning when compiling if no appropriate translation is given. And as fallback use --
as it is commonly understood and somehow viable.
I know, it is a tedious work, but having the popular variants also working would be great. A comprehensive list can be found at: https://ctan.mirror.norbert-ruehl.de/macros/latex/required/babel/base/babel.pdf
Here is a uncomprehensive and certainly partly incorrect list of language groups I made of this:
##Arabic
ar-DZ
ar-EG
ar-IQ
ar-JO
ar-LB
ar-MA
ar-PS
ar-SA
ar-SY
ar-TN
arabic
arabic-algeria
arabic-DZ
arabic-morocco
arabic-MA
arabic-syria
arabic-SY
##Catalan
ca
catalan
##German
de-AT
de-CH
de
gsw
austrian
colognian
german-at
german-austria
german-ch
german-switzerland
german
##Greek
el
el-polyton
greek
polytonicgreek
##English
en-AU
en-CA
en-GB
en-NZ
en-US
en
american
australian
british
canadian
english-au
english-australia
english-ca
english-canada
english-gb
english-newzealand
english-nz
english-unitedkingdom
english-unitedstates
english-us
english
newzealand
ukenglish
usenglish
##Spanish
es-MX
es
mexican
spanish-mexico
spanish-mx
spanish
##French
fr
fr-BE
fr-CA
fr-CH
fr-LU
french-be
french-belgium
french-ca
french-canada
french-ch
french-lu
french-luxembourg
french-switzerland
french
##Malayi
ms-BN
ms-SG
ms
malay-bn
malay-brunei
malay-sg
malay-singapore
malay
malayalam
##Punjabi
pa-Arab
pa-Guru
pa
punjabi-arab
punjabi-arabic
punjabi-gurmukhi
punjabi-guru
punjabi
##Portuguese
pt-BR
pt-PT
pt
brazilian
galician
portuguese-br
portuguese-brazil
portuguese-portugal
portuguese-pt
portuguese
##Sanskrit
sa-Beng
sa-Deva
sa-Gujr
sa-Knda
sa-Mlym
sa-Telu
sa
sanskrit-beng
sanskrit-bengali
sanskrit-deva
sanskrit-devanagari
sanskrit-gujarati
sanskrit-gujr
sanskrit-kannada
sanskrit-knda
sanskrit-malayalam
sanskrit-mlym
sanskrit-telu
sanskrit-telugu
sanskrit
##Serbian
sr-Cyrl-BA
sr-Cyrl-ME
sr-Cyrl-XK
sr-Cyrl
sr-Latn-BA
sr-Latn-ME
sr-Latn-XK
sr-Latn
sr
serbian-cyrillic-bosniaherzegovina
serbian-cyrillic-kosovo
serbian-cyrillic-montenegro
serbian-cyrillic
serbian-cyrl-ba
serbian-cyrl-me
serbian-cyrl-xk
serbian-cyrl
serbian-latin-bosniaherzegovina
serbian-latin-kosovo
serbian-latin-montenegro
serbian-latin
serbian-latn-ba
serbian-latn-me
serbian-latn-xk
serbian-latn
serbian
##Uzbek
uz-Arab
uz-Cyrl
uz-Latn
uz
uzbek-arab
uzbek-arabic
uzbek-cyrillic
uzbek-cyrl
uzbek-latin
uzbek-latn
uzbek
##Chinese
zh-Hans-HK
zh-Hans-MO
zh-Hans-SG
zh-Hans
zh-Hant-HK
zh-Hant-MO
zh-Hant
zh
cantonese
chinese-hans-hk
chinese-hans-mo
chinese-hans-sg
chinese-hans
chinese-hant-hk
chinese-hant-mo
chinese-hant
chinese-simplified-hongkongsarchina
chinese-simplified-macausarchina
chinese-simplified-singapore
chinese-simplified
chinese-traditional-hongkongsarchina
chinese-traditional-macausarchina
chinese-traditional
chinese
@ACCakut As I said, this is really out-of-scope for siunitx
: it's to do with how the supporting package translations
works
Yes, I fully understand this. This is a more general problem and babel/polyglossia respectively translations perhaps should somehow give fallback languages for those variants.
Interestingly, there is still some kind of bug:
Everything works fine with british
or UKenglish
instead of ukenglish
. I wanted to complain, why siunitx does not follow the behaviour of most other packages to use the last recognized language and \documentclass[ngerman,english,ukenglish]
(with English as fallback) did not work. But it does for every other variant or misspelling I tried, it worked perfectly.
So using ukenglish (all in lower case) seems buggy. Fix is easy with british
or UKenglish
.
I am sure, that falls under the responsibility of translations, but I wanted to also share this with you.
I'm using siunitx version 2021-06-10.
The option [parse-numbers = false] does not work with \qtylist. The units are not displayed.
\qtylist{1;2;5}{\watt}
--> 1 W, 2 W and 5 W (CORRECT)\qtylist[parse-numbers = false] {1;2;5}{\watt}
--> 1, 2 and 5 (INCORRECT)The output of \qtyrange displays the text "(numerical range)", and additionally, with option [parse-numbers = false] units are not displayed.
\qtyrange{1}{5}{\watt}
--> 1 W to (numerical range) 5 W (INCORRECT)\qtyrange[parse-numbers = false]{1}{5}{\watt}
--> 1 to (numerical range) 5 (INCORRECT)