@classmethod
def from_latex(cls, tex):
    """ Create Math object from a latex expression. Pretty and Plain text outputs
            will not be available.
        """
    math = cls()
    math.latexexpr = tex.lstrip('$').rstrip('$').encode('ascii', 'latex'
        ).decode()
    math.prettytextexpr = None
    math.simpletextexpr = None
    return math
