[英]How to render a single mathjax equation?
I am working on a webpage that MathJax doesn't play well with.我正在处理一个 MathJax 不适合的网页。 There are
display:none
nodes, latex text nested into svgs, and all manner of other unpleasantness.有
display:none
节点,嵌套在 svgs 中的乳胶文本,以及各种其他令人不快的地方。 Instead of having MathJax automatically attempt to parse through my site looking for $$ and figuring out the size of text, and all of the other magic, it would be way easier if I could just call an API with the appropriate size parameters and the equation text and get back an svg that I will embed with my own two hands.与其让 MathJax 自动尝试解析我的网站以查找 $$ 并计算出文本的大小以及所有其他魔法,如果我可以使用适当的大小参数和等式调用 API 会更容易文本并取回我将用我自己的两只手嵌入的 svg。 Is this possible?
这可能吗?
I have found this page which does dynamic rendering, but it seems to parse the entire page to accomplish this behavior.我发现这个页面进行了动态渲染,但它似乎解析了整个页面来完成这个行为。 I would like to just render a single equation.
我只想渲染一个方程。
Codecogs provides a nice editor for testing out formulas, and it makes it easy to embed nice equations in your page. Codecogs提供了一个很好的编辑器来测试公式,它可以很容易地在你的页面中嵌入很好的方程。 At the bottom of the page, there's a place to copy code to embed.
在页面底部,有一个地方可以复制要嵌入的代码。 The urls tend to use
/gif.latex
, but turns out you can swap gif
for svg
.网址倾向于使用
/gif.latex
,但事实证明您可以将gif
换成svg
。
A call to https://latex.codecogs.com/svg.latex?
调用
https://latex.codecogs.com/svg.latex?
followed by the latex for your equation will return the image.其次是您的方程的乳胶将返回图像。
<img src="https://latex.codecogs.com/svg.latex?a^b+b^2=c^2"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.