LaTeX 相当于 Google Chart API

发布于 2024-07-13 01:29:51 字数 570 浏览 11 评论 0原文

我目前正在寻找不同的解决方案,将二维数学公式放入网页中。 我认为维基百科解决方案(从 LaTeX 源代码生成 png 图像)已经足够好了,直到我们在网络浏览器中获得对 MathML 的支持。

我突然意识到,也许可以为数学公式创建一个等效的 Google Charts API。 这已经完成了吗? 由于 LaTeX 代码中涉及奇怪的字符,这是否有可能?

我想点击像 Latex2png.org/api/?eq="E = mc^2" 这样的网址并得到以下响应: e=mc^2

编辑: 感谢到目前为止的回答。 然而,我已经知道有几种从 Latex 源代码生成 png 图像的工具(在线和命令行),但我正在寻找的是一种通过 Http GET 请求获取图像的简单方法。 也许这样的服务并不存在。

I'm currently looking at different solutions getting 2 dimensional mathematical formulas into webpages. I think that the wikipedia solution (generating png images from LaTeX sourcecode) is good enough until we get support for MathML in webbrowsers.

I suddenly realized that it might be possible to create a Google Charts API equivalent for mathformulas. Has this already been done? Is it even possible due to the strange characters involved in LaTeX-code?

I would like to hit an url like latex2png.org/api/?eq="E = mc^2" and get the following response: e=mc^2

edit:
Thanks for the answers sofar. However, I am already aware of several tools to generate png images from latex source code (both online and from my commandline), but what I was looking for was a simple way to get the image via an Http GET request. Perhaps such a service does not exist.

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

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

发布评论

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

评论(7

無處可尋 2024-07-20 01:29:51

更新

正如@hughes(和其他人)指出的那样,以前的 Google Chart API 已被弃用。

我编写的示例截至 2015 年 9 月仍然有效,但现在应使用一个新的示例 (文档):

旧答案

Google Chart 可以做到(文档):

http://chart.apis.google.com/chart?cht=tx&chl=%5CLaTeX

我正在使用这个使用 Google Docs,因为它还不支持数学。

Update

As @hughes (and others) pointed out, the previous Google Chart API has been deprecated.

The example I wrote still works as of Sept 2015, but a new one shall be used now (documentation):

Old answer

Google Chart can do it (Documentation):

http://chart.apis.google.com/chart?cht=tx&chl=%5CLaTeX

I'm using this with Google Docs, because it doesn't support math yet.

猫九 2024-07-20 01:29:51

chart.apis.google 的背景颜色已更改

替代文本

https://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A

或 < Strong>chart.apis.google 背景色透明调整大小

为了提高可读性,需要对 URL 进行解码。

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=
4x_0\Delta(x)+3\Delta(x)+2\Delta(x^2)>0

数据结构如下所示

{
  "cht":"tx",
  "chs":"428x35",
  "chf":"bg,s,FFFFFF00",
  "chl":"n4x_0\Delta(x) 3\Delta(x) 2\Delta(x^2)>0"
}

替代文本

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A

chart.apis.google with background color changed

alt text

https://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A

or chart.apis.google with background color transparent and resized

For better readability URL needs to be decoded.

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=
4x_0\Delta(x)+3\Delta(x)+2\Delta(x^2)>0

Data structure looks like this

{
  "cht":"tx",
  "chs":"428x35",
  "chf":"bg,s,FFFFFF00",
  "chl":"n4x_0\Delta(x) 3\Delta(x) 2\Delta(x^2)>0"
}

alt text

https://chart.apis.google.com/chart?cht=tx&chs=428x35&chf=bg,s,FFFFFF00&chl=%0D%0A4x_0%5CDelta%28x%29%2B3%5CDelta%28x%29%2B2%5CDelta%28x%5E2%29%3E0%0D%0A
渔村楼浪 2024-07-20 01:29:51

您可以首先尝试数学公式在线图像生成器

mathurl 是 TinyURL.com 的数学版本。 它允许您使用短网址引用 LaTeXed 数学表达式。 例如, http://mathurl.com/?5v4pjw 将显示 [LaTeX 输出图像],然后您可以编辑。 有关mathurl 帮助页面的更多详细信息

You could try the Online image generator for mathematical formulas for a start.

mathurl is a mathematical version of TinyURL.com. It allows you to reference LaTeXed mathematical expressions using a short url. For example, http://mathurl.com/?5v4pjw will show [LaTeX output Image] which you can then edit. More details on mathurl’s help page

情丝乱 2024-07-20 01:29:51

我刚刚遇到 MathJax Ajaxian [通过 Wayback Machine]:

MathJax 似乎有机会成为一种实用的解决方案,在 HTML 页面中提供 LaTeX 和 MathML 数学符号的高质量显示。

输出非常漂亮,而且都是纯 HTML 和 CSS,这使得它具有可扩展性和可选择性。 目前表现有点低迷,但这是公认的。

I just ran across MathJax on Ajaxian [via Wayback Machine]:

MathJax seems to have a chance at being a practical solution that offers a high quality display of LaTeX and MathML math notation in HTML pages.

The output is remarkably beautiful, and it's all pure HTML and CSS, which makes it scalable and selectable. Performance is currently a bit sluggish, but this is recognized.

沧笙踏歌 2024-07-20 01:29:51

正如大家所说,已经有许多服务可以做到这一点。 这是我多次使用过的另一个简单的方法(如果需要,您可以将其本地安装在服务器上):
http://www.codecogs.com/components/equationeditor/equationeditor.php

As everyone has said, there are many services that do this already. Here is another easy one that I've used a number of times (and you can install it locally on your server if necessary):
http://www.codecogs.com/components/equationeditor/equationeditor.php

将军与妓 2024-07-20 01:29:51

我会仔细研究 MediaWiki LaTeX 支持 是如何做到这一点的,并借鉴那里。

I'd take a good look at how the MediaWiki LaTeX support does it and borrow from there.

草莓酥 2024-07-20 01:29:51

请查看此站点,了解无需安装任何软件即可创建 TeX 文档的方法。 然后,您可以使用任何屏幕捕获方法对结果图像进行片段化,并将结果图像嵌入到任何网站中。

访问 http://sharelatex.com

该软件可以免费使用,但您需要注册才能创建文档。

Please check out this site for a way to create TeX documents without any software installed. You can then snippet the result image with any screen capture method and embed the resulting image into a any website.

Go to http://sharelatex.com

The software is free to use, but you need to register to create documents.

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