我正在寻找一种从模板中嵌入的 LATEX 源代码生成方程 PNG 图像的方法。例如,给定:
[% FILTER latex_display ]
\begin{eqnarray*}
\max && U(x,y) \\
\mathrm{s.t.} && p_x x + p_y y \leq I \\
&& x \geq 0, y \geq 0
\end{eqnarray*}
[% END %]
我想得到输出:
<div class="latex display"><img src="equation.png" width="x" height="y"></div>
最终应显示为:
我正在使用 ttree 离线生成文档。我知道 Template::Plugin::Latex 但这是为了生产来自 LATEX 模板的实际文档。
有什么建议吗?
更新:
我很欣赏这些建议(并且我已投票赞成)。然而,它们并不完全是我所需要的。我真的很感激一些关于模板工具包插件或过滤器入门的建议。
I am looking for a way of generating PNG images of equations from LATEX source code embedded in templates. For example, given:
[% FILTER latex_display ]
\begin{eqnarray*}
\max && U(x,y) \\
\mathrm{s.t.} && p_x x + p_y y \leq I \\
&& x \geq 0, y \geq 0
\end{eqnarray*}
[% END %]
I would like to get the output:
<div class="latex display"><img src="equation.png" width="x" height="y"></div>
which should ultimately display as:
I am using ttree to generate documents offline. I know about Template::Plugin::Latex but that is geared towards producing actual documents out of LATEX templates.
Any suggestions?
Update:
I appreciate the suggestions (and I have voted them up). However, they are no quite what I need. I would really appreciate a few pointers towards getting started with a Plugin or Filter for Template Toolkit.
发布评论
评论(3)
维基百科做了与你想要的类似的事情。他们使用一个名为
texcv
的程序。然后你还有 MathJAX 它更针对网页中的动态数学渲染。texcv
是根据用 OCaml 编写的链接页面,但是由于 Mediawiki 的其余部分是用 PHP 编写的,我认为您在重新利用该程序以与 Perl 一起使用时应该不会有任何问题。Wikipedia does something similar to what you want. They use a program called
texcv
. Then you also have MathJAX which is more aimed at dynamic math rendering in web-pages.texcv
is according to the linked page written in OCaml however since the rest of Mediawiki is written in PHP I don't think you should have any problem with repurposing the program to use with Perl.你应该看看jsMath,MathML,或 mathjax
you should take a look at jsMath, MathML, or mathjax
上的这些文档
Template Toolkit
网站应提供设置插件或过滤器所需的所有信息:一旦您将 LATEX 转换为 PNG 排序,那么您可能需要使用 重定向。 POD 示例:
希望有帮助。
/I3az/
These docs on
Template Toolkit
site should provide all necessary info to setup a plugin or filter:Once you have your LATEX to PNG conversion sorted then you probably need to save it as a file using redirect. Example from POD:
Hope that helps.
/I3az/