latex转成mathml_使用MathML或LaTeX和MathJax探索跨浏览器的数学方程

latex转成mathml

latex转成mathml

Let me just start by saying that I got a C in Calculus. It just didn't click for me. I'm aces at basic math, but you lost me at limits. That said, I have always found MathML to be fascinating, and I'm surprised that even now over 15 years after MathML's first release that is has such minimal browser support. Other than Firefox, and surprisingly iOS Safari, there's basically no widely available native support.

首先,我要说的是我在微积分中获得了C。 它只是没有点击我。 我在基础数学上是王牌,但是你却迷失了我。 就是说,我一直觉得MathML着迷,令我感到惊讶的是,即使在MathML的第一个发行版之后的15年中,它对浏览器的支持也是如此之小。 除了Firefox和令人惊讶的iOS Safari,基本上没有广泛可用的本机支持。

Perhaps it's because MathML is, well, XML. You wanna express something simple like 2+2, except stacked up with a line? Here's that:

也许是因为MathML是XML。 您想表达2 + 2之类的简单内容,除了用一条线叠起来吗? 就是这样:

<mstack>
<mn>2</mn>
<msrow> <mo>+</mo> <none/> <mn>2</mn> </msrow>
<msline/>
</mstack>

That's rather verbose. Most math folks that I've talked to (including a very nice Stanford professor I met on a plane recently) use LaTeX to express Math. The professor I met edited whole academic papers in raw LaTeX and compiled them to PDF. He was surprised when I explained that he was a programmer but perhaps didn't realize it!

太冗长了。 我与之交谈的大多数数学人员(包括我最近在飞机上遇到的一位非常好的斯坦福教授)都使用LaTeX来表达数学。 我遇到的教授在原始LaTeX中编辑了整个学术论文,并将其编译为PDF。 当我向我解释说他是一名程序员但也许没有意识到时,他感到很惊讶!

LaTeX looks like this, for the 2+2 example:

LaTeX看起来像这样,例如2 + 2:

\(2+2\)

I'd show you some more complex MathML examples but it would get pretty crazy very quickly.

我将向您展示一些更复杂的MathML示例,但是它很快就会变得非常疯狂。

The landscape for writing equations easily online using either MathML or LaTeX is, from my untrained eye, rather chaotic, link-rotty, and messy. Many Math and MathML online resources are full of link rot or their apps have been forgotten. While looking for a MathML to LaTeX convertor I found four different sits that promised to deliver only to discover that their back end systems are gone.

从我未经训练的角度来看,使用MathML或LaTeX轻松在线编写方程式的环境相当混乱,链接混乱和混乱。 许多Math和MathML在线资源充斥着链接腐烂,或者它们的应用程序已被忘记。 在寻找将MathML转换为LaTeX的转换器时,我发现有四个不同的位置,它们承诺仅在发现它们的后端系统不见了时才交付。

It seems that there are two places online that are shining examples of online Math rendering and that's MathJax and Math.StackExchange.com. MathJax is "an open source JavaScript display engine for mathematics that works in all browsers" and Math.StackOverflow.com is well, StackOverflow for Math people. What's special about Math.SO is that it's integrated MathJax's fantastic library into it's main editor.

似乎在线上有两个地方是在线Math渲染的出色示例,分别是MathJaxMath.StackExchange.com 。 MathJax是“一种适用于所有浏览器的数学开源JavaScript显示引擎”,Math.StackOverflow.com很好,对于Math人来说是StackOverflow。 Math.SO的特别之处在于,它已将MathJax的出色库集成到其主编辑器中。

NOTE: Not all StackExchange sites have the integrated math preview due to the size of the libraries involves. It's not something that you just "throw in just in case."

注意:由于涉及的库大小,并非所有StackExchange站点都具有集成的数学预览。 您只是为了“以防万一”而已。

Here's an example where I'm typing some LaTeX into StackOverflow's site. In this case, I'm using Chrome.

这是一个示例,其中我在StackOverflow的站点中键入一些LaTeX。 在这种情况下,我正在使用Chrome。

image

They are using MathJax's library here. I can right-click on the equation, and ask "show math as MathML" and get this popup:

他们在这里使用MathJax的库。 我可以右键单击方程式,并要求“将数学显示为MathML”并显示以下弹出窗口:

image

How does MathJax manage all this without actual browser support for MathML (or LaTeX?)

在没有实际的浏览器支持MathML(或LaTeX)的情况下,MathJax如何管理所有这一切?

You configure MathJax like this, telling it what to look for when doing inline math. Sometimes it's bracketed by $ and $ and sometimes by \( and \).

您可以像这样配置MathJax,告诉它进行内联数学运算时要查找的内容。 有时用$和$括起来,有时用\(和\)括起来。

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
});
</script>
<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>

For Tex as in this example, MathJax is using HTML and CSS, generating the inline Math equations into a series of DOM elements.

对于本示例中的Tex,MathJax使用HTML和CSS,将内联Math方程生成一系列DOM元素。

image

When using MathML proper, you can configure MathJax to use native MathML rendering when it's available. Only FireFox really supports that. This page lets you switch between HTML-CSS using Web Fonts, MathML, or SVG. SVG looks a little rough to me, but HTML-CSS always looks nice.

正确使用MathML时,您可以将MathJax配置为使用本机MathML渲染(如果可用)。 只有FireFox真正支持。 该页面使您可以使用Web字体,MathML或SVG在HTML-CSS之间切换。 SVG对我来说有点粗糙,但是HTML-CSS总是很好看。

image

Bottom line, if you have a need to express mathematical equations of any kind online, you're going to want to use MathJax. Love them, thank them, appreciate them.

底线是,如果您需要在线表达任何形式的数学方程式,则需要使用MathJax 。 爱他们,感谢他们,感谢他们。

NOTE via Wikipedia: The MathJax project was founded by the American Mathematical Society, Design Science, and the Society for Industrial and Applied Mathematics and is supported by numerous sponsors such as the American Institute of Physics and Stack Exchange.

通过Wikipedia进行的注释: MathJax项目由美国数学学会设计科学学会以及工业和应用数学学会创立,并得到了众多赞助商的支持,例如美国物理研究所Stack Exchange

Oh, and if you're English, "Maths."

哦,如果您是英国人,那就是“数学”。

翻译自: https://www.hanselman.com/blog/exploring-crossbrowser-math-equations-using-mathml-or-latex-with-mathjax

latex转成mathml

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值