TeX - LaTeX Asked by user227621 on April 10, 2021
In the following MWE, "Lorem ipsum" should be light, but you get the regular weight.
%RequirePackage[2019/10/01]{latexrelease}
documentclass{article}
begin{document}
fontseries{l}fontfamily{NotoSans-TLF}selectfont Lorem ipsum
end{document}
The warning says:
LaTeX Font Warning: Font shape `OT1/cmr/l/n' undefined
(Font) using `OT1/cmr/m/n' instead on input line 6.
Apparently, LaTeX tries OT1/cmr/l/n (which doesn’t exist), substitutes OT1/cmr/m/n, and finally you get OT1/NotoSans-TLF/m/n.
If you use RequirePackage[2019/10/01]{latexrelease}
(this cancels the NFSS changes of LaTeX 2020-02-02), you get the light series as expected.
Further observations:
fontseries{sb}
, you get b
instead.fontseries{c}
, you get m
instead.ul
, el
, m
, b
, eb
or ub
, you get the requested font series. (This is very confusing because e. g. OT1/cmr/ul/n doesn’t exist either)fontfamily{NotoSans-TLF}fontseries{l}selectfont Lorem ipsum
instead, you get the requested font series.Font attributes are changed in the order
fontencoding
fontfamily
fontshape
fontseries
fontsize
So what happens with your input is that first the shape is changed to l
, which Computer Modern hasn't, so it's substituted with the default m
.
Using the proper order the output is as expected:
documentclass{article}
begin{document}
fontfamily{NotoSans-TLF}fontseries{l}selectfont Lorem ipsum
end{document}
Most important is to have the family declaration at the beginning, because this will cause LaTeX to read the font definition file (if not already done) so the possible other attributes are known.
Correct answer by egreg on April 10, 2021
The difference between the ul
and the l
series is that the LaTeX kernel has a rule for the m/l
switch:
DeclareFontSeriesChangeRule {m}{l}{l}{m}
This rule means that if m
(first argument) is the current series, and l
is requested (second argument) then l
is tried (third argument) and if it doesn't exist the series falls back to m
(fourth argument).
As egreg wrote, you are trying to change the series while cmr
is still active, and so, as it has no l
-series, m
is forced.
You can get a similar effect for ul
if you declare a rule for it too:
documentclass{article}
begin{document}
{ fontseries{ul}fontfamily{NotoSans-TLF}selectfont Lorem ipsum }
DeclareFontSeriesChangeRule {m}{ul}{ul}{m}
{ fontseries{ul}fontfamily{NotoSans-TLF}selectfont Lorem ipsum }
end{document}
You can avoid the fallback to m
by removing the fourth argument from the rule:
documentclass{article}
DeclareFontSeriesChangeRule {m}{l}{l}{}
begin{document}
fontseries{l}fontfamily{NotoSans-TLF}selectfont Lorem ipsum
end{document}
Answered by Ulrike Fischer on April 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP