在使用jqMath编写数学时,我需要突出显示数学问题的特定部分。
/* specific to override border bottom important jqMath adds */
fmath td.redunderline {
border-bottom: #a20000 1px solid !important;
}
fmath td.redunderline .math-sum.red{
border-bottom: 0 !important;
}
/* colorizes numerator and denominator */
.math .red-num .fm-num-frac,
.math .red-den .fm-den-frac {
color: #a20000;
}
/* Colors for fractions in browsers that support MathML */
.math mfrac.red-num mn:nth-child(1),
.math mfrac.red-num mrow:nth-child(1),
.math mfrac.red-den mn:nth-child(2),
.math mfrac.red-den mrow:nth-child(2) {
color:#a20000;
}除非我在jqMath表中,否则所有这些都很好用。
$\table
{5x+4},=,49;
\html '<span class="red math-sum">−4</span>', ,\html '<span class="red math-sum">−4</span>';
{5x \html '<span class="red">+ 0</span>'},=,\html '<span class="red"> 45 </span>';
5x,=,45;
{\html '<span class="red-den">'{{5x}/5}\html '</span>'},=,{\html '<span class="red-den">' {45/5} \html '</span>'};
x,=,\html '<span class="red">9</span>';$这是没有格式化分母的行:
{\html '<span class="red-den">'{{5x}/5}\html '</span>'},=,{\html '<span class="red-den">' {45/5} \html '</span>'};如果我没有对这条线进行分组,jqMath将不会处理它,仍然会显示大括号,等等。如果我对这条线进行了分组,我得到了一个数学问题,但是跨度中的颜色被放到了另一个隐藏的行中,而不是我想要的数字换行。
我考虑过使用jQuery来添加样式,但是我无法在我想要添加类的位置标记HTML.因为jqMath不会将样式放在所需的位置,而且这需要足够通用,以便我可以添加标记或样式来为页面带来所需的效果。将jQuery添加到每个数学问题不是一种选择。
当然,我可以使用常规的html表(和have)来做这件事,但是我想把所有的数学问题放在一起,看起来像是一道数学题,以便将来校对。此外,将问题放在表中只会给页面添加不必要的标记,增加页面下载时间。
理想的解决方案是告诉各个行如何设置自身的样式。
发布于 2013-05-03 07:58:33
\html创建一个完整的元素,而不仅仅是一个开始或结束标签。
正如您所说,最好的解决方案是将CSS类或is添加到特定的数学子表达式。jqMath highlight box like bbox in MathJax/MathJs的答案说明了如何做到这一点。
如果您改为使用<fmath>样式,请注意这个“伪数学”标记不会在拥有原生MathML的浏览器中使用- jqMath使用标准的<math>标记。
https://stackoverflow.com/questions/16347577
复制相似问题