问题描述
项目:我想用PHP构建一个LaTeX到MathML转换器.为什么?因为我是数学家,所以我想在我的Drupal网站上发布数学.它不需要翻译所有的LaTeX,因为基本的文档级内容是由CMS很好地处理的,因此一开始就不会用LaTeX编写.它只需要将用LaTeX编写的数学转换为用MathML编写的数学.尽管我似乎已经尽了我的尽职调查,但这似乎还不存在.也许我是错的-如果您知道某些可以达到此目的的东西,请务必让我知道,并在此先感谢您.但是假设它不存在,我想我得自己去写.
The project: I want to build a LaTeX-to-MathML translator in PHP. Why? Because I'm a mathematician, and I want to publish math on my Drupal site. It doesn't have to translate all of LaTeX, since the basic document-level stuff is ably handled by the CMS and wouldn't be written in LaTeX to begin with; it just has to translate math written in LaTeX into math written in MathML. Although I feel as though I've done my due diligence, this doesn't seem to exist already. Maybe I'm wrong---if you know of something that would serve this purpose, by all means let me know, and thank you in advance. But assuming it doesn't exist, I guess I have to go write it myself.
这就是问题:我从来没有做过如此雄心勃勃的事情.我真的不知道从哪里开始.我已经使用PHP多年了,但是只是要做标准的用PHP和MySQL构建CMS"类型的事情.我从未尝试过像将一种语言翻译成另一种语言一样看似复杂的事情.
Here's the thing, though: I've never done anything this ambitious. I don't really know where to begin. I've used PHP for years, but just to do the standard "build a CMS with PHP and MySQL"-type of stuff. I've never attempted anything as seemingly sophisticated as translation from one language to another.
考虑使用regex做到这一点我真是愚蠢至极-毕竟,LaTeX是一种更为正式的语言,并且它几乎不允许出现各种病理性极端情况,例如HTML.但是另一方面,我很聪明,意识到这可能是一个可怕的主意:现在我有两个问题,我当然不想像.
I'm just dumb enough to consider doing it with regex---after all, LaTeX is a much more formal language, and it doesn't allow for nearly the kinds of pathological edge-cases, as say, HTML. But on the other hand, I'm just smart enough to realize this is probably a terrible idea: now I have two problems, and I sure don't want to end up like this guy.
所以,如果那不是要走的路(对吗?),那是什么?我应该如何开始考虑这个问题?我实际上是用PHP编写LaTeX编译器吗,如果是这样,我需要知道些什么(例如,我应该阅读紫龙书首先?)?
So if that's not the way to go (right?), what is? How should I start thinking about this problem? Am I essentially writing a LaTeX compiler in PHP, and if so, what do I need to know to do that (like, should I just go read the Purple Dragon book first?)?
我对这个项目的前景感到非常兴奋和震惊,但是,嘿,这就是我们所有人学会成为程序员的方式,对吗?如果我们需要的东西不存在,我们就去建造它,必要性是……的母亲.非常感谢大家提前提供的所有指导.
I'm both really excited and pretty intimidated by the prospect of this project, but hey, this is how we all learn to be programmers, right? If something we need doesn't exist, we go and build it, necessity is the mother of... you get the point. Tremendous thanks to everyone in advance for any and all guidance you can offer.
推荐答案
uh:
http://drupal.org/project/drutex
http://drupal.org/project/jsmath
http://www.forkosh.com/mimetex.html
这些有什么问题吗?
这篇关于基于PHP的LaTeX解析器-从哪里开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!