I want to display questions on my blog in red in color and answers in blue in color. In questions and answers I am using MathJax 2 to render MathML. I am controlling the coloring of MathJax using CSS like this.
h3, h2, h4, h5
{
text-align: left;
font-weight: bold;
font-family: Verdana;
}
.question
{
text-align: left;
color: Red;
}
.centerit
{
color: Blue;
text-align: center;
}
that works perfectly fine in IE, but in Firefox it always displays the MathJax in black color. Is there any workaround to resolve this issue?.
MathJax can display mathematical notation written in LaTeX or MathML markup. Because MathJax is meant only for math display, whereas LaTeX is a document layout language, MathJax only supports the subset of LaTeX used to describe mathematical notation.
KaTeX is purely about TeX/LaTeX input and HTML output, whereas MathJax also processes MathML and AsciiMath (two other math formats), and produces output not just in HTML but also SVG and MathML.
MathJax is a javascript display engine for rendering \TeX or MathML-coded mathematics in browsers without requiring font installation or browser plug-ins. Any modern browser with javascript enabled will be MathJax-ready.
Inline MathJaxTo start a formula you use either a dollar sign $ or you can use a slash an an open parentheses "/(". To end the inline math, you have another dollar sign or a back slash and a closing parentheses. Enclosing in double dollar signs put the math on its own line.
If you want to color different parts of an equation different colors (e.g. if you wanted to color-code variables), use \textcolor
command instead of \color
to avoid spacing issues.
See the difference:
Using \textcolor
(preferred):
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
$$
y = \textcolor{red}{\sin} x
$$
Using \color
(makes for incorrect spacing):
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
$$
y = \color{red}{\sin} x
$$
Colorized MathJax equations for improved readability demo: trigids.com.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With