def METHOD_NAME(app):
    METHOD_NAME.app = app
    # Add visit/depart methods to HTML-Translator:
    def visit_latex_math_html(self, node):
        source = self.document.attributes['source']
        self.body.append(latex2html(node, source))
    def depart_latex_math_html(self, node):
        pass
    # Add visit/depart methods to LaTeX-Translator:
    def visit_latex_math_latex(self, node):
        inline = isinstance(node.parent, nodes.TextElement)
        if inline:
            self.body.append('$%s$' % node['latex'])
        else:
            self.body.extend(['\\begin{equation}',
                              node['latex'],
                              '\\end{equation}'])
    def depart_latex_math_latex(self, node):
        pass
    app.add_node(latex_math,
                 html=(visit_latex_math_html, depart_latex_math_html),
                 latex=(visit_latex_math_latex, depart_latex_math_latex))
    app.add_role('mathmpl', math_role)
    app.add_directive('mathmpl', math_directive,
                      True, (0, 0, 0), **options_spec)
    if sphinx.version_info < (1, 8):
        app.add_role('math', math_role)
        app.add_directive('math', math_directive,
                          True, (0, 0, 0), **options_spec)
    metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
    return metadata