latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
246 stars 29 forks source link

Why is not this fraction in red with font feature [Color = red]? #362

Closed hubutui closed 6 years ago

hubutui commented 8 years ago

\documentclass{article} \usepackage{xcolor} \usepackage{unicode-math} \setmathfont[Color = red]{XITSMath} \begin{document} [ f(x) = \frac{1}{x}. ] \end{document}

output: fraction

Why the line in the fraction is not in red?

wspr commented 8 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.

davidcarlisle commented 8 years ago

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.