search

Home  >  Q&A  >  body text

Is it semantically correct to use the <math> tag to write chemical equations?

<p>I have been writing chemical equations in HTML files using the <code><math></code> element. </p> <p>For example, to display MnSO4, I would enter: </p> <p> <pre class="brush:html;toolbar:false;"><math> <mi>M</mi> <mi>n</mi> <mi>S</mi> <msub> <mi>O</mi> <mn>4</mn> </msub> </math></pre> </p> <p>Is this semantically correct? If not, can you recommend an alternative? </p>
P粉896751037P粉896751037523 days ago542

reply all(1)I'll reply

  • P粉875565683

    P粉8755656832023-09-04 15:07:52

    MathML is "an XML-based language for describing <数学符号”。它的开发是因为数学符号需要不止一行印刷符号,因此很难仅用文本来表示。

    In contrast, Chemical formulas are always "limited to a single line of printed symbols, which may include subscripts and superscripts."

    Because MathML is for math (not chemistry) and chemical formulas never require more than one line of text, use (superscript) and (subscript) HTML native element.

    <p>Plants require CO<sub>2</sub> for photosynthesis.</p>

    You may also consider combining this with the abbreviation element (if you need to semantically annotate chemical names).

    <p>Plants require <abbr title="carbon dioxide">CO<sub>2</sub></abbr> for photosynthesis.</p>

    You may also consider using Idiomatic text for offsetting chemical equations from other text. This element is used to represent "a series of text that differs from normal text for some reason, such as idiomatic text, technical terms, classification names, etc."

    <p>Hydrogen and oxygen can combine to form water: <i>2H<sub>2</sub> + O<sub>2</sub> → 2H<sub>2</sub>O</i></p>

    reply
    0
  • Cancelreply