in reply to perl module for math representation...

I don't know of any perl modules for this specifically. Probably the most portable way is to use tables:
<div class="math"> <table class="fraction" cellpadding="0" cellspacing="0" > <tr> <td align="center" class="numerator"><i>Aa</i><sub>0</sub><i>qp</i +> </td></tr> <tr> <td align="center" class="divider">--------- </td></tr> <tr> <td align="center" class="denominator"><i>b</i><sup>2</sup> </td></tr> </table> </div>
which looks like
Aa0qp
---------
b2

-Mark