我已经阅读了这里的许多问题和答案,但我没有找到一个清晰的问题/答案。我需要创建一个非常简单的网页,允许用户输入LaTeX并生成一个PNG(或其他轻量级图像格式)。网页只包含一个和一个<submit button>,并生成一个带有图像的链接,例如“http://www.example.com/generated-images/cnl344l4jcxlj.png”。 <strong>输入</strong>:已经编写好的LaTeX,如:</br><div class="h-2"></div><pre class="guess-SQL"><code>f(x)=\displaystyle\int_{-\infty}^x e^{-t^2}dt </code></pre></br><div class="h-2"></div>输出:生成的PNG或GIF图像链接 <p><a href="https://istack.dev59.com/fRMLF.gif" rel="nofollow noreferrer"><img alt="http://rinconmatematico.com/latexrender/pictures/35800007a15a3f0e39006dc63f04f1b5.gif" src="https://istack.dev59.com/fRMLF.gif"/></a></p> <p>处理latex代码和生成图像应该在服务器端完成(因此不使用JavaScript)</p> <p>我想用PHP(我非常擅长),但如果有足够简单的库,我也可以尝试使用Perl。</p> <p>纯C的直接实现也可以。一个程序可以通过<code>scanf</code>读取输入的latex代码,并通过<code>printf</code>输出“图像生成于c:/program/image00000000001.gif”</p> <p>有任何免费/开源库来完成这些操作吗?有什么建议如何继续进行吗?有任何特殊注意事项吗?</p> <p><a href="http://rinconmatematico.com/latexrender/pictures/35800007a15a3f0e39006dc63f04f1b5.gif" rel="nofollow noreferrer">http://rinconmatematico.com/latexrender/pictures/35800007a15a3f0e39006dc63f04f1b5.gif</a></p>
尝试以下方法: TeX2PNG - 为给定方程式生成PNG图像 MathJax - JavaScript库,可在HTML中查找并呈现数学方程式 KaTeX - MathJax的轻量级、略微功能较弱的替代品
如果不是高流量网站,您可以尝试使用像在线LaTeX方程式编辑器这样的网站进行在线渲染。特别地,该网站允许您直接将LaTex放入URL中,如下所示: URL为: http://latex.codecogs.com/gif.latex?\sum_k%20a_k