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

Math not rendered without network connection (Windows) (Trac #639) #771

Open
ajj opened this issue Mar 30, 2019 · 13 comments
Open

Math not rendered without network connection (Windows) (Trac #639) #771

ajj opened this issue Mar 30, 2019 · 13 comments
Assignees
Labels
Defect Bug or undesirable behaviour Minor Small job
Milestone

Comments

@ajj
Copy link
Member

ajj commented Mar 30, 2019

Testing on Windows 7, a lack of network connection means that the math in the documentation does not get rendered.

On the Mac, it is still being rendered even without a network connection.

I thought that mathjax was being bundled, so this should be working.

Migrated from http://trac.sasview.org/ticket/639

{
    "status": "assigned",
    "changetime": "2017-10-26T12:37:01",
    "_ts": "2017-10-26 12:37:01.721958+00:00",
    "description": "Testing on Windows 7, a lack of network connection means that the math in the documentation does not get rendered.\n\nOn the Mac, it is still being rendered even without a network connection.\n\nI thought that mathjax was being bundled, so this should be working.",
    "reporter": "ajj",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Bug Fixing",
    "time": "2016-08-30T15:07:39",
    "component": "SasView",
    "summary": "Math not rendered without network connection (Windows)",
    "priority": "critical",
    "keywords": "",
    "milestone": "SasView 4.3.0",
    "owner": "ajj",
    "type": "defect"
}
@ajj ajj added this to the SasView 4.3.0 milestone Mar 30, 2019
@ajj ajj self-assigned this Mar 30, 2019
@ajj ajj added Critical High priority Defect Bug or undesirable behaviour Incomplete Migration labels Mar 30, 2019
@butlerpd
Copy link
Member

Trac update at 2016/09/05 14:43:22: butler changed priority from "major" to "critical"

@butlerpd
Copy link
Member

Trac update at 2016/09/05 14:43:55:

  • butler changed owner from "" to "pkienzle"
  • butler changed status from "new" to "assigned"

@pkienzle
Copy link
Contributor

Trac update at 2016/09/07 12:53:51:

  • pkienzle changed _comment0 from:

!MathJax can be shipped with !SasView.

We need to add _static/MathJax to the doc tree, with the following files from the !MathJax distribution (776 kB):

{{{
MathJax.js
config/TeX-AMS-MML_HTMLorMML-full.js
fonts/HTML-CSS/TeX/woff/*
jax/output/HTML-CSS/fonts/TeX/*
}}}

The html header needs the following:
{{{
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": {
//undefinedFamily: ["STIXGeneral, 'Arial Unicode MS', serif"],
preferredFont: "TeX",
availableFonts: ["TeX"],
webFont: "TeX",
imageFont: null
}
});
</script>
</script>
<script type="text/javascript" src="../../_static/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>
}}}

to:

1473255409788826

  • pkienzle changed _comment1 from:

!MathJax can be shipped with !SasView.

We need to add _static/MathJax to the doc tree, with the following files from the !MathJax distribution (776 kB):

{{{
MathJax.js
config/TeX-AMS-MML_HTMLorMML-full.js
fonts/HTML-CSS/TeX/woff/*
jax/output/HTML-CSS/fonts/TeX/*
}}}

The html header needs the following:
{{{
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": {
//undefinedFamily: ["STIXGeneral, 'Arial Unicode MS', serif"],
preferredFont: "TeX",
availableFonts: ["TeX"],
webFont: "TeX",
imageFont: null
}
});
</script>
</script>
<script type="text/javascript" src="../../_static/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>
}}}

We might be able to accomplish this by updating sphinx conf.py with:

{{{
mathjax_path="MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full&delayStartupUntil=configured"
}}}

and adding _templates/layout.html with:
{{{
{% extends "!layout.html" %}

{%- block extrahead %}
<script type="text/javascript">
MathJax.Hub.Config({
// displayAlign: "left",
// displayIndent: "2.5em",
"HTML-CSS": {
//undefinedFamily: ["STIXGeneral, 'Arial Unicode MS', serif"],
preferredFont: "TeX",
availableFonts: ["TeX"],
webFont: "TeX",
imageFont: null
}
});
MathJax.Hub.Configured()
</script>
{% endblock %}
}}}

to:

1473255885801011

  • pkienzle commented:

!MathJax can be shipped with !SasView.

We need to add _static/MathJax to the doc tree, with the following files from the !MathJax distribution (776 kB):

    MathJax.js
    config/TeX-AMS-MML_HTMLorMML-full.js
    fonts/HTML-CSS/TeX/woff/*
    jax/output/HTML-CSS/fonts/TeX/*

The html header needs the following:

    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      "HTML-CSS": {
        //undefinedFamily: ["STIXGeneral, 'Arial Unicode MS', serif"],
        preferredFont: "TeX",
        availableFonts: ["TeX"],
        webFont: "TeX",
        imageFont: null
      }
    });
    </script>
    </script>
    <script type="text/javascript" src="../../_static/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>

We might be able to accomplish this by updating sphinx conf.py with:

    mathjax_path="MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full&delayStartupUntil=configured"

and adding _templates/layout.html with:

{% extends "!layout.html" %}

{%- block extrahead %}
       <script type="text/javascript">
       MathJax.Hub.Config({
           // displayAlign: "left",
           // displayIndent: "2.5em",
           "HTML-CSS": {
             //undefinedFamily: ["STIXGeneral, 'Arial Unicode MS', serif"],
             preferredFont: "TeX",
             availableFonts: ["TeX"],
             webFont: "TeX",
             imageFont: null
           }
       });
       MathJax.Hub.Configured()
       </script>
{% endblock %}

There are a few options for including !MathJax with !SasView:

  • Add the 776 kB of binary files to sasmodels or to sasview that you update from time to time with the latest !MathJax?

  • Pull a particular tagged version of !MathJax from [https://github.com/mathjax/MathJax/releases github] as part of the build, and copy the appropriate files and subdirectories?

  • Use [https://git-scm.com/book/en/v2/Git-Tools-Submodules git submodules] to link directly to !MathJax?

@butlerpd
Copy link
Member

Trac update at 2016/09/13 14:26:06:

  • butler commented:

maybe best to move to 4.1? We could provide a PDF downladable somewhere?

  • butler changed owner from "pkienzle" to "ajj"

@rozyczko
Copy link
Member

Trac update at 2016/09/20 13:44:10:

  • piotr changed _comment0 from:

This is slightly more convoluted. On my windows box I need to also add fonts/HTML-CSS/TeX/eot/*

Also, extensions/ is required if we want to enable right-click context menu, as in the online version.
It is possible than on other machines/systems/OSes we need to add more subdirectories in fonts/*

Obviously adding everything is not an option, as uncompressed MathJax is 172MB.

to:

1474379141909554

  • piotr commented:

This is slightly more convoluted. On my windows box I need to also add

fonts/HTML-CSS/TeX/eot/*

Also,

extensions/

is required if we want to enable right-click context menu, as in the online version.
It is possible than on other machines/systems/OSes we need to add more subdirectories in fonts/*

Obviously adding everything is not an option, as uncompressed MathJax is 172MB.

@ajj
Copy link
Member Author

ajj commented Mar 30, 2019

Trac update at 2016/09/23 14:18:40: ajj commented:

https://github.com/mathjax/MathJax-grunt-cleaner/blob/master/Gruntfile.js

seems to be the "official" way to do this - clone the repo and run grunt. However, this is yet another lot of infrastructure.

If it is all local, we should probably just have a script to pull in the right bits and update occasionally as mathjax changes.

@butlerpd
Copy link
Member

Trac update at 2016/09/27 14:35:20:

  • butler commented:

a bit annoying when no network is available but not a show stopper and needs a bit more care than 2 days before a release -- moving to 4.1

  • butler changed milestone from "SasView 4.0.0" to "SasView 4.1.0"

@butlerpd
Copy link
Member

Trac update at 2016/10/11 17:36:22:

  • butler commented:

Didn't get addressed at code camp so moving to 4.2

  • butler changed milestone from "SasView 4.1.0" to "SasView 4.2.0"

@RichardHeenan
Copy link
Contributor

Trac update at 2016/10/19 10:06:31: richardh commented:

19th Oct 2016, on my windows 7 desktop, the equations in the docu are rendering only slowly if at all. Before they do render a message pops up briefly at bottom on docu screen which says:

File failed to load: https://cdn.mathjax.org/mathjax/contrib/a11y/accessibility-menu.js

Is this a different issue to the above, or is it just flaky web access here?

Richard

@ajj
Copy link
Member Author

ajj commented Mar 30, 2019

Trac update at 2017/05/17 12:12:54: ajj commented:

From #1025 ...

Longer term, need to replace mathjax with katex, which is faster and smaller and easier to bundle with the application. This is closer to working on Qt than it is in wx.

@butlerpd
Copy link
Member

Trac update at 2017/10/26 12:37:01: butler changed milestone from "SasView 4.2.0" to "SasView 4.3.0"

@butlerpd butlerpd modified the milestones: SasView 4.3.0, SasView 5.1.0 Apr 26, 2020
@butlerpd butlerpd added Minor Small job and removed Critical High priority labels Apr 26, 2020
@butlerpd
Copy link
Member

This issue remains but have not had much of a problem of late nor heard a lot of complaints. Is bundling Katex still something we want to do? I note that @ajj says it is easier in Qt so definitely a 5.x if we want to deal with it? will move it to 5.1 (and drop importance to minor) for now so we can decide what to do.

@pkienzle
Copy link
Contributor

There is a katex package for sphinx, so this may be easy to do now.

You can bundle katex with the docs with fonts, min.css, and min.js for offline use (~2 MB). This may lead to longer load times (CDNs cache packages close to the user), but user privacy may improve (depending on how much tracking is done by CDNs).

The sphinx package has a pre-rendering option, but it doesn't buy us much: we still need the 1.5 MB of fonts and the 1/4 MB of javascript to render help for user defined models in exchange for slightly faster pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Bug or undesirable behaviour Minor Small job
Projects
None yet
Development

No branches or pull requests

6 participants