Closed tweh closed 3 years ago
One of the things here that is tricky is that the 'core' LaTeX set up only offers two weights, and it's not easy to know how to fully handle other cases. For example, what happens for math mode if we detect xb
? There is not \xboldmath
or similar ... As you might guess, the original approach (before \lseries
got added) was entirely based around what is available in CM/'out of the box' LaTeX.
Of course, one then gets into the entire business that math mode is tricky when you start worrying about weight and shape: depending on you background, this may be something you don't vary as part of design but as part of semantics. (I'm not really from that background.)
Probably you are correct in that in cases where people use xb
or similar it's reasonable to do ones best to pick them up. Any idea if any of the above set \maht@version
or indeed whether to extend support in that area?
(BTW, for v3 I'm likely to use an approach which will work rather differently at the low level here, but where the outcome should be much as you suggest.)
Actually, I wonder if I might be best using the new approach here anyway: I'll do some tests and see if I can get it to come off!
Hi,
I absolut understand your concerns about math. How about setting things up to work out of the box with the two weights, but having the possibility to detect other weights to. E.g.
\mdseries
is detected: usual behaviour (as it is at the moment) + activate \mdseriesmath
(see below; but without warning if not defined)\bfseries
is detected: usual behaviour (as it is at the moment) + activate \bfseriesmath
(see below; but without warning if not defined)xx
) is detected:
\xxseries
\xxseriesmath
is defined\xxseriesmath
(could be defined as \let\xxseriesmath\boldmath
or \def\xxseriesmath{\mathversion{xx}}
etc.)\xxseriesmath
found. Please define it” (with a new package option to suppress these warnings).In that case the user could decide wether a math version is changed or not (depending on if bold math has another meaning in his document or not).
Imho one should also consider the case that users want the font(series) inside math to follow the mathversion even if they use the text font to print the unit. That means that
\sisetup{mode=text,detect-weight-or-mathversion,...}
$ \SI ... $
should use a font \mathnormaltextfont
or \mathboldtextfont
depending on the math version and not on the outside \f@series.
The v3 code should work here in text mode: as it works by only altering what is needed, turning off control of weight will preserve weight 'as given' in text mode. Matching to math mode is more tricky: some discussion with@u-fischer suggests that should be handled separately anyway!
Nice to hear. Thanks!
This is working in v3 with LuaTeX, largely because the approach to font control is entirely re-written. For some reason it's not currently happy in XeTeX, so I'll leave open for the present and try to track down (I suspect 'not my fault' though).
As noted in other issues, I'm planning a release somewhere around the turn of the year, thought there will likely be an alpha soon-ish. Feedback on the font control options/outcomes will be welcome when I do that!
Now sorted in XeTeX too: I'm closing on the grounds v3 will sort this.
Just a general comment not related to siunitx but to the FontFace mappings:
I'm currently hard working on getting back to standard names across NFSS because only if everybody uses the same set as series values exchanging one font with another works well and the tools like siunitx can then map things. All fonts produced through autoinst (which is the majority are now back to that and I hope that the few remaining j k t etc
"lt" is not the name for light it is "l"!
Full official set is ul el l sl m sb b eb ub (ultra-light to ultra-bold)
@FrankMittelbach Thanks: I'll adjust the siunitx
code to recognise this set
as I said elsewhere it is unfortunately not that easy because of the (bad) decision I made long ago:
if the weight is "m" (medium) then this "m" is dropped if the width is not "medium" too, so
medium weight condensed is not mc (as it should have been) but "c" and so on
so if the weight is "m" then you see only the width in \f@series in other words
uc ec c sc m sx x ex ux
sorry but 30 years ago every byte was precious to fit into the available memory.
I can make this work!
sure, no doubt. just saying what the expected logic is
At the moment the test to detect the font weight ist done by checking for the first letter of
\f@series
, which works if the document uses only\mdseries
and\bfseries
. For an additional use of a list shape it works as long as it is named\lseries
(I prefer\ltseries
, since other weights have two letters as well). However if the document uses more than these weights the test must fail unfortunately.Here’s an example using Open Sans (free) and
fontspec
to access all weights. It also includes an alternative definition of\__siunitx_detect_font_weight_text:
that works in my test document but maybe has some disadvantages I can’t see at the moment.See also siunitx does not detect semi-bold font on TeX.SX.