在MathJax中相对于文本方向缩放 [英] Scaling in MathJax with respect to text direction

查看:124
本文介绍了在MathJax中相对于文本方向缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用阿拉伯语的网站(默认文本方向为从右到左"),我对阿拉伯文本使用"Noto Naskh Arabic"字体,对拉丁文本使用Latin-Modern通过以下CSS代码定义:

I'm working on a site which is in Arabic (default text direction is "right to left") and I'm using "Noto Naskh Arabic" font for arabic text and Latin-Modern for latin text which I'm definig by the following css code:

*[dir="ltr"] {
        font-size: 20px !important;
        font-family:"Latin-Modern";
}

用户可能需要输入数学方程式,为此我正在使用"Mathjax",问题是:

Users may need to enter mathematical equations and I'm using 'Mathjax' for this purpose, the problem is that:

  1. 分数线不显示水平线
  2. 在我写阿拉伯文和拉丁文段落时,方程显示为不同大小

  1. Fractions are displayed without the horizontal line
  2. Equations are displayed with different sizes between arabic and latin paragraph as when I write

我已经解决了使用CSS的第一个问题

I have come to a slution to the first problem using css

span:lang(ar).MathJax { 
    direction: ltr !important;  
    font-family:"Latin-Modern";
    }

对于第二个问题,我需要知道是否有一种方法可以自动为阿拉伯文段落中嵌入的方程式和英文段落中嵌入的方程式分别指定比例.

For the second problem, I need to know if there is a way to automatically specify scale separately for equation which are embedded in Arabic paragraph end those embedded in English paragraph.

推荐答案

似乎主要的问题是必须首先扩展.我猜你是这么做的,因为MathJax在RTL上下文中渲染太大.

It seems like the main issue is that you have to scale in the first place. I'm guessing you did that because MathJax is rendering too large in RTL contexts.

MathJax似乎在检测周围字体的正确ex-height时遇到问题.这可能是由各种问题引起的,从字体高度不正确到CSS交互不良.通过快速测试,它不是字体.

It looks like MathJax is having issues detecting the correct ex-height of the surrounding font. That can be caused by various problems, from fonts not having a correct ex-height to bad CSS interactions; from a quick test it's not the fonts.

作为解决方法,您可以在MathJax配置中禁用字体匹配

As a workaround you can disable font matching in the MathJax configuration

MathJax.Hub.Config({
     "HTML-CSS": {matchFontHeight: false},
     SVG: {matchFontHeight: false},
     CommonHTML: {matchFontHeight: false}
});

然后,您还应该禁用所应用的缩放比例.

You should then also disable the scaling you applied.

这篇关于在MathJax中相对于文本方向缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆