是否有 javascript LaTeX 方程渲染器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3284131/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a javascript LaTeX equation renderer?
提问by Fletcher Moore
I am looking for a purely client side javascript library that renders latex equations as HTML/CSS. I hate that all I see are utilities that request an image from a server.
我正在寻找一个纯粹的客户端 javascript 库,它将乳胶方程呈现为 HTML/CSS。我讨厌我看到的只是从服务器请求图像的实用程序。
Example usage:
用法示例:
latex('\frac{a}{b}')
output:
输出:
<div style="position: relative; display: inline-block; height: 2em; width: 1em">
<div style="position: absolute; top: 0em">a</div>
<div style="position: absolute; top: 1em; border-top: 1px solid black">b</div>
</div>
I ask because if this does not exist I am considering writing it, perhaps as a jQuery plugin.
我问是因为如果它不存在我正在考虑编写它,也许作为一个 jQuery 插件。
采纳答案by Felix Kling
jsMathrenders TeX forumlas. It is also used by mathoverflow.netand the web interface of the mathematics software sage. I assume they know what they are doing ;)
jsMath呈现 TeX 论坛。mathoverflow.net和数学软件sage的 Web 界面也使用它。我假设他们知道他们在做什么;)
From the homepage:
从主页:
The jsMath package provides a method of including mathematics in HTML pages that works across multiple browsers under Windows, Macintosh OS X, Linux and other flavors of unix. It overcomes a number of the shortcomings of the traditional method of using images to represent mathematics: jsMath uses native fonts, so they resize when you change the size of the text in your browser, they print at the full resolution of your printer, and you don't have to wait for dozens of images to be downloaded in order to see the mathematics in a web page. There are also advantages for web-page authors, as there is no need to preprocess your web pages to generate any images, and the mathematics is entered in TeX form, so it is easy to create and maintain your web pages.
jsMath 包提供了一种在 HTML 页面中包含数学的方法,该方法可在 Windows、Macintosh OS X、Linux 和其他类型的 unix 下的多个浏览器中工作。它克服了使用图像来表示数学的传统方法的许多缺点:jsMath 使用本机字体,因此当您在浏览器中更改文本大小时,它们会调整大小,以打印机的全分辨率打印,并且您不必等待下载数十张图像才能在网页中看到数学。网页作者也有优势,因为不需要预处理您的网页以生成任何图像,并且数学以 TeX 形式输入,因此可以轻松创建和维护您的网页。
回答by Paul Topping
MathJax is an evolution of and replacement for jsMath by the same main developer, Davide Cervone, but with corporate backing. It is not built on top of jsMath but is essentially a re-engineering of it. It follows pretty much the same principles as jsMath but adds support for MathML and takes better advantage of modern browsers, webfonts, and JavaScript technology. While Davide will answer questions about jsMath, no future development will likely occur on it and its users are strongly encouraged to move to MathJax. My company, Design Science, is one of its backers.
MathJax 是由同一主要开发人员 Davide Cervone 对 jsMath 的演变和替代,但得到了公司的支持。它不是建立在 jsMath 之上,而是本质上是对它的重新设计。它遵循与 jsMath 几乎相同的原则,但增加了对 MathML 的支持,并更好地利用了现代浏览器、网络字体和 JavaScript 技术。虽然 Davide 将回答有关 jsMath 的问题,但它未来可能不会有任何发展,并且强烈鼓励其用户转向 MathJax。我的公司 Design Science 是它的支持者之一。
回答by Ciro Costa
Katex
凯泰克斯
Khan academy just released its open source Katex. It's very fast. IMO it is the best option right now.
可汗学院刚刚发布了它的开源Katex。它非常快。IMO 现在是最好的选择。
Fast: KaTeX renders its math synchronously and doesn't need to reflow the page.
Print quality: KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
Self contained: KaTeX has no dependencies and can easily be bundled with your website resources.
Server side rendering: KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
快速:KaTeX 同步呈现其数学,不需要重排页面。
打印质量:KaTeX 的布局基于 Donald Knuth 的 TeX,这是数学排版的黄金标准。
自包含:KaTeX 没有依赖项,可以轻松地与您的网站资源捆绑在一起。
服务器端渲染:无论浏览器或环境如何,KaTeX 都会产生相同的输出,因此您可以使用 Node.js 预渲染表达式并将它们作为纯 HTML 发送。
回答by duffymo
回答by chepukha
回答by Beowulfdgo
The existing softwares have very different speeds. Other softwares I found:
现有的软件具有非常不同的速度。我发现的其他软件:
- mathjax: https://www.mathjax.org/
- katex: https://khan.github.io/KaTeX/
- mathquill: http://mathquill.com/
- jsMath: http://www.math.union.edu/~dpvc/jsmath/
- mathjax:https://www.mathjax.org/
- katex: https://khan.github.io/KaTeX/
- mathquill:http://mathquill.com/
- jsMath:http: //www.math.union.edu/~dpvc/jsmath/

