当前位置: 首页 > 知识库问答 >
问题:

前端 - 如何让mathjax里面的inline math不换行?

卫浩瀚
2024-10-09

使用2.7版本的mathjax,inlineMath可以很好的显示,全部显示在一行。

   <!DOCTYPE html>
   <html>
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
   <script type="text/javascript" async
     src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
   </script>
   <script type="text/x-mathjax-config">
   MathJax.Hub.Config({
     tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
   });
   </script>
   </head>
   <body>
   First of all, we can "relax" the $\forall$-Introduction rule (page 31): $A \to B \vdash A \to \forall x B$, provided that $x$ is not *free* in $A$.
   </body>
   </html>

image.png

现在,我做了个版本升级,并且将mathjax部署在本地。
git clone https://github.com/mathjax/MathJax.git mathjax
然后将mathjax目录全部复制到本地的apache根目录中。

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script type="text/javascript">
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']]
      }
    };
    </script>
<script type="text/javascript"
  src="http://127.0.0.1/mathjax/es5/tex-chtml.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
First of all, we can "relax" the $\forall$-Introduction rule : $A \to B \vdash A \to \forall x B$, provided that $x$ is not *free* in $A$.
</body>
</html>

再用浏览器打开

image.png

不能一行显示了!
请问,如何解决?
反复测试过,下载2.7.7,2.7.9版本的mathjax到本地,全部都一行显示。
3.2.0,3.2.1.3.2.2的版本,都有这个问题,如何解决呢?

image.png

共有1个答案

广宏远
2024-10-09

我用 master 分支应该是 3.2.2 测试了是正常的:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script type="text/javascript">
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']]
      }
    };
    </script>
<script type="text/javascript"
  src="./es5/tex-chtml.js?config=TeX-MML-AM_CHTML">
</script>
<style>
.it {
    display: inline-block;
    font-style: italic;
}
</style>
</head>
<body>
    First of all, we can "relax" the $\forall$-Introduction rule : $A \to B \vdash A \to \forall x B$, provided that $x$ is not <div class="it">free</div> in $A$.
<p>$\displaystyle \begin{aligned}
\dot{\mathscr{E}}  &=  \sum_{\Gamma} \left[\,f(\underset{\Gamma}{\lambda}) \underset{\Gamma}{\vec{N}} \underset{\Gamma}{\vec{N}}\,\right]^{\bullet} \\
&=  \sum_{\Gamma} \left[\,f'(\underset{\Gamma}{\lambda}) \dot{\underset{\Gamma}{\lambda}} \underset{\Gamma}{\vec{N}} \underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \dot{\underset{\Gamma}{\vec{N}}} \underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \underset{\Gamma}{\vec{N}} \dot{\underset{\Gamma}{\vec{N}}}\,\right] \\
&=  \sum_{\Gamma} \left[\,f'(\underset{\Gamma}{\lambda}) \dot{\underset{\Gamma}{\lambda}} \underset{\Gamma}{\vec{N}} \underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \underset{IJ}{\vec{\Omega}}\underset{I}{\vec{N}}\underset{J}{\vec{N}} \underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \underset{\Gamma}{\vec{N}} \underset{IJ}{\vec{\Omega}}\underset{I}{\vec{N}}\underset{J}{\vec{N}}\,\right] \\
&=  \sum_{\Gamma} \left[\,f'(\underset{\Gamma}{\lambda}) \dot{\underset{\Gamma}{\lambda}} \underset{\Gamma}{\vec{N}} \underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \underset{I\Gamma}{\vec{\Omega}}\underset{I}{\vec{N}}\underset{\Gamma}{\vec{N}}  +  f(\underset{\Gamma}{\lambda}) \underset{J\Gamma}{\vec{\Omega}}\underset{\Gamma}{\vec{N}}\underset{J}{\vec{N}}\,\right] \\
\end{aligned}$</p>

<font color="red">
    <p>$\dot{\vec{E}}  =  \vec{F}^T \cdot \vec{d} \cdot \vec{F}$</p> 阿巴阿巴阿巴
</font>
</body>
</html>
 类似资料:
  • 10.9 18:30 15分钟 为什么实习没留在阿里云 秋招为什么不考虑云那边 自我介绍 最有代表性的项目 最大的挑战 有什么还需要提升的地方 如何去学习一门新技术的 有没有一些技术沉淀,可以搜到吗? 有没有一些其他的秋招流程 如果发offer的话,能不能来实习#面经##秋招##校招#

  • 部门:阿里妈妈 总结:电话面,答得都挺好的,但是才半个小时就结束了我感觉被kpi了,但是面试官看了我的github,又不像kpi了 大都是常见八股,干脆只写比较难的 1.不借助js如何实现html原生懒加载(搜不到,好像就这个没答上来) 2.Symbol的介绍,使用场景,获取原来可能存在的symbol怎么做(symbol.for) 3.双等号,三等号,object.is()的区别

  • 只记得一些没回答出来和答的不好的问题,常规八股就不记录了。 8.25一面(40min) 1.Async awit的理解  答:Generator的语法糖,主要是改进Promise缺陷的异步方案……。 问:Generator怎么用的,怎么实现的?(。。。) 2.CommonJs ESM之间的区别 答:浅引用,import expire等。 问:export有什么区别吗?(。。。) 3.vue2是怎么

  • 自我介绍 Array.sort的实现原理?快排讲一下 知道Sleep吗怎么实现? 用过promise吗?说下原理? 普通函数和箭头函数区别 Let,const和var的区别 怎么在ul里面插入li css权重怎么判断?用过not么 说下盒子模型 position的属性及含义?如果absolute外面再包一个absolute,是什么效果? 做过移动端么?Rem 和 em的区别?vm和vh时什么 ht

  • 40分钟,还是电话面,纯聊实习,0八股 1. 自我介绍 2. 讲一下你历段实习最有挑战性的项目 3. 讲一下你最近一次实习的项目 4. js里对象如何合并 -- 扩展运算符,Object.assign() 5. 怎么可以设置对象里的属性不可修改 -- defineProperty,Proxy 6. React生命周期 7. 面试官猛和我探讨实习项目里有关forwardRef的细节,lz这里被问住了

  • 电话面试,1个小时,没考代码,问了半个多小时实习项目 1. 自我介绍 2. 看你实习很多,方向也不同,能说说iOS开发和React开发的区别嘛? 3. Objective-C和React又有什么区别? 4. 都是前端语言,前端布局有什么区别? 5. 讲一讲最近实习的项目吧 6. Flex布局 7. 讲一下async-await和generator的关系 8. yield和return的区别 9.