📖 1. Introduction à MathML
MathML (Mathematical Markup Language) est un langage XML permettant d'afficher des formules mathématiques complexes directement dans les pages web.
❌ Sans MathML
<!-- Image ou texte approximatif -->
<img src="formule.png" alt="x = (-b ± √(b²-4ac))/2a">
Images pixelisées, non adaptables, pas de zoom
✅ Avec MathML
<math>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow><mo>-</mo><mi>b</mi><mo>±</mo><msqrt><
;msup><mi>b</mi><mn>2</mn></msup><mo>-</mo>
<mn>4</mn><mi>a</mi><mi>c</mi></msqrt></mrow>
<mrow><mn>2</mn><mi>a</mi></mrow>
</mfrac>
</math>
Vectoriel, responsive, accessible
Rendu mathématique parfait
Responsive
S'adapte à tous les écrans
Accessibilité
Lu par les lecteurs d'écran
Impression
Qualité vectorielle
<math></math>.🔢 2. Éléments de base
<mi> – Identifiant
Variables mathématiques (x, y, α, β)
<mn> – Nombre
Constantes numériques
<mo> – Opérateur
+, -, ×, ÷, =, <, >
<mrow> – Groupe
Regroupe des éléments
📝 Exemple : Expression simple
<math>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
<mo>=</mo>
<mi>c</mi>
</math>
📐 3. Fractions et racines
<mfrac> – Fraction
Numérateur / Dénominateur
<msqrt> – Racine carrée
<mroot> – Racine n-ième
📝 Exemple : Formule quadratique
<math>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>-</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<msup><mi>b</mi><mn>2</mn></msup>
<mo>-</mo>
<mn>4</mn>
<mi>a</mi>
<mi>c</mi>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</math>
📈 4. Exposants et indices
<msup> – Exposant
<msub> – Indice
<msubsup> – Indice + Exposant
📝 Exemple : Somme de i=1 à n
<math>
<munderover>
<mo>∑</mo>
<mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow>
<mi>n</mi>
</munderover>
<msub><mi>x</mi><mi>i</mi></msub>
</math>
➕ 5. Opérateurs
+ → +− → −× → ×÷ → ÷= → =< → <> → >≤ → ≤≥ → ≥≠ → ≠∼ → ∼≈ → ≈∀ → ∀&exists; → ∃∈ → ∈∉ → ∉📝 Exemple : Inégalité
<math>
<mi>x</mi>
<mo>≤</mo>
<mi>y</mi>
<mo><</mo>
<mi>z</mi>
</math>
📌 6. Accents et symboles spéciaux
α → αβ → βγ → γδ → δπ → πθ → θλ → λσ → σω → ω&infinity; → ∞&partial; → ∂∫ → ∫📝 Exemple : Intégrale
<math>
<msubsup>
<mo>∫</mo>
<mn>0</mn>
<mn>1</mn>
</msubsup>
<msup><mi>x</mi><mn>2</mn></msup>
<mi>dx</mi>
</math>
📊 7. Matrices
📝 Exemple : Matrice 2×2
<math>
<mrow>
<mo>[</mo>
<mtable>
<mtr><mtd><mn>1</mn></mtd><mtd><mn>2</mn><
/mtd></mtr>
<mtr><mtd><mn>3</mn></mtd><mtd><mn>4</mn><
/mtd></mtr>
</mtable>
<mo>]</mo>
</mrow>
</math>
📝 Exemple : Déterminant
<math>
<mrow>
<mo>det</mo>
<mo>(</mo>
<mtable>
<mtr><mtd><mi>a</mi></mtd><mtd><mi>b</mi><
/mtd></mtr>
<mtr><mtd><mi>c</mi></mtd><mtd><mi>d</mi><
/mtd></mtr>
</mtable>
<mo>)</mo>
</mrow>
</math>
📝 8. Exemples complets
📌 Exemple 1 : Théorème de Pythagore
<math>
<msup><mi>a</mi><mn>2</mn></msup>
<mo>+</mo>
<msup><mi>b</mi><mn>2</mn></msup>
<mo>=</mo>
<msup><mi>c</mi><mn>2</mn></msup>
</math>
📌 Exemple 2 : Dérivée
<math>
<mfrac>
<mrow><mi>d</mi><mi>f</mi></mrow>
<mrow><mi>d</mi><mi>x</mi></mrow>
</mfrac>
<mo>=</mo>
<munder>
<mi>lim</mi>
<mrow><mi>h</mi><mo>→</mo><mn>0</mn></mrow>
</munder>
<mfrac>
<mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>+<
/mo><mi>h</mi><mo>)</mo><mo>-</mo><mi>f<
/mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow>
<mi>h</mi>
</mfrac>
</math>
📌 Exemple 3 : Produit scalaire
<math>
<mover>
<mi>u</mi>
<mo>→</mo>
</mover>
<mo>⋅</mo>
<mover>
<mi>v</mi>
<mo>→</mo>
</mover>
<mo>=</mo>
<msup><mi>u</mi><mn>2</mn></msup>
</math>
🌐 9. Support navigateurs
Chrome ✅ Supporté
<math display="block"> pour les formules en bloc.<!-- Détection du support MathML -->
<script>
if (!window.MathMLElement) {
alert("Votre navigateur ne supporte pas MathML");
}
</script>
📝 Tableau récapitulatif
| Balise | Description | Exemple |
|---|---|---|
<mi> |
Identifiant (variable) | x, y, α |
<mn> |
Nombre | 123, 3.14 |
<mo> |
Opérateur | +, -, ×, ÷, = |
<mrow> |
Groupe | Regroupe des éléments |
<mfrac> |
Fraction | a/b |
<msqrt> |
Racine carrée | √x |
<msup> |
Exposant | x² |
<msub> |
Indice | x₁ |
<mtable> |
Tableau (matrice) | Matrice 2×2 |
📌 Quiz de vérification
Question 1 : Quelle balise utilise-t-on pour écrire une fraction ?
📖 Voir la réponse
<mfrac>numérateur</mfrac>dénominateur</mfrac>
Question 2 : Comment écrire x² en MathML ?
📖 Voir la réponse
<msup><mi>x</mi><mn>2</mn></msup>
Question 3 : Quelle balise permet de créer une matrice ?
📖 Voir la réponse
<mtable> avec <mtr> pour les lignes et <mtd> pour les cellules.
Question 4 : Comment obtenir le symbole π ?
📖 Voir la réponse
π ou <mi>π</mi>