问题描述
我已经编写了小型Java应用程序,以为我的Maths版本创建可打印的抽认卡.
I've written small Java application to create printable flashcards for my Maths revision.
目前,我正在使用 JLaTeXMath 生成图像LaTeX的每一面.
At the moment, I'm using JLaTeXMath to generate the images for each side from LaTeX.
唯一的问题是,JLaTeXMath似乎仅限于LaTeX公式.我想使用同一程序为其他主题(例如生物学)创建抽认卡,其中的问题和答案将基于文本(而不是基于方程式),而LaTeX公式不适用于此.
The only problem is, that JLaTeXMath seems to be limited to LaTeX formula. I want to use the same program to create flashcards for other subjects such as Biology, where the questions and answers will be text based (rather than equation based) and LaTeX formula's aren't suitable for this.
有没有可以解析LaTeX的Java库?还是有更好的方法呢?
Are there any Java libraries that can parse LaTeX?Or is there a better way of doing this?
推荐答案
LaTeX是一种完整的编程语言.解析意味着执行程序.
LaTeX is a full programming language. Parsing it means executing the program.
尽管在许多常见情况下(例如\section
等)看起来很简单,但是到目前为止,这并不是一件小事.实际上,它应该是完整的.而且某些部分甚至具有或多或少不同的语法.以TIKZ为例-一个出色的LaTeX图形绘制库.它的语法有点像乳胶,但是其他部分更多地是现代编程语言.很多就像样式表一样.
While it seems to be simple in many of the common cases - \section
etc. - it is by far not trivial. In fact, it should be turing complete. And some parts will even have a more or less different syntax. Take TIKZ for example - an excellent graph drawing library for LaTeX. It's syntax is somewhat like latex, but other parts are more that of modern programming languages. And a lot is like stylesheets.
但是,您可能仅支持部分乳胶语法就可以摆脱困境.看看 Texlipse 的功能.在Java中.
However, you might be able to get away with supporting just part of the latex syntax. Have a look at what Texlipse does. It's in Java.
这篇关于Java中的完整LaTeX解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!