Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #490

Closed
wants to merge 11 commits into from
Closed

Documentation #490

wants to merge 11 commits into from

Conversation

ehogan
Copy link

@ehogan ehogan commented Jul 15, 2011

No description provided.

asmeurer and others added 9 commits June 30, 2011 23:26
See https://bitbucket.org/kevindunn/sphinx-extension-mathjax/wiki/Home
and
https://groups.google.com/forum/#!msg/sphinx-dev/SkLZlqapcM8/tI2qk5uTY3gJ.

MathJax renders the LaTeX equations in the browser.  This has several
advantages:

- Compiling the Sphinx docs from scratch is *way* faster, since it
doesn't have to compile the LaTeX images.  Previously on my machine, it
took about half an hour to compile from scratch (mainly due to heavy
LaTeX use in the mpmath docs).  Now it only takes a couple of minutes.

- Because no LaTeX images are stored, the overall size of the compiled
docs is smaller.

- The rendered math in the browser is selectable (which also means it's
searchable), and crisp at arbitrary zoom levels, since it renders the
math using actual fonts, not images.  So it's just like an equation in a
regular LaTeX pdf document.

- You can right click on the equation and get a menu that will show the
source.  As a side benefit, you can also use this to convert the LaTeX
to mathml.

- No changes are required in the source files.  This uses the same
:math: pragma as the previous system, so it's very swappable.

- This currently uses an online version of the mathjax.js file that is
free to use for production, but this can easily be downloaded and used
locally for offline use.

Disadvantages:

- You will not be warned about LaTeX errors at doc compile time.  The
only way I know to find them is to look at all the rendered html files
for yellow MathJax error boxes.  Perhaps there is a more streamlined way
to do this, though.

- There currently are some errors in the GA docs, due to some strange
control sequences like \W and \lbrk.  I'm not sure where these are
defined, but this will have to be fixed if we use this.

- Your browser has to render the math at load time, which makes it a
little slower for LaTeX intensive pages.  Actually, it isn't too bad.
And it seems to render from the top down, so you can see the math at the
top almost immediately.  And while it is rendering, you see the LaTeX
source, so you can at least read it.

To compare this against the old system, do

cd doc
make clean # To clear the old docs
make html

And open a LaTeX intensive page like
_build/html/modules/mpmath/functions/hypergeometric.html in your browser
and compare it against the current page at docs.sympy.org (in this case,
http://docs.sympy.org/0.7.0/modules/mpmath/functions/hypergeometric.html#mpmath.hyp0f1).

Note how with the MathJax, you can select parts of the math equations,
you can zoom in (using your browser's zoom functionality) without any
loss of resolution, and you right click on the equation to get the
source.
I previously didn't notice that directory exists for extensions.  This
is cleaner, and prevents the need to add . to the path in conf.py.
This version seems to be newer.  One change I noticed is that bad math
now no longer gives a yellow box with an error message, but rather
renders what it can with the bad parts in red.
I didn't realize that this extension just converts $math$ into `math`.
This extension converted $math$ to `math` so it would render as LaTeX in
Sphinx documents.  There were problems with the extension (see issue
2537).

I changed all instances of $math$ throughout SymPy to `math`.  I also
changed some ``math`` in the polys code to `math`, though this is still
very inconsistant (I at least tried to be consistant within a file).
Note that two backticks (``) causes the text to printed verbatim in a
monospace font in Sphinx.
This adds a "source" link next to every function definition in the docs,
which shows you to the source of function.  The entire source of every
file for which at least one function or class is included in the docs is
included.  See issue 2561.
@asmeurer
Copy link
Member

She is here with us at the SciPy sprint, and I had her based her stuff against my mathjax branch, she is working on documentation. The additional commits should go away when we get that in (and I am working on it now, so that should be soon)

@asmeurer
Copy link
Member

The changes look good so far. Let's wait for pull #491, since this is based on that.

@certik
Copy link
Member

certik commented Jul 18, 2011

Awesome patch, thanks! It doesn't seem to apply cleanly anymore, so it needs to be rebased.

@asmeurer
Copy link
Member

@certik, I was planning on doing this myself after #491 gets in. Of course, if @ehogan wants to do it herself, we can help. It just won't be as easy as me standing over her shoulder and telling her what commands to execute :)

@asmeurer
Copy link
Member

I included a rebased version in the 0.7.1 branch. Welcome to SymPy!

@asmeurer asmeurer closed this Jul 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants