在 HTML 文件中包含 LaTeX 公式?
我看到一些网站在其网站中包含 LaTeX 公式。他们是怎么做到的?
是否有任何 HTML 标签或 SSI 命令来包含 LaTeX 公式?
我更喜欢有一个服务器端命令,而不是客户端。有些客户端没有 LaTeX 编译器。
提前致谢
I saw some sites include LaTeX formulas in their sites. How they do that?
Is there any HTML tag or maybe a SSI command to include LaTeX formulas?
I prefer there be a server-side command, not a client-side. Some clients don't have LaTeX compiler.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MathJax 是一个可能的解决方案。
它是一个与 LaTeX 语法兼容的客户端解决方案(Javascript)。
我认为 MathTran 提供了 LaTeX 文件的在线外包,您可以稍后将其嵌入到您的 HTML 代码中(在很大程度上Google Chart Tools 的方式)
根据您的服务器配置(即假设您可以安装您想要的内容),如果 LaTeX 文件不经常更改,您可以轻松安排(例如)LaTeX ->; PNG 渲染(网上有很多关于如何渲染的信息)并链接生成的 PNG。
如果您有服务器限制(例如共享主机),最后的手段(但也是最简单的),您可以将 LaTeX 渲染为离线图像并上传结果。
MathJax is a possible solution.
It is a client-side solution (Javascript) which is compatible with LaTeX syntax.
I think MathTran provides an online outsourcing of your LaTeX files, which you can later embed in your HTML code (much in the way of the Google Chart Tools)
Depending on your server configuration (ie assuming you can install what you want), if the LaTeX files don't change often you could easily schedule a (say) LaTeX -> PNG render (lots of info the web on how to do it) and link the resulting PNG.
Last resort (but the simplest) if you have server limitations (say a shared host), you can just render the LaTeX to an image offline and upload the result.
MathJax 可以为您完成这项工作。查看网站。
MathJax can do that job for you. Check out the website.
而CodeCogs(更新的超链接)可用于单独生成图像您可以稍后使用标签
添加到您的网页,MathJax 的有效(且加载速度更快)替代方案由 KaTeX:我在此处粘贴了后者实现的最小示例。
您需要做的就是在标题中添加一个
link
和两个script
标签,然后您就可以使用 LaTeX 语法在分隔符\( \ )
并显示分隔符\[ \]
之间的数学。While CodeCogs (updated hyperlink) can be used to separately generate images that you can add later to your webpage using the tag
<img>
, a valid (and faster loading) alternative to MathJax is given by KaTeX: I paste here a minimal example of implementation of this latter.All you need to do is to add one
link
and twoscript
tags to your header, then you can write with LaTeX syntax inline math between the delimiters\( \)
and displayed math between the delimiters\[ \]
.