2

Can we able to use MathJax in AMP website. Since we have lots of math contain which required us MathJax.js. If yes how can we implement it?

1
  • I have seen this post from the AMP documentation itself. From there, there is a statement "I already knew how to use JavaScript to render formulas with MathJax – my challenge was building an AMP component that ran this code and displayed it inline. - Adam Silverstein". This will lead you to this github post which I think will be helpful for you. Mar 15, 2019 at 9:39

2 Answers 2

2

include this in head


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

include this in body



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

This is how we are using Mathjax at https://amp.doubtnut.com . We are using ejs as templating engine

0

There are many examples on my page: 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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.