Index: doc/sphinxext/inheritance_diagram.py
===================================================================
--- doc/sphinxext/inheritance_diagram.py	(revision 6626)
+++ doc/sphinxext/inheritance_diagram.py	(working copy)
@@ -39,8 +39,6 @@
     from md5 import md5
 
 from docutils.nodes import Body, Element
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
 from docutils.parsers.rst import directives
 from sphinx.roles import xfileref_role
 
@@ -409,12 +407,9 @@
                                   inheritance_diagram_directive)
 
 def setup(app):
-    app.add_node(inheritance_diagram)
-
-    HTMLTranslator.visit_inheritance_diagram = \
-        visit_inheritance_diagram(html_output_graph)
-    HTMLTranslator.depart_inheritance_diagram = do_nothing
-
-    LaTeXTranslator.visit_inheritance_diagram = \
-        visit_inheritance_diagram(latex_output_graph)
-    LaTeXTranslator.depart_inheritance_diagram = do_nothing
+    app.add_node(inheritance_diagram,
+                 html=(visit_inheritance_diagram(html_output_graph),
+                       do_nothing))
+    app.add_node(inheritance_diagram,
+                 latex=(visit_inheritance_diagram(latex_output_graph),
+                        do_nothing))
Index: doc/sphinxext/mathmpl.py
===================================================================
--- doc/sphinxext/mathmpl.py	(revision 6626)
+++ doc/sphinxext/mathmpl.py	(working copy)
@@ -6,8 +6,6 @@
 
 from docutils import nodes
 from docutils.parsers.rst import directives
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
 import warnings
 
 # Define LaTeX math node:
@@ -69,8 +67,6 @@
         self.body.append(latex2html(node, source))
     def depart_latex_math_html(self, node):
             pass
-    HTMLTranslator.visit_latex_math = visit_latex_math_html
-    HTMLTranslator.depart_latex_math = depart_latex_math_html
 
     # Add visit/depart methods to LaTeX-Translator:
     def visit_latex_math_latex(self, node):
@@ -83,9 +79,14 @@
                               '\\end{equation}'])
     def depart_latex_math_latex(self, node):
             pass
-    LaTeXTranslator.visit_latex_math = visit_latex_math_latex
-    LaTeXTranslator.depart_latex_math = depart_latex_math_latex
 
+    app.add_node(latex_math, html=(visit_latex_math_html,
+                                   depart_latex_math_html))
+    app.add_node(latex_math, latex=(visit_latex_math_latex,
+                                    depart_latex_math_latex))
+    app.add_role('math', math_role)
+
+
 from matplotlib import rcParams
 from matplotlib.mathtext import MathTextParser
 rcParams['mathtext.fontset'] = 'cm'
Index: doc/sphinxext/only_directives.py
===================================================================
--- doc/sphinxext/only_directives.py	(revision 6626)
+++ doc/sphinxext/only_directives.py	(working copy)
@@ -4,8 +4,6 @@
 #
 
 from docutils.nodes import Body, Element
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
 from docutils.parsers.rst import directives
 
 class html_only(Body, Element):
@@ -63,9 +61,6 @@
     directives.register_directive('latexonly', LatexOnlyDirective)
 
 def setup(app):
-    app.add_node(html_only)
-    app.add_node(latex_only)
-
     # Add visit/depart methods to HTML-Translator:
     def visit_perform(self, node):
         pass
@@ -76,12 +71,7 @@
     def depart_ignore(self, node):
         node.children = []
 
-    HTMLTranslator.visit_html_only = visit_perform
-    HTMLTranslator.depart_html_only = depart_perform
-    HTMLTranslator.visit_latex_only = visit_ignore
-    HTMLTranslator.depart_latex_only = depart_ignore
-
-    LaTeXTranslator.visit_html_only = visit_ignore
-    LaTeXTranslator.depart_html_only = depart_ignore
-    LaTeXTranslator.visit_latex_only = visit_perform
-    LaTeXTranslator.depart_latex_only = depart_perform
+    app.add_node(html_only, html=(visit_perform, depart_perform))
+    app.add_node(html_only, latex=(visit_ignore, depart_ignore))
+    app.add_node(latex_only, latex=(visit_perform, depart_perform))
+    app.add_node(latex_only, html=(visit_ignore, depart_ignore))
