1

The solution in the post https://tex.stackexchange.com/a/100625 is highly efficient. Unfortunately it can not be used with unicode-math, which erases the individualized symbol colors. While unicode-math does allow individual symbol coloring via \setmathfont, if too many symbols are independently colored in this way, the source will not compile.

Is there any way to make the \colorizemath code (linked above) compatible with unicode-math ?

  • If you have an example that fails in unicode-math, please submit a bug in the issue tracker: github.com/wspr/unicode-math/issues . I'm not surprised you run into problems, but I might be able to develop an alternative interface if I can see what you're trying to do. – Will Robertson Aug 30 '18 at 1:52
  • Honestly I cannot tell whether this is a bug, or an abuse of the package by yours truly. I have been using \setmathfont one glyph at a time to individualize colour etc. If \setmathfont is called more than a handful of times, the symbol font limit is exceeded; hence the source does not compile. If unicode-math wants to allow dozens of characters to be customized, one \setmathfont by one, I will happily submit a bug. Unicode-math continues to be my favourite package, with its prints all over documents like dropbox.com/s/m95ta9o6ac0l8wg/Project1Report_BenBarlow.pdf?dl=0 – Benjamin Barlow Sep 6 '18 at 5:39
  • Nice example! Probably one glyph at a time is excessive, but I see you are using lots of difference colours :) – Will Robertson Sep 6 '18 at 14:13
1

The following snippet causes the variable x to display blue in math mode without affecting its appearance in text mode. Further, it seems to get along well with unicode-math. (This snippet can be extended to independently colour many symbols, and it compiles rapidly.)

\begingroup
\lccode`~=`x
\lowercase{\endgroup
    \def~{{\color{blue}\symnormal{x}}}%
 }%
\mathcode`x="8000

(Code modified from https://texfaq.org/FAQ-activechars)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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