在网络上编写数学方程的最佳方法是什么?

发布于 2024-07-17 09:46:16 字数 770 浏览 10 评论 0原文

我正在开发一个与数学相关的网页,并正在寻找一种将数学方程轻松写入网页的解决方案。 目前我可以使用几种解决方案:

  • 使用 LaTeX 并将它们作为图像发布在我的网页上。
  • 使用 MathML

这两种解决方案都不理想,而且看起来有些过时。 用图像替换文本绝不是一个好主意,而且 MathML 并不兼容所有浏览器/操作系统。

我希望有一种使用图像或 MathML 的现代解决方案,也许可以利用 sIFR 来显示数学方程? 经过一番研究后,我仍然没有找到任何真正的解决方案。

请注意,我要求一种发布方程的新方法。 我不希望图像成为网页上显示的输出,而是希望将这些方程呈现为文本数据。 MathML 是我所见过的最接近的,但它仍然不理想。 我想知道是否可以使用 sIFR 这样的替代工具在 Flash 中创建方程。 有人在这方面有什么建议吗?

编辑:自从我上次更新这篇文章以来已经有一段时间了,但是随着 HTML5 被浏览器采用,游戏中出现了一个新的玩家,它将 LaTeX 和 MathML 重新引入到混合中,MathJax!MathJax 绝对是最佳选择!

类似问题: 网络上的数学方程一个>

I am working on a Math related web page and am looking for a solution to writing Mathematical equations easily onto a web page. There are several solutions readily available to me at the moment:

  • Use LaTeX and publish them on my web page as images.
  • Use MathML

Both of these solutions aren't ideal and seem somewhat dated. Replacing what should be text with an image is never a good idea and MathML isn't compliant with all browsers/operating systems.

I'm hoping that there is a modern solution to using images or MathML, perhaps something utilising sIFR to display mathematical equations? After a bit of research I am still yet to find any real solution.

Please note that I am asking for a new way of publishing equations. I do not want images to be the output that is displayed on the web page and would rather have these equations rendered as textual data. MathML is the closest I've come, but it's still not ideal. I've wondered for a while whether a replacement tool like sIFR could be utilised to create equations in Flash. Anyone have any suggestions on this front?

EDIT: It's been a while since I last updated this post, but with HTML5 becoming adopted by browsers there is a new player in the game that introduces LaTeX and MathML back into the mix, MathJax!. MathJax are definitely the way to go!

Similar Question: Math equations on the web

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

红ご颜醉 2024-07-24 09:46:16

jsMath 包是一个使用 LaTeX 标记和本机字体的选项。 引用他们的网页 http://www.math.union.edu/~dpvc/jsMath/

jsMath包提供了一个方法
在 HTML 页面中包含数学
适用于多种浏览器
在 Windows、Macintosh OS X、Linux 下
以及其他风格的unix。 它
克服了一些缺点
传统的使用方法
代表数学的图像:
jsMath 使用原生字体,所以它们
当你改变大小时调整大小
浏览器中的文本,它们打印在
打印机的完整分辨率,
而且你不必等待几十个
要下载的图像以便
查看网页中的数学。
网页也有优点
作者,因为没有必要
预处理您的网页以生成
任何图像,数学是
以 TeX 形式输入,因此很容易
创建和维护您的网页。

例如,请参阅此页面那个

The jsMath package is an option that uses LaTeX markup and native fonts. Quoting from their webpage http://www.math.union.edu/~dpvc/jsMath/:

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.

See for example this page or that one.

好久不见√ 2024-07-24 09:46:16

我刚刚编写了一个名为 jqmath 的 javascript 模块来执行此操作。 请参阅 http://mathscribe.com/author/jqmath.html

它有点类似于 MathJax,但更简单、更小、更快。

I've just written a javascript module to do this, named jqmath. See http://mathscribe.com/author/jqmath.html

It's sort of similar to MathJax, but simpler, smaller, and faster.

々眼睛长脚气 2024-07-24 09:46:16

我一直在我的网站中使用带有合并单元格的无边框表格来显示数学方程。 它对于大多数方程都非常有效。 然而,由于标记通常有点复杂,对于核心数学网站来说会很耗时。

这是代码:

<style type="text/css">
  table.math{font:17px georgia, times, serif;border-collapse:collapse;border:none;}
  td.a{text-align:center;}
  td.b{padding:0 2px;}
  td.c{border-top:1px solid #505050;border-left:1px solid #505050;border-bottom:1px solid #505050;}
  td.d{border-top:1px solid #505050;border-right:1px solid #505050;border-bottom:1px solid #505050;}
  td.e{text-align:center;border-top:1px solid #505050;}
</style>
<table class="math">
  <tr>
    <td class="a">1</td>
    <td class="b" rowspan="2">×</td>
    <td class="c" rowspan="2"> </td>
    <td class="a">8</td>
    <td class="b" rowspan="2">+</td>
    <td class="a">1</td>
    <td class="d" rowspan="2"> </td>
  </tr>
  <tr>
    <td class="e">x + 2</td>
    <td class="e">x + 2</td>
    <td class="e">x − 1</td>
  </tr>
</table>

这是上述代码的输出:

在此处输入图像描述

I have been using borderless tables with merged cells in my website to display math equations. It works excellent for most equations. However, since the markup is usually a bit complex, it would be time consuming in case of hard core mathematics websites.

Here is the code:

<style type="text/css">
  table.math{font:17px georgia, times, serif;border-collapse:collapse;border:none;}
  td.a{text-align:center;}
  td.b{padding:0 2px;}
  td.c{border-top:1px solid #505050;border-left:1px solid #505050;border-bottom:1px solid #505050;}
  td.d{border-top:1px solid #505050;border-right:1px solid #505050;border-bottom:1px solid #505050;}
  td.e{text-align:center;border-top:1px solid #505050;}
</style>
<table class="math">
  <tr>
    <td class="a">1</td>
    <td class="b" rowspan="2">×</td>
    <td class="c" rowspan="2"> </td>
    <td class="a">8</td>
    <td class="b" rowspan="2">+</td>
    <td class="a">1</td>
    <td class="d" rowspan="2"> </td>
  </tr>
  <tr>
    <td class="e">x + 2</td>
    <td class="e">x + 2</td>
    <td class="e">x − 1</td>
  </tr>
</table>

Here is the output of the above code:

enter image description here

一笔一画续写前缘 2024-07-24 09:46:16

LaTeX 已经在网络和学术界广泛使用来渲染方程。

维基百科就是一个很好的例子,请查看此页面的 1 个示例。

http://en.wikipedia.org/wiki/Latitude

我知道这是一个概括,但是:使用图像是一种以浏览器兼容的方式在网络上实现许多功能的可行方法 - 前提是您提供了一些缺点。 (例如,谷歌地图、圆角、图表、高级排版)

“过时”也可以解释为“经过尝试、测试且功能完整”

,感谢您指出 sIFR - 我稍后会查看的内容,我已经有了一份要探索的事情清单,例如打印? ( html + 图片可以很好地做到这一点,sIFR 可以吗?....)

LaTeX is use extensively already on the net and in academia to render equations.

A great example of this is wikipedia have a look at this page for 1 example.

http://en.wikipedia.org/wiki/Latitude

I know this is a generlisation but: Using images is a viable way to achieve many things on the web in a browser compatible way - provided you provision for some of the shortcomings. ( eg. Google Maps, Rounded Corners, graphs, advanced typography )

Also 'dated' could be interpreted as 'tried, tested and feature complete'

and thanks for point out sIFR - something i'm going to look at later, i already have a list of things to explore with it, such as printing? ( html + images can do this pretty well, can sIFR?....)

泪痕残 2024-07-24 09:46:16

我一直在使用 Confluence wiki 的 LaTeX 插件在网络上(好吧,在内联网上)编写方程。 它在网络浏览器中显示图像,但如果您编辑页面,您仍然可以看到 LaTeX 源代码。

我不知道您使用什么来托管网站,但您也许可以使用类似的方法:在页面中嵌入 LaTeX 源代码,并将其呈现为 Web 浏览器的图像。

I've been using the LaTeX plugin for the Confluence wiki to write equations on the web (well, on the intranet). It displays an image in the web browser, but you can still see the LaTeX source if you edit the page.

I don't know what you're using to host the web site, but you could maybe use a similar approach: embed the LaTeX source in the page, and render it as an image for the web browser.

ぶ宁プ宁ぶ 2024-07-24 09:46:16

MathTran 是我遇到的最好的解决方案:

http://www.mathtran.org/

MathTran is the nicest solution that I've come across to this:

http://www.mathtran.org/

爱要勇敢去追 2024-07-24 09:46:16

我喜欢 MathBin.net罗杰的在线方程编辑器。 后者可以让您控制输出的质量。

I like both MathBin.net and Roger's Online Equation Editor. The latter lets you control the quality of the output.

终难愈 2024-07-24 09:46:16

您可以直接在 HTML 页面中编写 Latex 并使用此 动态显示它:

http://www.codecogs.com/components/equationeditor/equationeditor.php

You can write your latex directly in your HTML page and display it dynamically using this library :

http://www.codecogs.com/components/equationeditor/equationeditor.php

喜爱皱眉﹌ 2024-07-24 09:46:16

解决方案是使用 http://www.codecogs.com/components/equationeditor/equationeditor .php

该网站允许您以 LaTeX 格式输入方程式,并使用其 TeX 服务器,它将方程式转换为图像,您将能够在那里显示您的数学方程式。

让我给你举个例子,假设我想打印一个积分公式,我只需输入:

img style="display: block; float: none; margin-left: auto; margin-right: auto" title="
\int_{a}^{b}(x+2)dx
" src="http://latex.codecogs.com/gif.latex?\int_{a}^{b}(x+2)dx"

参考上面代码的第 3 个,LaTex 数学方程插在后面src=”http://latex.codecogs.com/gif.latex? 中的问号[将您的 TeX 代码放在这里]”

The solution is to use http://www.codecogs.com/components/equationeditor/equationeditor.php

The website allow you to type your equation in LaTeX format and using its TeX Server, it will convert the equation to images and you will be able to show your math equation there.

let me show you an example, suppose i want print a integration formula i just type:

img style="display: block; float: none; margin-left: auto; margin-right: auto" title="
\int_{a}^{b}(x+2)dx
" src="http://latex.codecogs.com/gif.latex?\int_{a}^{b}(x+2)dx"

Refer to the 3rd of the code above, the LaTex Math Equation is inserted after the question mark in src=”http://latex.codecogs.com/gif.latex?[put your TeX Code here]”

初见终念 2024-07-24 09:46:16

这将取决于您的主要目的和受众。

MathML (MathML2) 听起来很有前途,但它在浏览器和 MathML 方程编辑器(或生成器)之间仍然存在很多兼容性问题。 许多复杂的方程在不同的浏览器中不会得到相同的维护或显示。 许多数学编辑器、转换器、生成器都表示他们支持 MathML。 但结果并不相同,尽管输出可能看起来相似。 在 MathML 2 中定义许多复杂的方程并不容易/不可能。
如果您只有一些简单的方程式,并且可以让观众使用特定的浏览器,那么这可能是一个选择。
如果 MathML3 得到广泛支持,那么 MathML 可能是正确的选择。

如果您的数学表达式不是交互式的并且不必动态生成,而是在页面上是静态的,那么 PNG 或 JPG 图像可能是一个不错的选择。 在大多数情况下,图像的大小并不是那么大,并且在一个页面中显示数十个方程的速度相当快,因为​​现在我们大多数人都有高速互联网。 PNG 图像与任何基于脚本的渲染方法之间没有太大区别,因为基于脚本的方程通常只有几 KB,并且在下载所有脚本后从本地计算机渲染图像需要时间。
此外,有许多应用程序支持重新编辑基于 PNG 或 JPG 的方程图像。
MathMagic (www.mathmagic.com) 支持可重新编辑的 PNG(以及透明 PNG)、GIF、JPG、BMP。
MathType (www.dessci.com) 支持可重新编辑的 GIF。 MathMagic 还读取 MathType 图像。

如果屏幕和打印等高质量输出都需要基于矢量的图像格式,那么 SVG 可能是最佳选择。 此外,在某些情况下,PDF 也是一种选择。
许多 Mac 方程编辑器支持 PDF 格式,因为它是一种(几乎是原生的)Mac OS X 格式。 但只有少数支持 Windows 上的 PDF。
看起来最新的MathType Mac版本支持PDF。 MathMagic 在 Mac 和 Win 上都支​​持 PDF。 看起来 MathMagic 也支持 SVG。

如果方程是由一些有限的作者创建的,则有许多选项可以组合以获得最佳结果。 例如使用最新的 MS Word 内置的基于 MathML/XML 的方程编辑器,然后将页面转换为 Web。 或者使用一些第 3 方所见即所得方程编辑器(例如 MathType 或 MathMagic)进行快速编写和编辑,然后将方程保存为 MathML、LaTeX 或 Wiki 兼容方程格式,并与在线方程渲染引擎(例如 codecogs.com)一起使用或 MathJax。

如果内容还应用于其他格式,例如 eBook/ePub,则应该考虑其他因素,包括方程的质量以及与 InDesign 等解决方案的集成。

如果有任何不正确的地方,请纠正我。

It will depend on your primary purpose and audience.

MathML (MathML2) sounds like promising but it still have a lot of compatibility issues across browsers and MathML equation editors (or generator). Many complex equations will not be maintained or displayed same across different browsers. Many math editors, converters, generators say they support MathML. But the result is not the same although the output may look similar. And it is not easy/not possible to define many complex equations in MathML 2.
If you just have some simple equations and if you can have your audience use a certain browsers, then this might be an option.
If MathML3 is widely supported, then MathML might be the way to go.

If your math expressions are not interactive and don't have to be dynamically generated) and rather static on the page, PNG or JPG image might be a good option. The size of images are not that big in most cases and displaying tens of equations in a page is quite fast as most of us have high speed internet these days. Not much difference between PNG images vs. any script based rendering approaches as the script based equations are often a few KBs and as it takes time to render the images from the local computer after downloading all the scripts.
also, there are many applications that support re-editing of the PNG or JPG based equation images.
MathMagic (www.mathmagic.com) supports re-editable PNG (transparent PNG as well), GIF, JPG, BMP.
MathType (www.dessci.com) supports re-editable GIF. MathMagic also reads MathType images.

If a vector based image format is required for both screen and high quality output such as printing, SVG might be the way to go. Also, PDF can be an option in some cases.
Many Mac equation editors supports PDF format as it is a kind of (almost native) Mac OS X format. But only a few supports PDF on Windows.
It looks the latest MathType Mac version supports PDF. MathMagic supports PDF on both Mac and Win. It looks MathMagic supports SVG as well.

If the equations are created by some limited writers, there are many options to combine to get the best results. Such as using the latest MS Word's built-in MathML/XML based equation editor, and then converting the pages to web. Or using a few 3rd party WYSIWYG equation editors (such as MathType or MathMagic) for fast writing and editing, and then saving the equations a MathML, LaTeX, or Wiki compliant equation format and using in with online equation rendering engines such as codecogs.com or MathJax.

If the contents should also be used for other formats, such as eBook/ePub, there should be other factors to consider including the quality of equations and the integration with the solution such as InDesign.

please correct me if anything incorrect.

胡渣熟男 2024-07-24 09:46:16

iTex2Img 是我认为最好的一个曾经用过。 这是带有示例的屏幕截图。

在此处输入图像描述

iTex2Img is the best one what I've ever used. Here is a screenshot with an example.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文