EDDYMENS

Published 3 months ago

How To Use Fractional (Vinculum) Notations In Markdown

Table of contents

Introduction

Markdown [↗] doesn't have built-in support for math notations. However, since HTML is a superset of Markdown, we can use it to add math notations. But even with HTML [↗], we need to use MathML [↗], which is an XML-based markup [↗] language that can be mixed with HTML.

Implementation

To display 2/3 as a fraction using the vinculum notation  23  , you can use the following MathML:

01: <span xmlns="http://www.w3.org/1998/Math/MathML"> 02: <math display="inline"> 03: <mfrac> 04: <mrow><mn>2</mn></mrow> 05: <mrow><mn>3</mn></mrow> 06: </mfrac> 07: </math> 08: </span>

Aligning Fractions Within a Sentence

The MathML example above places the fraction on a new line. To use the fraction within a sentence, you can use the following HTML:

01: Start of sentence&nbsp; 02: <span style="display: inline-block; text-align: center;"> 03: <span style="border-bottom: 1px solid; display: block;">2</span> 04: <span style="display: block;">3</span> 05: </span> 06: &nbsp;second half of sentence.

Notice that this solution uses HTML and not MathML, and &‌nbsp; is used to add space between the text and the fraction.

Conclusion

Markdown is designed to make it easy to create readable documents that can also be rendered on the web. Because of this, its syntax is limited to basic text formatting. When you need more complex structures, such as math notations, you will likely need to use HTML.

Here is another article you might like 😊 How To Include Square Root Notations In Markdown