Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My question is based on the example which may be found here in teh second answer. Actually, I discovered this feature of unicode-math some time ago, but suspected that I am doing something wrong.

Setting the color of the math font using \setmathfont changes the color of all letters and symbols but not of the horizontal lines in fracions, square roots, etc. It is rather unexpected behavior. The question is, whether this is a bug or feature. And, if it is a feature, how to change the color of these elements?

Minimal strangely working example:

\setmathfont[Color=FF0000]{XITS Math}

A bunch of text, then an equation.
 N^2 = -\frac{g}{\rho_0} \frac{\partial \rho}{\partial z} ,\;\;\;\;
 N = \sqrt{-\frac{g}{\rho_0} \frac{\partial \rho}{\partial z}}

Produces the following result for me: enter image description here

share|improve this question

2 Answers 2

XeTeX font color feature only colors glyphs of the specified font, intervening non-glyph material is not affected, and the fraction and radical rules here is an example of such material (they are horizontal rules drawn by TeX and not font glyphs).

To color the whole equation you have to use general text coloring packages.

share|improve this answer
Ok. If this is a feature, what is the purpose in Color argument of setfont command if it can not be used in real life? It seems a bit irrational. –  Misha Jul 28 '12 at 3:44
And, if you know a lot of general text coloring packages, could you recommend one which is consistent with amsmath environments? –  Misha Jul 28 '12 at 4:26
@Misha, AFAIK, font colors was introduced as way to do text coloring without using driver specials and whatsit nodes (the way other color packages work, since TeX itself knows nothing about colors) which can affect the typeset text, the fact it is not very usable for math because of the use of rulers is an unfortunate side effect. I don’t know much about pros and cons of various LaTeX color packages, sorry. –  Khaled Hosny Jul 28 '12 at 10:40

I use this to create white equations with transparent background:


Edit: the empheq package is not necessary, my bad.

share|improve this answer
\everymath and \everydisplay have nothing to do with empheq so your answer is a bit misleading. –  Misha Jul 28 '12 at 3:47
This just works. Why isn’t this the accepted answer and has no upvotes so far? –  erik Feb 5 at 16:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.