HTML5 MathML
HTML5 MathML <merror> Tag
The <merror> element displays the contents as an error message, typically rendered with a distinctive style (often a red box). It is meant for MathML generators to report syntax problems in place.
Definition and Usage
When a program that produces MathML encounters bad input, it can wrap a human-readable message in <merror> and embed it where the failed expression would have gone. Browsers give the message a highlighted appearance so it stands out from valid notation.
Syntax
<merror>
<mtext>Syntax error</mtext>
</merror>Example
The document mixes a valid expression with an error message so you can see how <merror> is set apart.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MathML merror</title>
</head>
<body>
<math display="block">
<mrow>
<mi>y</mi><mo>=</mo>
<merror>
<mtext>Unexpected token</mtext>
</merror>
</mrow>
</math>
</body>
</html>Exact styling of <merror> is up to the browser. It is intended for tools that generate MathML, not usually for hand-authored formulas.
Key Takeaways
- <merror> presents its content as a highlighted error message.
- It is used by MathML generators to flag bad input in place.
- Wrap a plain message in <mtext> inside <merror>.
