Mathjax extension for color of font

575 Views Asked by At

Following this page, I try to set a color for a simple equation into a div container.

Here is an example on this jsfiddle link

It seems that equation (and so color) is not interpreted and I don't know how to make it rendered.

JS :

 MathJax.Hub.Config({
messageStyle: "none",
TeX: { equationNumbers: {autoNumber: "all"}},
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], 
displayMath: [ ['\\begin{displaymath}','\\end{displaymath}'], ['\\begin{equation}','\\end{equation}'] ],
processEscapes: true,
preview: "none"
}});

MathJax.Hub.Config({ TeX: { extensions: ["color.js"] }});

HTML :

<div id="containerMath">
$\definecolor{energy}{RGB}{0,0,172}
\color{energy} ax+b=c$
</div>

Anyone has already experimented colors for Mathjax fonts ?

1

There are 1 best solutions below

0
On BEST ANSWER

You need to specify the type of the script tag as text/x-mathjax-config where you are defining you mathjax config

eg:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({ TeX: { extensions: ["color.js"] }});
</script>

updated fiddle: https://jsfiddle.net/18vyyvrk/28/ EDIT: in the fiddle I also changed the script to load onDomready