To get smaller text in your document, it is much better to change the normal font size instead of scaling all unicode fonts. So instead of
\defaultfontfeatures{Scale=.5}
just replace \documentclass[12pt]{scrreprt}
with \documentclass[6pt]{scrreprt}
.
Now let's assume that you can not do this for some reason. The problem is the line
\setmathfont{LucidaBrightMathOT.otf}[NFSSFamily=lbm]
unicode-math
loads multiple variations of the specified font to set legacy math parameters, but with the NFSSFamily
option every font uses the same NFSS family name, so every font overwrites the previous ones. This means only last font is really used, but the last font overwrites the scaling option in order to become a different font. In addition to the scaling problem, this might also lead to wrong math parameters.
To fix this unicode-math
should only pass the NFSSFamily
option when loading the main font.
This can be archived by using \patchcmd
from etoolbox
to patch the font loading macros from unicode-math
:
\documentclass[12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage{chemmacros}
\usechemmodule{all}
\chemsetup{greek = {fontspec}}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{etoolbox}
\ExplSyntaxOn
\keys_define:nn{unicode-math}{
NFSSFamily .tl_set:N = \l__my_um_nfssfamily_tl
}
\patchcmd \__um_fontspec_select_font: {
\l__um_family_tl {\l__um_font_keyval_tl}
}{
\l__um_family_tl {NFSSFamily={\l__my_um_nfssfamily_tl},\l__um_font_keyval_tl}
}{}{\GenericError{}{Something~broke}{}}
\ExplSyntaxOff
\defaultfontfeatures{Scale=.5}
\setmainfont{LucidaBrightOT.otf}
\setmathfont{LucidaBrightMathOT.otf}[NFSSFamily=lbm]
\ExplSyntaxOn
\cs_set_protected:Nn \chemgreek_text:n
{ \ensuremath { \text {\fontfamily{lbm}\selectfont #1} } }
\ExplSyntaxOff
\begin{document}
Blindtext $a_i=5$ blindtext.
\printchemgreekalphabet $\upalpha$ $\alpha$ \chemalpha
\end{document}
$a_i=5$
is too large.