def init_math(app):
    """
    This is a dummy math extension.

    It's a hack, but if you want math in a PDF via pdfbuilder, and don't want
    to enable pngmath or jsmath, then enable this one.

    :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    """
    from sphinx.errors import SphinxError
    try:
        # Sphinx 0.6.4 and later
        from sphinx.ext.mathbase import setup_math as mathbase_setup
    except ImportError:
        try:
            # Sphinx 0.6.3
            from sphinx.ext.mathbase import setup as mathbase_setup
        except ImportError as e:
            log.error('Error importing sphinx math extension: %s', e)

    class MathExtError(SphinxError):
        category = 'Math extension error'

    def html_visit_math(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    def html_visit_displaymath(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))
Ejemplo n.º 2
0
def init_math(app):
    """
        This is a dummy math extension.

        It's a hack, but if you want math in a PDF via pdfbuilder, and don't want to
        enable pngmath or jsmath, then enable this one.

        :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
        :license: BSD, see LICENSE for details.
    """
    from sphinx.errors import SphinxError
    try:
        # Sphinx 0.6.4 and later
        from sphinx.ext.mathbase import setup_math as mathbase_setup
    except ImportError:
        try:
            # Sphinx 0.6.3
            from sphinx.ext.mathbase import setup as mathbase_setup
        except ImportError:
            _, e, _ = sys.exc_info()
            log.error('Error importing sphinx math extension: %s', e)

    class MathExtError(SphinxError):
        category = 'Math extension error'


    def html_visit_math(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    def html_visit_displaymath(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
Ejemplo n.º 3
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))
    app.add_config_value('mathjax_path', '', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 4
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('mathjax_path',
                         'http://cdn.mathjax.org/mathjax/latest/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 5
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', False)
    app.add_config_value('pngmath_latex', 'latex', False)
    app.add_config_value('pngmath_use_preview', False, False)
    app.add_config_value('pngmath_dvipng_args', [], False)
    app.add_config_value('pngmath_latex_preamble', '', False)
    app.connect('build-finished', cleanup_tempdir)
Ejemplo n.º 6
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', False)
    app.add_config_value('pngmath_latex', 'latex', False)
    app.add_config_value('pngmath_use_preview', False, False)
    app.add_config_value('pngmath_dvipng_args', [], False)
    app.add_config_value('pngmath_latex_preamble', '', False)
    app.connect('build-finished', cleanup_tempdir)
Ejemplo n.º 7
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))
    app.add_config_value(
        'mathjax_path', 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?'
        'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 8
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.jsmath: other math package is already loaded')

    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 9
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.jsmath: other math package is already loaded')

    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 10
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    # more information for mathjax secure url is here:
    # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
    app.add_config_value('mathjax_path',
                         'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 11
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
    app.add_config_value('pngmath_latex', 'latex', 'html')
    app.add_config_value('pngmath_use_preview', False, 'html')
    app.add_config_value('pngmath_dvipng_args',
                         ['-gamma 1.5', '-D 110'], 'html')
    app.add_config_value('pngmath_latex_args', [], 'html')
    app.add_config_value('pngmath_latex_preamble', '', 'html')
    app.add_config_value('pngmath_add_tooltips', True, 'html')
    app.connect('build-finished', cleanup_tempdir)
Ejemplo n.º 12
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
    app.add_config_value('pngmath_latex', 'latex', 'html')
    app.add_config_value('pngmath_use_preview', False, 'html')
    app.add_config_value('pngmath_dvipng_args',
                         ['-gamma 1.5', '-D 110'], 'html')
    app.add_config_value('pngmath_latex_args', [], 'html')
    app.add_config_value('pngmath_latex_preamble', '', 'html')
    app.add_config_value('pngmath_add_tooltips', True, 'html')
    app.connect('build-finished', cleanup_tempdir)
Ejemplo n.º 13
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    # more information for mathjax secure url is here:
    # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
    app.add_config_value('mathjax_path',
                         'https://cdn.mathjax.org/mathjax/latest/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 14
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('mathjax_path',
                         'http://cdn.mathjax.org/mathjax/latest/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.add_config_value('mathjax_generate_latex', True, 'html')
    app.add_config_value('mathjax_latex_title', 'Download as Latex', 'html')
    app.add_config_value('mathjax_latex_style', 'text-align:right;font-size:14px;', 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 15
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
    app.add_config_value('pngmath_latex', 'latex', 'html')
    app.add_config_value('pngmath_use_preview', False, 'html')
    app.add_config_value('pngmath_dvipng_args',
                         ['-gamma', '1.5', '-D', '110', '-bg', 'Transparent'],
                         'html')
    app.add_config_value('pngmath_latex_args', [], 'html')
    app.add_config_value('pngmath_latex_preamble', '', 'html')
    app.add_config_value('pngmath_add_tooltips', True, 'html')
    app.connect('build-finished', cleanup_tempdir)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 16
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))
    app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
    app.add_config_value('pngmath_latex', 'latex', 'html')
    app.add_config_value('pngmath_use_preview', False, 'html')
    app.add_config_value('pngmath_dvipng_args',
                         ['-gamma', '1.5', '-D', '110', '-bg', 'Transparent'],
                         'html')
    app.add_config_value('pngmath_latex_args', [], 'html')
    app.add_config_value('pngmath_latex_preamble', '', 'html')
    app.add_config_value('pngmath_add_tooltips', True, 'html')
    app.connect('build-finished', cleanup_tempdir)
    return {'version': sphinx.__version__, 'parallel_read_safe': True}
Ejemplo n.º 17
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value("imgmath_image_format", "png", "html")
    app.add_config_value("imgmath_dvipng", "dvipng", "html")
    app.add_config_value("imgmath_dvisvgm", "dvisvgm", "html")
    app.add_config_value("imgmath_latex", "latex", "html")
    app.add_config_value("imgmath_use_preview", False, "html")
    app.add_config_value("imgmath_dvipng_args", ["-gamma", "1.5", "-D", "110", "-bg", "Transparent"], "html")
    app.add_config_value("imgmath_dvisvgm_args", ["--no-fonts"], "html")
    app.add_config_value("imgmath_latex_args", [], "html")
    app.add_config_value("imgmath_latex_preamble", "", "html")
    app.add_config_value("imgmath_add_tooltips", True, "html")
    app.add_config_value("imgmath_font_size", 12, "html")
    app.connect("build-finished", cleanup_tempdir)
    return {"version": sphinx.__display_version__, "parallel_read_safe": True}
Ejemplo n.º 18
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.mathjax: other math package is already loaded')

    # more information for mathjax secure url is here:
    # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
    app.add_config_value('mathjax_path',
                         'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)

    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 19
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.mathjax: other math package is already loaded')

    # more information for mathjax secure url is here:
    # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
    app.add_config_value('mathjax_path',
                         'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?'
                         'config=TeX-AMS-MML_HTMLorMML', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)

    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 20
0
def setup(app):
    app.warn('sphinx.ext.pngmath has been deprecated. Please use sphinx.ext.imgmath instead.')
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.pngmath: other math package is already loaded')

    app.add_config_value('pngmath_dvipng', 'dvipng', 'html')
    app.add_config_value('pngmath_latex', 'latex', 'html')
    app.add_config_value('pngmath_use_preview', False, 'html')
    app.add_config_value('pngmath_dvipng_args',
                         ['-gamma', '1.5', '-D', '110', '-bg', 'Transparent'],
                         'html')
    app.add_config_value('pngmath_latex_args', [], 'html')
    app.add_config_value('pngmath_latex_preamble', '', 'html')
    app.add_config_value('pngmath_add_tooltips', True, 'html')
    app.connect('build-finished', cleanup_tempdir)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 21
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinxcontrib-katex.sphinxcontrib.katex: other math package is already loaded')


    app.add_config_value('katex_path', None, False)
    app.add_config_value('katex_render', None, False)
    app.add_config_value('render_math', None, False)

    app.add_config_value('katex_css', None, 'html')
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')

    app.connect('builder-inited', builder_inited)

    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 22
0
def setup(app):
    # type: (Sphinx) -> Dict[unicode, Any]
    try:
        mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('sphinx.ext.imgmath: other math package is already loaded')

    app.add_config_value('imgmath_image_format', 'png', 'html')
    app.add_config_value('imgmath_dvipng', 'dvipng', 'html')
    app.add_config_value('imgmath_dvisvgm', 'dvisvgm', 'html')
    app.add_config_value('imgmath_latex', 'latex', 'html')
    app.add_config_value('imgmath_use_preview', False, 'html')
    app.add_config_value('imgmath_dvipng_args',
                         ['-gamma', '1.5', '-D', '110', '-bg', 'Transparent'],
                         'html')
    app.add_config_value('imgmath_dvisvgm_args', ['--no-fonts'], 'html')
    app.add_config_value('imgmath_latex_args', [], 'html')
    app.add_config_value('imgmath_latex_preamble', '', 'html')
    app.add_config_value('imgmath_add_tooltips', True, 'html')
    app.add_config_value('imgmath_font_size', 12, 'html')
    app.connect('build-finished', cleanup_tempdir)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 23
0
def setup(app):
    try:
        mathbase_setup(app, (html_visit_math, None),
                       (html_visit_displaymath, None))
    except ExtensionError:
        raise ExtensionError('KaTeX: other math package is already loaded')

    # Include KaTex CSS and JS files
    app.add_config_value('katex_version', '0.9.0', False)
    katex_url = 'https://cdn.jsdelivr.net/npm/katex@{version}/dist/'.format(
        version=app.config.katex_version)
    app.add_config_value('katex_css_path', katex_url + 'katex.min.css', False)
    app.add_config_value('katex_js_path', katex_url + 'katex.min.js', False)
    app.add_config_value('katex_autorender_path',
                         katex_url + 'contrib/auto-render.min.js', False)
    app.add_config_value('katex_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('katex_display', [r'\[', r'\]'], 'html')
    app.add_config_value('katex_options', '', 'html')
    app.connect('builder-inited', builder_inited)
    app.connect('build-finished', builder_finished)

    return {'version': __version__, 'parallel_read_safe': True}
Ejemplo n.º 24
0
            from sphinx.ext.mathbase import setup as mathbase_setup
        except ImportError, e:
            log.error('Error importing sphinx math extension: %s', e)

    class MathExtError(SphinxError):
        category = 'Math extension error'

    def html_visit_math(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    def html_visit_displaymath(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))


def setup(app):
    #Init dummy math extension
    init_math(app)

    app.add_builder(PDFBuilder)
    # PDF options
    app.add_config_value('pdf_documents', [], None)
    app.add_config_value('pdf_stylesheets', ['sphinx'], None)
    app.add_config_value('pdf_style_path', None, None)
    app.add_config_value('pdf_compressed', False, None)
    app.add_config_value('pdf_font_path', [], None)
    app.add_config_value('pdf_language', 'en_US', None)
    app.add_config_value('pdf_fit_mode', '', None),
Ejemplo n.º 25
0
        except ImportError, e:
            log.error('Error importing sphinx math extension: %s', e)

    class MathExtError(SphinxError):
        category = 'Math extension error'


    def html_visit_math(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    def html_visit_displaymath(self, node):
        self.body.append(node['latex'])
        raise nodes.SkipNode

    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))


def setup(app):
    #Init dummy math extension
    init_math(app)

    app.add_builder(PDFBuilder)
    # PDF options
    app.add_config_value('pdf_documents', [], None)
    app.add_config_value('pdf_stylesheets', ['sphinx'], None)
    app.add_config_value('pdf_style_path', None, None)
    app.add_config_value('pdf_compressed', False, None)
    app.add_config_value('pdf_font_path', [], None)
    app.add_config_value('pdf_language', 'en_US', None)
    app.add_config_value('pdf_fit_mode', '', None),
Ejemplo n.º 26
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value("jsmath_path", "", False)
    app.connect("builder-inited", builder_inited)
Ejemplo n.º 27
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
    return {'version': sphinx.__version__, 'parallel_read_safe': True}
Ejemplo n.º 28
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None),
                   (html_visit_displaymath, None))
    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 29
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 30
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('jsmath_path', '', False)
    app.connect('builder-inited', builder_inited)
    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
Ejemplo n.º 31
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value('mathjax_path', '', False)
    app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
    app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')
    app.connect('builder-inited', builder_inited)
Ejemplo n.º 32
0
def setup(app):
    mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None))
    app.add_config_value("jsmath_path", "", False)
    app.connect("builder-inited", builder_inited)
    return {"version": sphinx.__display_version__, "parallel_read_safe": True}