Comments (4)
Can you summarize the differences between the two math_dollar
implementations?
from theoretical-physics.
sphinx-math-dollar is more rigorous about not parsing dollars that shouldn't be parsed. For instance, if you have a doctest like
>>> print("$x$")
$x$
then sphinx-math-dollar won't parse it, because it ignores docstrings (this was important for SymPy because of the latex()
docstring). It also ignores things in code (double backticks) and other things like that. The way it works is that it uses an AST transformer on the docutils tree, rather than replacing stuff in the raw rst text. So it can tell the difference between dollars in a paragraph and dollars in a code block. The debug environment variable I mentioned will print out any instances of dollars that are not parsed as math, so you can see if there are any.
I also improved the regular expression a little bit to handle some cases the old one wasn't handling correctly. It now no longer incorrectly parses something like
$ cd doc
$ make html
as math, because it ignores it if there is a space after the dollar. There were also some incorrect parsings of escaped dollars, like $13\$ + 14\$$
(I doubt you have any escaped dollars here, but it's worth mentioning).
Eventually I want to add support for double dollars for display math, so you don't have to use .. math::
anymore. I just need to modify the regular expression to parse them, or figure out some better way to lex dollars. If you have any suggestions on a good way to write a simple lexer in Python that can handle backslash escapes, let me know. Currently the regular expression with backtracking to handle the escapes is a bit unwieldy, and it will only get worse if we add double dollar support.
And finally, a lot of other people have shown interest in sphinx-math-dollar (I got a ton of feedback on Twitter). So hopefully it should get some use, and be well maintained. I put it under the sympy
user on GitHub rather than my personal user so that we can maintain it as a community.
from theoretical-physics.
Also your extension doesn't work with docstrings, only stuff in rst files.
from theoretical-physics.
I see, that sounds nice. I'll try it out.
from theoretical-physics.
Related Issues (20)
- Error message format and colors HOT 1
- Modern theme and more options HOT 4
- Typo `\dots` HOT 1
- Review notation in DFT notes
- DFT: review U energies example
- great QM notes
- Check Gaunt coefficients and fix if needed HOT 1
- 6j symbol mistake in HF derivation
- Relation between Fourier transform, series, discrete Fourier transform, etc.
- Stat Mech Notes? HOT 11
- Add complex analysis section
- Add explanation about material derivative to fluid flow
- Add notes about Wirtinger derivatives HOT 2
- Build a version with mathjax HOT 4
- Derivation in section "Total energy" of DFT page is unclear HOT 5
- Add microcanonical treatment of ideal gas
- Breaking math formulas into multiple lines (whether to repeat the sign), possibly automate it
- Improve the gamma function derivation
- Use SVG math instead of png or mathjax HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from theoretical-physics.