AMP

amp-mathml

Description

Displays a MathML formula.

 

Required Scripts

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

Supported Layouts

Usage

Renders a MathML formula in an iframe.

The example below displays the quadratic formula:

<amp-mathml
  layout="container"
  data-formula="\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]"
>
</amp-mathml>

The example below displays Cauchy's integral formula:

<amp-mathml
  layout="container"
  data-formula="\[f(a) = \frac{1}{2\pi i} \oint\frac{f(z)}{z-a}dz\]"
>
</amp-mathml>

The example below displays a double angle formula for cosines:

<amp-mathml
  layout="container"
  data-formula="$$ \cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ) $$"
>
</amp-mathml>

Inline formula

This is an example of a formula of <amp-mathml layout="container" inline data-formula="`x`"></amp-mathml>, <amp-mathml layout="container" inline data-formula="\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)"></amp-mathml> placed inline in the middle of a block of text. <amp-mathml layout="container" inline data-formula="\( \cos(θ+φ) \)"></amp-mathml> This shows how the formula will fit inside a block of text and can be styled with CSS.

Attributes

data-formula (required)

Specifies the formula to render.

inline (optional)

If specified, the component renders inline (inline-block in CSS).

title (optional)

Define a title attribute for the component to propagate to the underlying <iframe> element. The default value is "MathML formula".

Validation

See amp-mathml rules in the AMP validator specification.

Besoin d'une aide supplémentaire ?

Vous avez lu ce document une douzaine de fois mais il ne répond pas à toutes vos questions ? D'autres personnes ont peut-être eu le même sentiment. Contactez-les sur Stack Overflow.

Se rendre sur Stack Overflow
Vous avez trouvé un bug ou une fonctionnalité manquante ?

Le projet AMP encourage fortement votre participation et vos contributions ! Nous espérons que vous deviendrez un membre régulier de notre communauté open source, mais nous serons également ravis de recevoir des contributions ponctuelles concernant les questions qui vous intéressent particulièrement.

Se rendre sur GitHub