Write Latex functions in html by applying MathJax
Applying MathJax
to get Latex
effect
To add LaTex
function to a html page, one could applying MathJax
method adding the following code to head
section of the html file.
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
If inline function is also needed, add the following code to the head
section, as well.
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" }); </script>
An example
a simple html page code is as follow.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>MathJax AsciiMath Test Page</title> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\(','\)']]} }); </script> </head> <body> <h1>here are some $latex$ functions</h1> <p> $$\int_0^infty \frac{x}{y}$$ $$ \int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}$$ $$ \int_0^\infty \frac{x^3}{e^x-1}dx = \frac{\pi^4}{15}$$ </p> </body> </html> </html>
Copy above code save, save it to a text file and rename the file to page.html
. Then, open it in a web browser, you will find a page looks as follow.
ref:
http://blog.csdn.net/LiJiancheng0614/article/details/47069817
http://blog.csdn.net/liyuanbhu/article/details/50636416
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具