MathJax 样式
我对此很困惑。我搜索了教程,但找不到任何对我来说有意义的教程,如何为 MathJax 输出设置 CSS 类?我只是想让字体变大。当前的包含位置是:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
在我的页面底部。渲染 TEX 很好,但我想在上面设置一些 CSS!
理想情况下,我想将 CSS 类名传递给它。
I'm so confused about this. I've searched for tutorials but can't find any that make much sense to me, how do I set a CSS class for MathJax output? I just want to make the font big. The current include is:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
At the bottom of my page. Renders TEX fine, but I'd like to set some CSS on it!
Ideally I'd like to pass a CSS class name to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过在输出处理器中设置
scale
选项?请参阅手册。您可以在文件中或内联中设置配置选项; 此页面介绍了整个过程。基本上,您可以在页面或包含的文件中包含一小段 JavaScript。示例:
此外,您可以简单地将应用的 CSS 类包围在
div
中。在此页面上查看源代码。该方程将简单地继承字体大小。
Have you tried setting the
scale
option in your output processor? See the manual. You can set the configuration options either in a file or inline; this page covers the process.Basically, you include a short snippet of JavaScript in your page, or in a file you include. Example:
Also, you can simply surround the thing in a
div
with a CSS class applied. View the source on this page.The equation will simply inherit the font size.
更新:
据我所知,不要使用 CSS 在 mathjax 中设置 TeX 样式,这可能会导致显示问题。请参阅此处: https://github.com/mathjax/MathJax/issues/925
解决方案是将 Javascript 与配置块:
已过时:
我使用 JQuery 的 getScript() 动态加载 MathJax,仅在页面上存在
$$
的情况下。在这种情况下,上述解决方案不起作用。解决方法是在加载发生后设置 CSS:
您还可以使用
px
或em
来代替%
中的字体大小。如果这不起作用,请对您的 CSS 样式使用 !important。例如:
Update:
As I have learned now, do not use CSS to style TeX in mathjax, it could lead to display problems. See here: https://github.com/mathjax/MathJax/issues/925
Solution is to use Javascript with the Config block:
Obsolete:
I am loading MathJax dynamically with JQuery's getScript(), only in case there are
$$
on the page. In this case the solution above does not work.The workaround is to set the CSS after the loading took place:
Instead of the font size in
%
you can also usepx
orem
.If this does not work, use !important for your CSS styles. For instance: