我们如何在AMP网站上实现MathJax

时间:2019-03-13 09:08:19

标签: amp-html mathjax

我们可以在AMP网站上使用MathJax吗?由于我们有很多数学内容,因此需要MathJax.js。如果是,我们如何实施?

2 个答案:

答案 0 :(得分:1)

将此添加到头部


 <script async custom-element="amp-mathml" src="https://cdn.ampproject.org/v0/amp-mathml-0.1.js"></script>

将此内容包含在体内



  <amp-mathml layout="container" data-formula="`<%= yourMathjax %>`">
      </amp-mathml>

这就是我们在https://amp.doubtnut.com使用Mathjax的方式。我们正在使用ejs作为模板引擎

答案 1 :(得分:0)

我的页面上有很多例子: https://d-a-v-e.org/Beautiful_Math.html

<div class="math-header">The Quadratic Formula</div>
<amp-mathml layout="container" data-formula="\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]"></amp-mathml>
<div class="math-header">Cauchy's Integral Formula</div>
<amp-mathml layout="container" data-formula="\[f(a) = \frac{1}{2\pi i} \oint _γ \frac{f(z)}{z-a}dz\]"></amp-mathml>
<div class="math-header">Double angle formula for Cosines</div>
<amp-mathml layout="container" data-formula="$$ \cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ) $$"></amp-mathml>
<div class="math-header">Gauss' Divergence Theorem</div>
<amp-mathml layout="container" data-formula="\[\int_D(∇⋅F)dV = \int_{∂D} F⋅ndS\]"></amp-mathml>
<div class="math-header">Definition of Christoffel Symbols</div>
<amp-mathml layout="container" data-formula="\[(∇_XY)^k = X^i(∇_iY)^k = X^i{\left({∂Y^k \over ∂x^i} + Γ_{im}^k Y^m\right)}\]"></amp-mathml>
<div class="math-header">Curl of a Vector Field</div>
<amp-mathml layout="container" data-formula="\[\overrightarrow{\nabla} × \overrightarrow{F} = \left(\frac{∂F_z}{∂y} − \frac{∂F_y}{∂z}\right)i + \left(\frac{∂F_x}{∂z} − \frac{∂F_z}{∂x}\right)j + \left(\frac{∂F_y}{∂x} − \frac{∂F_x}{∂y}\right)k\]"></amp-mathml>
<div class="math-header">Standard Deviation</div>
<amp-mathml layout="container" data-formula="\[σ = \sqrt{\frac{1}{N}\sum_{i=1}^N(x_i−μ)^2}\]"></amp-mathml>
<div class="math-header">Stephen Hawking's Entropy of a Black Hole</div>
<amp-mathml layout="container" data-formula="\[S = {kc^3A \over 4ℏG}\]"></amp-mathml>
<a href="https://www.royalmint.com/our-coins/events/stephen-hawking/?utm_source=RakutenMarketing&amp;utm_medium=Affiliate&amp;utm_campaign=2116208:Skimlinks.com&amp;utm_content=10:1&amp;utm_term=UKNetwork&amp;ranMID=37343&amp;ranEAID=TnL5HPStwNw&amp;ranSiteID=TnL5HPStwNw-Yy.LKaTZ_LBg5IpsOf3N.Q" title="Stephen Hawking 50p">
<amp-img class="smallzoomimgno" alt="Stephen Hawking 50p" title="Stephen Hawking 50p" src="images/Hawking-50p.png" width="240px" height="237px" style="margin-bottom:20px;float:right"></amp-img></a>