def _append_latex(self, latex, before_prompt=False, metadata=None):
        """ Append latex data to the widget."""
        png = None

        if self._is_latex_math(latex):
            png = latex_to_png(latex, wrap=False, backend='dvipng',
                               color=self._get_color('fgcolor'))

        # Matplotlib only supports strings enclosed in dollar signs
        if png is None and latex.startswith('$') and latex.endswith('$'):
            # To avoid long and ugly errors, like the one reported in
            # spyder-ide/spyder#7619
            try:
                png = latex_to_png(latex, wrap=False, backend='matplotlib',
                                   color=self._get_color('fgcolor'))
            except Exception:
                pass

        if png:
            self._append_png(png, before_prompt, metadata)
        else:
            raise LatexError
 Append latex data to the widget.
angrmanagement/vendor/qtconsole/rich_jupyter_widget.py