Skip to main content

Sphinx extension to let you write LaTeX math using $$

Project description

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

To enable install it

pip install sphinx-math-dollar

or

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

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

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

You will now be able to use dollar signs for math, like $\int\sin(x)\,dx$, which will produce $intsin(x),dx$ (if you are reading this on GitHub, look at the version built by Sphinx here). The usual Sphinx :math: directive will also continue to work.

The extension will also work with docstrings when combined with the sphinx.ext.autodoc extension.

Configuration

sphinx-math-dollar uses a blacklist to determine which docutils nodes should not be parsed. The default blacklist is

(FixedTextElement, literal, math)

FixedTextElement covers the Simple Body Elements 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, add

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.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-math-dollar-1.1.1.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

sphinx_math_dollar-1.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-math-dollar-1.1.1.tar.gz.

File metadata

  • Download URL: sphinx-math-dollar-1.1.1.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for sphinx-math-dollar-1.1.1.tar.gz
Algorithm Hash digest
SHA256 cb46ed9ffd5e87aea0e2fc1f5716585a60892cf1f0176148d0f06599eee0d785
MD5 9e1cbc49cb2f8d7d85c63df55120d16c
BLAKE2b-256 dbd518d80b9401dac025f912169d88d76432eb3c45ed84d114ca5b3f8e570c6d

See more details on using hashes here.

File details

Details for the file sphinx_math_dollar-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_math_dollar-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for sphinx_math_dollar-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f5e83cc8d0eead107aaf78cc846a23dedbc6ba87cd0416d810de37a730efb58
MD5 eae3b4f3f87fafc5d743ad69b5af0b00
BLAKE2b-256 2defcbf798f68358a4dafc6680a56ca664761f307ec2eae332424e0a4af14e4e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page