diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 9ac9443..065c13f 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -54,7 +54,6 @@ from IPython.core.prefilter import PrefilterManager from IPython.core.profiledir import ProfileDir from IPython.core.prompts import PromptManager from IPython.core.usage import default_banner -from IPython.lib.latextools import LaTeXTool from IPython.testing.skipdoctest import skip_doctest from IPython.utils import PyColorize from IPython.utils import io @@ -521,7 +520,6 @@ class InteractiveShell(SingletonConfigurable): self.init_display_pub() self.init_data_pub() self.init_displayhook() - self.init_latextool() self.init_magics() self.init_alias() self.init_logstart() @@ -715,12 +713,6 @@ class InteractiveShell(SingletonConfigurable): # the appropriate time. self.display_trap = DisplayTrap(hook=self.displayhook) - def init_latextool(self): - """Configure LaTeXTool.""" - cfg = LaTeXTool.instance(parent=self) - if cfg not in self.configurables: - self.configurables.append(cfg) - def init_virtualenv(self): """Add a virtualenv to sys.path so the user can import modules from it. This isn't perfect: it doesn't use the Python interpreter with which the diff --git a/IPython/lib/latextools.py b/IPython/lib/latextools.py index b048517..f7188d7 100644 --- a/IPython/lib/latextools.py +++ b/IPython/lib/latextools.py @@ -12,7 +12,7 @@ import shutil import subprocess from IPython.utils.process import find_cmd, FindCmdError -from IPython.config.application import Application +from IPython.config import get_config from IPython.config.configurable import SingletonConfigurable from IPython.utils.traitlets import List, Bool, Unicode from IPython.utils.py3compat import cast_unicode, cast_unicode_py2 as u @@ -20,7 +20,9 @@ from IPython.utils.py3compat import cast_unicode, cast_unicode_py2 as u class LaTeXTool(SingletonConfigurable): """An object to store configuration of the LaTeX tool.""" - + def _config_default(self): + return get_config() + backends = List( Unicode, ["matplotlib", "dvipng"], help="Preferred backend to draw LaTeX math equations. " @@ -93,11 +95,12 @@ def latex_to_png_mpl(s, wrap): from matplotlib import mathtext except ImportError: return None - + # mpl mathtext doesn't support display math, force inline s = s.replace('$$', '$') if wrap: s = u'${0}$'.format(s) + mt = mathtext.MathTextParser('bitmap') f = BytesIO() mt.to_png(f, s, fontsize=12)