sphinx-math-dollar


Namesphinx-math-dollar JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/sympy/sphinx-math-dollar/
SummarySphinx extension to let you write LaTeX math using $$
upload_time2022-04-25 21:48:38
maintainer
docs_urlNone
authorSymPy Development Team
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ====================
 sphinx-math-dollar
====================

sphinx-math-dollar is a Sphinx extension to let you write LaTeX math using $$.

To enable install it

.. code::

   pip install sphinx-math-dollar

or

.. code::

   conda install -c conda-forge sphinx-math-dollar

Then in your ``conf.py``, add ``'sphinx_math_dollar'`` to your extensions list:

.. code:: python

   extensions = ['sphinx_math_dollar', 'sphinx.ext.mathjax']

   mathjax_config = {
       'tex2jax': {
           'inlineMath': [ ["\\(","\\)"] ],
           'displayMath': [["\\[","\\]"] ],
       },
   }


The ``mathjax_config`` is needed to prevent MathJax from parsing dollar signs
which are ignored by the extension because they should not be parsed as math.

You will now be able to use dollar signs for math, like ``$\int\sin(x)\,dx$``,
which will produce $\int\sin(x)\,dx$. You can also use double dollar signs for
display math, like ``$$\int\sin(x)\,dx$$``, which produces $$\int\sin(x)\,dx$$
(if you are reading this on GitHub, look at the version built by Sphinx `here
<https://www.sympy.org/sphinx-math-dollar/>`_). The usual Sphinx ``:math:``
and ``.. math::`` directives will also continue to work.

The extension will also work with docstrings when combined with the
`sphinx.ext.autodoc
<https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
extension.

Configuration
=============

sphinx-math-dollar uses a blacklist to determine which `docutils nodes
<http://docutils.sourceforge.net/docs/ref/doctree.html>`_ should not be
parsed. The default blacklist is

.. code::

   (FixedTextElement, literal, math)

``FixedTextElement`` covers the `Simple Body Elements
<http://docutils.sourceforge.net/docs/ref/doctree.html>`_ nodes.

Any docutils node that is contained in a blacklisted node or a subclass of a
blacklisted node will not have ``$math$`` parsed as LaTeX.

You can modify this by setting ``math_dollar_node_blacklist`` in ``conf.py``.
For example, to also prevent ``$math$`` from rendering in `headers nodes
<http://docutils.sourceforge.net/docs/ref/doctree.html#header>`_, add

.. code:: python

   from sphinx_math_dollar import NODE_BLACKLIST
   from docutils.nodes import header

   math_dollar_node_blacklist = NODE_BLACKLIST + (header,)

Note that configuring this variable replaces the default, so it is recommended
to always include the above default values (``NODE_BLACKLIST``) in addition to
additional nodes.

To debug which nodes are skipped, set the environment variable
``MATH_DOLLAR_DEBUG=1`` or set ``math_dollar_debug = True`` in ``conf.py``.

If you feel a node should always be part of the default blacklist, please make
a `pull request <https://github.com/sympy/sphinx-math-dollar>`_.

License
=======

MIT.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sympy/sphinx-math-dollar/",
    "name": "sphinx-math-dollar",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "SymPy Development Team",
    "author_email": "sympy@googlegroups.com",
    "download_url": "https://files.pythonhosted.org/packages/9f/63/9227668066d044b6b6a582f000ade4b9e679978466555710dd2a15f21a3a/sphinx-math-dollar-1.2.1.tar.gz",
    "platform": null,
    "description": "====================\n sphinx-math-dollar\n====================\n\nsphinx-math-dollar is a Sphinx extension to let you write LaTeX math using $$.\n\nTo enable install it\n\n.. code::\n\n   pip install sphinx-math-dollar\n\nor\n\n.. code::\n\n   conda install -c conda-forge sphinx-math-dollar\n\nThen in your ``conf.py``, add ``'sphinx_math_dollar'`` to your extensions list:\n\n.. code:: python\n\n   extensions = ['sphinx_math_dollar', 'sphinx.ext.mathjax']\n\n   mathjax_config = {\n       'tex2jax': {\n           'inlineMath': [ [\"\\\\(\",\"\\\\)\"] ],\n           'displayMath': [[\"\\\\[\",\"\\\\]\"] ],\n       },\n   }\n\n\nThe ``mathjax_config`` is needed to prevent MathJax from parsing dollar signs\nwhich are ignored by the extension because they should not be parsed as math.\n\nYou will now be able to use dollar signs for math, like ``$\\int\\sin(x)\\,dx$``,\nwhich will produce $\\int\\sin(x)\\,dx$. You can also use double dollar signs for\ndisplay math, like ``$$\\int\\sin(x)\\,dx$$``, which produces $$\\int\\sin(x)\\,dx$$\n(if you are reading this on GitHub, look at the version built by Sphinx `here\n<https://www.sympy.org/sphinx-math-dollar/>`_). The usual Sphinx ``:math:``\nand ``.. math::`` directives will also continue to work.\n\nThe extension will also work with docstrings when combined with the\n`sphinx.ext.autodoc\n<https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_\nextension.\n\nConfiguration\n=============\n\nsphinx-math-dollar uses a blacklist to determine which `docutils nodes\n<http://docutils.sourceforge.net/docs/ref/doctree.html>`_ should not be\nparsed. The default blacklist is\n\n.. code::\n\n   (FixedTextElement, literal, math)\n\n``FixedTextElement`` covers the `Simple Body Elements\n<http://docutils.sourceforge.net/docs/ref/doctree.html>`_ nodes.\n\nAny docutils node that is contained in a blacklisted node or a subclass of a\nblacklisted node will not have ``$math$`` parsed as LaTeX.\n\nYou can modify this by setting ``math_dollar_node_blacklist`` in ``conf.py``.\nFor example, to also prevent ``$math$`` from rendering in `headers nodes\n<http://docutils.sourceforge.net/docs/ref/doctree.html#header>`_, add\n\n.. code:: python\n\n   from sphinx_math_dollar import NODE_BLACKLIST\n   from docutils.nodes import header\n\n   math_dollar_node_blacklist = NODE_BLACKLIST + (header,)\n\nNote that configuring this variable replaces the default, so it is recommended\nto always include the above default values (``NODE_BLACKLIST``) in addition to\nadditional nodes.\n\nTo debug which nodes are skipped, set the environment variable\n``MATH_DOLLAR_DEBUG=1`` or set ``math_dollar_debug = True`` in ``conf.py``.\n\nIf you feel a node should always be part of the default blacklist, please make\na `pull request <https://github.com/sympy/sphinx-math-dollar>`_.\n\nLicense\n=======\n\nMIT.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Sphinx extension to let you write LaTeX math using $$",
    "version": "1.2.1",
    "project_urls": {
        "Homepage": "https://github.com/sympy/sphinx-math-dollar/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9658f4df1f1cd8a2bd7c5720870fcd1373fbd6de934f74c887bbc40eef9d8328",
                "md5": "5b149b265e4ca3c36bd4edfe0ea2eec4",
                "sha256": "0b1523a4d7023b9020ddf3a9301f651d64427a0f1d802af534a87eaf24fbdf19"
            },
            "downloads": -1,
            "filename": "sphinx_math_dollar-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b149b265e4ca3c36bd4edfe0ea2eec4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8074,
            "upload_time": "2022-04-25T21:48:47",
            "upload_time_iso_8601": "2022-04-25T21:48:47.289206Z",
            "url": "https://files.pythonhosted.org/packages/96/58/f4df1f1cd8a2bd7c5720870fcd1373fbd6de934f74c887bbc40eef9d8328/sphinx_math_dollar-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f639227668066d044b6b6a582f000ade4b9e679978466555710dd2a15f21a3a",
                "md5": "3b3b0e7b4692213cd5656ecaecedc527",
                "sha256": "03427240f21fdf23c7b8415289aa1a0e307ac32c198e02f840c59a4b1b0d950c"
            },
            "downloads": -1,
            "filename": "sphinx-math-dollar-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3b3b0e7b4692213cd5656ecaecedc527",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 25758,
            "upload_time": "2022-04-25T21:48:38",
            "upload_time_iso_8601": "2022-04-25T21:48:38.710465Z",
            "url": "https://files.pythonhosted.org/packages/9f/63/9227668066d044b6b6a582f000ade4b9e679978466555710dd2a15f21a3a/sphinx-math-dollar-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-04-25 21:48:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sympy",
    "github_project": "sphinx-math-dollar",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sphinx-math-dollar"
}
        
Elapsed time: 0.15276s