问题
I am using mathjax on my page, and i have read that this:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": { scale: 175}
});
</script>
Is supposed to make fonts bigger. But instead, all it does, is that it makes the container of mathjax equations bigger, but the fonts stay the same. Why is that? How to change font size?
回答1:
Well if you need a global re-size, here's how I did it through CSS.
.MathJax {
font-size: 1.3em;
}
I used 1.3 em, you can change it to better suit your needs.
回答2:
You can change the size of the formulas globally if you load mathjax/latex in this way:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
CommonHTML: {
scale: 130
}
});
</script>
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
回答3:
Use \tiny{ }, \scriptsize{ }, \small{ }, \normal{ }, \large{ }, \Large{ }, \LARGE{ }, \huge{ }, \Huge{ }.
回答4:
When you have some math inside a div:
<div id="some_math"> $$ x^2 $$</div>
you can change the font size simply by using CSS like this:
$("#some_math").css("font-size","150%");
回答5:
Seems like the <span> tag works for inline font adjustment:
<span style="font-size:2.1em; line-height:0%">$a-b$</span>
should nicely render "a-b" for Times font-family at 14px font-size.
回答6:
I tried numerous things, including modifying config/default.js
http://docs.mathjax.org/en/latest/options/index.html
or mathjax.js, none of them worked (I use Drupal 6 and therefore had to revert to MathJax 1.1)
Finally, based on Wojciech's answer, I found something that worked. Simply surround the Math code with a div like that:
<div style="font-size: 133%;">
<p>\begin{equation} \frac{\partial e_b}{\partial x^b} = \Gamma_{ab}^k e_k \end{equation}</p>
</div>
回答7:
You should add this to your CSS.
.MathJax_CHTML {
font-size: 25px !important;
}
回答8:
Here are two options to change font size for a specific equation or portion of an equation.
Use a .css class.
\class{className}{}
The className is div class name that can be specified in css.
- Use Latex
\tiny{ }, \scriptsize{ }, \small{ }, \normal{ }, \large{ }, \Large{ }, \LARGE{ }, \huge{ }, \Huge{ }
If you want to change all equations globally MathJax prints inside of a div. Use css to edit the class font size.
.MathJax {
font-size: 12pt;
}
Finally if you could also edit the MathJax config to change fonts globally, but I prefer the css version because it allows you change font sizes for different screen sizes.
回答9:
Do not use css as the others are suggesting, especially if in combination with linebreaking. Mathjax calculates how much space it requires for linebreaking, so if you change its size afterwards, you can get chaotic results(overfloww, bad breaking, clipping etc)
Do it throught config or MML/Tex
Styling MathJax
来源:https://stackoverflow.com/questions/19086152/changing-mathjaxs-font-size