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

Problem with runing sphinx with mathjax offline #4309

Closed
eflanigan00 opened this issue Dec 16, 2017 · 8 comments
Closed

Problem with runing sphinx with mathjax offline #4309

eflanigan00 opened this issue Dec 16, 2017 · 8 comments

Comments

@eflanigan00
Copy link

I'm trying to run sphinx offline with mathjax. I'm using the anaconda distribution which runs ipython notebook with latex (mathjax I think) just fine.

I have sphinx.ext.mathjax in the extensions and everything works fine when I'm online. When I go offline the latex equations don't render.

I've added the following to try to get mathjax to use the one I think ipython notebook is using:

mathjax_path = 'C:\ProgramData\Anaconda3\Lib\site-packages\notebook\static\components\MathJax\MathJax.js'

I checked the path and it has a config/TeX-AMS-MML_HTMLorMML-full.js so I also tried:

mathjax_path = 'C:\ProgramData\Anaconda3\Lib\site-packages\notebook\static\components\MathJax\MathJax.js?config=TeX-AMS-MML_HTMLorMML-full'

Anyone have any idea how to get this to work from the mathjax provided in Anaconda?

@tk0miya
Copy link
Member

tk0miya commented Dec 17, 2017

This is an issue list of Sphinx. Did you mean this is a bug of sphinx (or request for sphinx) ?
FYI: Here is a forum for Sphinx: https://groups.google.com/forum/#!forum/sphinx-users

BTW, I guess the windows path causes an error. How about use r'...' string?

@eflanigan00
Copy link
Author

eflanigan00 commented Dec 18, 2017

I think thinks is a bug of sphinx.
I can't get the mathjax_path to work with the anaconda distribution when offline.
As I said the ipython notebook works. So in theory sphinx should also work.

I'm happy to try to debug it if someone can tell me where to start looking.

I tried with r'', I tried delimiting with C:\, I tried C:/
None of them seemed to work.

@tk0miya
Copy link
Member

tk0miya commented Dec 21, 2017

Okay, could you try to add file:// suffix to the mathjax_path please?
In my short investigation, it should have an URL, not a path.

@eflanigan00
Copy link
Author

Thank you tk0miya, that worked:

 mathjax_path = 'file://C:/ProgramData/Anaconda3/Lib/site-packages/notebook/static/components/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full.js'

@eflanigan00
Copy link
Author

eflanigan00 commented Dec 22, 2017

Now mathjax doesn't render bmatrix correctly. The following only puts parenthesis by def, I need the parensthesis to extend the height of the full matrix.

.. math::

   \mathbf{A_{X}} =
   \begin{bmatrix}
   abc \\
   def \\
   ghi \\
  \end{bmatrix}

Also posted here:
https://stackoverflow.com/questions/47841950/sphinx-mathjax-offline-with-anaconda-distribution

@eflanigan00
Copy link
Author

eflanigan00 commented Feb 4, 2018

Testing with a fresh download of MathJax/config/default.js seems to work fine.
I think anaconda doesn't ship with the full mathjax to support what I'm trying to do.

This is what I need:

mathjax_path = 'file://C:/ProgramData/Anaconda3/Lib/site-packages/notebook/static/components/MathJax/MathJax.js?config=default.js'

@Alleno
Copy link

Alleno commented Jul 3, 2018

I tried to specify the mathjax_path, but it doesn't seem to cause any changes in the output file path, I'm still getting <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

Is this an option to add at the end of conf.py, at the leftmost indentation of the file?

@tk0miya
Copy link
Member

tk0miya commented Jul 17, 2018

@Alleno How did you configure it? Please share your conf.py as a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants