sympy / sphinx-math-dollar

Sphinx extension to let you write LaTeX math using $$
https://www.sympy.org/sphinx-math-dollar/
MIT License
33 stars 11 forks source link

Add support for double dollar signs for display math #12

Closed asmeurer closed 4 years ago

asmeurer commented 5 years ago

Fixes #4.

Note, it currently allows it in any context where single dollar signs are allowed. But this produces odd results in some cases, like in headers. So maybe we should be more restrictive.

Also, as discussed in #4, it currently parses unclosed dollar signs as text. It might better to raise an error in this case, and require them to be escaped.

asmeurer commented 5 years ago

If you build the test build in the tests, it seems that double dollars still get picked up by MathJax, even when they are not parsed by the extension. I think the default MathJax config parses double dollar signs. We should change the default config, and document how to do it in the install instructions.

asmeurer commented 5 years ago

You need to add


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

to the conf.py. I've added it to the test build and documented it.

asmeurer commented 5 years ago

This is ready to go.

mgeier commented 5 years ago

Just for the record: It is considered very bad style to use double dollars in LaTeX, see e.g. https://tex.stackexchange.com/questions/503/why-is-preferable-to.

asmeurer commented 4 years ago

I think we should merge this (btw, I don't like how GitHub Actions deletes old logs. Maybe we should just use Travis here).