wko27 / react-mathjax

MathJax as React component
MIT License
168 stars 71 forks source link

Using local matjax script #5

Open abdurahmanus opened 6 years ago

abdurahmanus commented 6 years ago

Hello, is it possible to use local matjax script? from file system, without network request?

abdurahmanus commented 6 years ago

I'm using webpack, so actually I'm more interested in importing MathJax script from node_modules for example. Is it possible?

toadeelali commented 5 years ago

Have you found any solution?

DavidSichau commented 5 years ago

Simply pass your local url as source:

  <MathJax.Context
          input="tex"
          script="/MathJax/MathJax.js"
>
toadeelali commented 5 years ago

Ok I'll try this and will let you know.

Currently I'm using old way of using Mathjax. I compile code and attach Mathjax with index.html

ByronBecker commented 5 years ago

Any updates of how this worked out? In testing this locally, I'm currently receiving a

MathJax.js:19 GET http://localhost:8080/MathJax-2.7.5/extensions/MathZoom.js?V=2.7.5 net::ERR_ABORTED 404 (Not Found)

with the same error for the MathMenu extension when trying this option. I've also tried putting the MathZoom.js and MathMenu.js files under the same extensions/xxx path, as well as unzipping and importing the entire MathJax project into my project (with the hopes of extracting what is absolutely necessary later) to no avail.

Any example projects/code of doing this would be greatly appreciated 👍

wooloba commented 4 years ago

@ByronBecker I ran into that problem before. Simply add

<script type="text/x-mathjax-config">
        MathJax.Ajax.config.path["extensions"] = "../somePathToYourMathJax/MathJax";
    </script>

inside your index.html under public folder.

Then, inside mathjax.config, you can import extensions using ["extensions"]/XXX.js. Or in this case, you can do someting like ["extensions"]/MathJax.js

Inside any extensions, make sure you have MathJax.Ajax.loadComplete("[Extra]/XXX.js");