MathML 到 LaTeX 的转换

MathML to LaTeX conversion(MathML 到 LaTeX 的转换)
本文介绍了MathML 到 LaTeX 的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我试图弄清楚如何转换数学方程的 MathML 表示并将其转换为该数学方程的 LaTeX 表示.比如……

I'm trying to figure out how to convert a MathML representation of a math equation and convert it to the LaTeX representation of that math equation. So for example...

<math>
  <mrow>
    <mfrac>
      <mrow><mi>x</mi></mrow>
      <mrow><mi>y</mi></mrow>
    </mfrac>
  </mrow>
</math>

... 是一个简单的堆叠分数,它的 LaTeX 表示将是...

... is a simple stacked fraction and it's LaTeX representation would be...

frac{x}{y}

我保证 MathML 没有表示性标记,因为我正在动态构造 MathML 字符串并且我控制 MathML 元素的插入方式/位置;MathML 字符串只是数学方程的纯结构.

I'm guaranteed that the MathML has no presentational markup because I am constructing the MathML string dynamically and I control how/where the MathML elements are inserted; the MathML string is just pure structure of the math equation.

所以我的问题是,是否有任何 Java/JavaScript 库可以采用 MathML 输入字符串(如上面的那个)并生成相应的 LaTeX 字符串?我宁愿不必自己编写这个解析器.如果不是 Java/JavaScript,是否有任何库可以做到这一点?

So my question is, are there any Java/JavaScript libraries out there that can take a MathML input string, like the one above, and generate the corresponding LaTeX string? I would much rather not have to write this parser myself. If not Java/JavaScript, are any libraries at all that can do this?

如果没有,关于如何解决编写我自己的解析器这个问题的任何建议?从哪里开始、要考虑的事情、资源等...?

If not, any suggestions on how to approach this problem of writing my own parser? Where to start, things to consider, resources, etc...?

感谢 Optimal Cynic,我能够使用 这个 Java 库 来做我想做的事.然而,它并不完美,但我可以轻松地对其进行修改并使其正常工作.但是,我仍然希望在 JavaScript 中看到这一点.那么有没有像这样用 JavaScript 编写的工具呢?如果没有,我会自己翻译.

Thanks to Optimal Cynic, I was able to use this Java library to do what I want. It is not perfect however, but I can easily modify it and make it work well. However, I would still like to see this done in JavaScript. So are there any tools like this written in JavaScript? If not, I'll resort to translating it myself.

注意:我正在使用 MathJax 在页面上呈现 MathML,但 MathJax 目前不支持一种从 MathML 到 LaTeX 的方法.它只能从 LaTeX 转到 MathML.

Note: I am using MathJax to render the MathML on the page, but MathJax does not currently support a way to go from MathML to LaTeX. It can only go from LaTeX to MathML.

推荐答案

试试http://www.tilman.de/programme/mathparser/anleitung_en.html - 它是用 Java 编写的,源代码可用.

Try http://www.tilman.de/programme/mathparser/anleitung_en.html - it's written in Java and the source is available.

这篇关于MathML 到 LaTeX 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
Correct way to sign and verify signature using bouncycastle(使用 bouncycastle 签名和验证签名的正确方法)
Creating RSA Public Key From String(从字符串创建 RSA 公钥)
Why java.security.NoSuchProviderException No such provider: BC?(为什么 java.security.NoSuchProviderException 没有这样的提供者:BC?)
Generating X509 Certificate using Bouncy Castle Java(使用 Bouncy Castle Java 生成 X509 证书)
How can I get a PublicKey object from EC public key bytes?(如何从 EC 公钥字节中获取 PublicKey 对象?)