HTML5 - MathML
ไวยากรณ์ HTML ของ HTML5 อนุญาตให้ใช้องค์ประกอบ MathML ภายในเอกสารโดยใช้แท็ก <math> ... </math>
เว็บเบราว์เซอร์ส่วนใหญ่สามารถแสดงแท็ก MathML ได้ หากเบราว์เซอร์ของคุณไม่รองรับ MathML ฉันขอแนะนำให้คุณใช้ Firefox เวอร์ชันล่าสุด
ตัวอย่าง MathML
ต่อไปนี้เป็นเอกสาร HTML5 ที่ถูกต้องพร้อม MathML -
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>Pythagorean theorem</title>
</head>
<body>
<math xmlns = "http://www.w3.org/1998/Math/MathML">
<mrow>
<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>
</mrow>
</math>
</body>
</html>
สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ -
การใช้อักขระ MathML
พิจารณาต่อไปนี้เป็นมาร์กอัปที่ใช้ประโยชน์จากอักขระ & InvisibleTimes; -
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>MathML Examples</title>
</head>
<body>
<math xmlns = "http://www.w3.org/1998/Math/MathML">
<mrow>
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<mrow>
<mn>4</mn>
<mo></mo>
<mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mrow>
</math>
</body>
</html>
สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ หากคุณไม่สามารถเห็นผลลัพธ์ที่เหมาะสมเช่น x 2 + 4x + 4 = 0 ให้ใช้ Firefox 3.5 หรือเวอร์ชันที่สูงกว่า
สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ -
ตัวอย่างการนำเสนอเมทริกซ์
พิจารณาตัวอย่างต่อไปนี้ซึ่งจะใช้เพื่อแสดงเมทริกซ์ 2x2 อย่างง่าย -
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>MathML Examples</title>
</head>
<body>
<math xmlns = "http://www.w3.org/1998/Math/MathML">
<mrow>
<mi>A</mi>
<mo>=</mo>
<mfenced open = "[" close="]">
<mtable>
<mtr>
<mtd><mi>x</mi></mtd>
<mtd><mi>y</mi></mtd>
</mtr>
<mtr>
<mtd><mi>z</mi></mtd>
<mtd><mi>w</mi></mtd>
</mtr>
</mtable>
</mfenced>
</mrow>
</math>
</body>
</html>
สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ -
สิ่งนี้จะให้ผลลัพธ์ดังต่อไปนี้ หากคุณไม่สามารถเห็นผลลัพธ์ที่เหมาะสมให้ใช้ Firefox 3.5 หรือเวอร์ชันที่สูงกว่า