MathML- Subscript, Superscript and Multiscript

Written by @m_k_amin 28 May 2013

At the time of working with math and equations, some features are necessary. Among them, superscripts and subscripts have special importance. Different types of subscripts and superscripts are used alone and with each other. Fortunately, HTML5 MathML has the ability to handle subscripts and superscripts. You can use a desired combination of them (multiscript), too. The following codes have many examples of using HTML5 MathML subscript, superscript and multiscript. The scripts are shown at four places around the main text and the distance of them from the main line can be handled, too, as shown below.

Code Snippet:

                                                
                                                <!-- this script is provided by www.html5freecode.com coded by: Kerixa Inc. -->
<!-- This Script is from www.html5freecode.com, Coded by: Kerixa Inc-->
<script type="text/javascript"
          src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<body style="font-size: 18pt;">

<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>

	<msub>
 		<mi>x</mi>
		<mn>i</mn>
	</msub>

	<mspace width="80px" />
	
	<msup>
 		<mi>x</mi>
		<mi>2</mi>
	</msup>
	
	<mspace width="80px" />
	
	<msubsup>
		<mi>x</mi>
		<mn>i</mn>
		<mn>2</mn>
	</msubsup>
</math>

<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>
	<msub>
 		<mi>x</mi>
 		 <mrow>
	 		<mi>i</mi>
	 		<mo>,</mo>
	 		<mi>j</mi>
 		</mrow>
	</msub>
	
	<mspace width="80px" height="50px"/>
	
	<mmultiscripts>
 		<mi>x</mi>
 		<none/>
 		<mi>j</mi>
	   <mprescripts/>
	    <mi>k</mi>
	    <mn>2</mn>
	</mmultiscripts>
</math>

<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>	
	<msubsup>
 		 <mrow>
	 		<mn>2</mn>	 		
	 		<mi>x</mi>
 		</mrow>
 		 <mrow>
	 		<mi>i</mi>
	 		<mo>,</mo>
	 		<mi>j</mi>
 		</mrow>
 		 <mrow>
	 		<mo>(</mo>
	 		<mi>x</mi>
	 		<mo>+</mo>
	 		<mi>y</mi>
	 		<mo>)</mo>
 		</mrow>
	</msubsup>
	
	<mspace width="150px" height="50px" />
	
	<msubsup subscriptshift ="25px" superscriptshift ="25px">
 		 <mrow>
	 		<mn>2</mn>	 		
	 		<mi>x</mi>
 		</mrow>
 		 <mrow>
	 		<mi>i</mi>
	 		<mo>,</mo>
	 		<mi>j</mi>
 		</mrow>
 		 <mrow>
	 		<mo>(</mo>
	 		<mi>x</mi>
	 		<mo>+</mo>
	 		<mi>y</mi>
	 		<mo>)</mo>
 		</mrow>
	</msubsup>
</math>
</body>

<div style="text-align: center"><font face="Tahoma"><a target="_blank" href="http://www.html5freecode.com"><span style="font-size: 8pt; text-decoration: none">HTML5 Free Code</span></a></font></div><a target='_blank' href='www.html5freecode.com' style='font-size: 8pt; text-decoration: none'>Html5 Free Codes</a>                                                
                                            

Example:


About @m_k_amin

This user is pending a biography.

M
TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members:
advertisement 2