How to change MathJax Style?

I want to change the text-align of MathJax from centre to left, so I use CSS snippets as below:

mjx-container[jax="CHTML"][display="true"] {
display: block;
text-align: left;
}


But it doesn’t seem to work.

How can I apply my code?

Two ways, both I just tested successfully.

Option #1 - Use a more precise selector:

div.math mjx-container[jax="CHTML"][display="true"] {
display: block;
text-align: left;
}


Option #2 - forcibly override the setting:

mjx-container[jax="CHTML"][display="true"] {
display: block;
text-align: left !important;
}


Overriding is the brute force answer but it becomes rather messy when dealing with many styles since it breaks inheritance.

1 Like

Thank you very much for your help!

The option #1 doesn’t work for me. I don’t know where goes wrong, maybe influenced by other snippets.

And the option #2 solves the problem!

Just out of curiosity, where abouts are you going to edit MathJax?

It works! One more question, how can I change the font of the equations, say, to Neo Euler?
The list of fonts supported by MathJax can be found at: MathJax Font Support — MathJax 3.2 documentation

1 Like