'Render math using latex-like formatting.
Examples:
<math>$\displaystyle U(r)=4 U_0 $</math>
<math>$r_0$</math>
We convert these to [mathjax]...[/mathjax] and [mathjaxinline]...[/mathjaxinline]
TODO: use shorter tags (but this will require converting problem XML files!)'

def __init__(self, system, xml):

    self.system = system
    self.xml = xml
    mathstr = re.sub('\\$(.*)\\$', '[mathjaxinline]\\1[/mathjaxinline]', xml.text)
    mtag = 'mathjax'
    if ('\\displaystyle' not in mathstr):
        mtag += 'inline'
    else:
        mathstr = mathstr.replace('\\displaystyle', '')
    self.mathstr = mathstr.replace('mathjaxinline]', ('%s]' % mtag))
