1、在网站根目录新建/upimages/
2、将images.rar在upimages内解压到当前文件夹
3、将MLCore-2016.08.15.min.js引入到页面内<head>
4、在页面最底部加入js调用代码
<script type="text/javascript">
$(function () {
$(".quesborder,.JYE_MATH_SELECTOR").each(function () {
try {
renderLatex(this);
} catch (e) { }
});
});
</script>
5、注意上面代码中 .quesborder,.JYE_MATH_SELECTOR 是页面样式的名称,这是你显示试题最近的外层的元素,需要根据你的实际名称调整
例如:页面是<div class='test'>试题代码........</div> ,那么上面的.quesborder,.JYE_MATH_SELECTOR就应该改为test
6、添加统一的样式控制:
<style>
.MathJye table{
border-collapse: collapse;
margin: 0;
padding: 0;
text-align: center;
vertical-align: middle;
line-height: normal;
font-size: inherit;
_font-size: 100%;
font-style: normal;
font-weight: normal;
border: 0;
float: none;
display: inline-block;
zoom: 0;
}
table.edittable
{
border-collapse:collapse;
text-align:center;
margin:2px
}
table.edittable td,table.edittable th
{
line-height:30px;
padding:5px;
white-space:normal;
word-break:break-all;
border:1px solid #000;
vertical-align:middle
}
table.composition
{
border-collapse:collapse;
text-align:left;
margin:2px;
width:98%
}
table.composition td,table.composition th
{
line-height:30px;
white-space:normal;
word-break:break-all;
border-width:0;
vertical-align:middle
}
table.composition2
{
border-collapse:collapse;
width:auto
}
table.composition2 td,table.composition2 th
{
ext-align:left;
line-height:30px;
white-space:normal;
word-break:break-all;
border:none;
border-width:0;
vertical-align:middle}
</style>
7、latex公式显示插件
<script type="text/javascript" async src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script type="text/javascript">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [["\\(", "\\)"]],
displayMath: [["$$", "$$"],["\\[", "\\]"]],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
网友评论