Closed hubutui closed 6 years ago
Good question :)
It would take longer than I have to investigate if there’s a way to solve this within unicode-math
; in the mean time you should be able to get the results you need by not setting the colour in the font and instead writing
\color{red}
before the maths.
As @wspr said it might be tricky to fix this (or it might just be better to document it)
If you colour using a font setting then only that font gets coloured, other fonts, and rules drawn by Tex without using a font, are not coloured. The fraction bar does not use a glyph from any font: it is a line drawn directly by TeX. Possibly unicode-math could check if the main math font is coloured and if so essentially add \color{the same color} at the start of the math, perhaps... Although that would have other side effects such as colouring text in other fonts such as \textit{...} which would not normally be coloured if colour is only specified for specific fonts.
\documentclass{article} \usepackage{xcolor} \usepackage{unicode-math} \setmathfont[Color = red]{XITSMath} \begin{document} [ f(x) = \frac{1}{x}. ] \end{document}
output:
Why the line in the fraction is not in red?