Opened 7 years ago

Closed 7 weeks ago

# Don't strip MathJax fonts

Reported by: Owned by: novoselt critical sage-duplicate/invalid/wontfix packages: standard fbissey, vbraun, mjo Kwankyu Lee N/A

### Description

Current MathJax package strips SVG and PNG fonts, but there are cases when for some reason normal fonts are not shown.

In addition, having not SVG fonts but choosing SVG rendrer makes MathJax menu unavailable on the webpage without a clear fix (refreshing does not show any formulas at all).

One of the reasons for stripping PNG fonts was that they are copied to all folders in the documentation - this wastes gigabytes of space and has to be addressed.

### comment:1 Changed 7 years ago by novoselt

Extra data point - I've cloned MathJax repository and put it into local/share/mathjax instead of the standard Sage one for our campus cell server. Now Firefox works fine in the labs - still cannot get the webfonts and it takes a while on the first load to switch to image fonts, but they look satisfactory and SVG works too (with possibility of switching back).

### comment:2 follow-up: ↓ 3 Changed 7 years ago by tmonteil

According to this page (which i used to write the stripping script), there should be no problem with firefox since woff fonts are not stripped and supported by firefox, see this page. So i guess that if you encounter a problem, it is probably due to some misconfiguration somewhere. Could you please give a way to reproduce the bad formatting (which Sage commmand, in which notebook, whith which browser, etc) ?

### comment:3 in reply to: ↑ 2 Changed 7 years ago by novoselt

So i guess that if you encounter a problem, it is probably due to some misconfiguration somewhere.

Probably, but PNG fonts help to deal with such situations in a decent way and so far I heard no clear reason to strip away SVG.

Could you please give a way to reproduce the bad formatting (which Sage commmand, in which notebook, whith which browser, etc) ?

Any command in Firefox producing a formula in either SageNB (for Sage-6.7) or SageMathCell (running a slightly customized Sage-6.7). But first come to our campus and go to a computer lab. I don't know what exactly is off with setup/setting there - my point is that having PNG/SVG fonts would help with this. If it is the fault of our IT guys, I am pretty sure they are not the worst in the world and other people may be in the same situation.

### comment:4 Changed 6 years ago by mjo

I've had [Math Processing Error] for every bit of math in my documentation for years now. I just figured out that I can work around that by installing the STIX fonts (http://www.stixfonts.org/) on my machine and restarting firefox.

### comment:5 Changed 5 years ago by mjo

I've spent another entire day trying to get my mathematics software to display mathematics. It's rather infuriating. Something changed in the last few months and the stix-fonts workaround (alone) no longer helps.

This is stupid, but it works and it doesn't take four hours to test:

#!/bin/bash
#
# Replace references to Sage's MathJax with the version from the CDN,
# which actually works.
#

if (( $# < 1 )); then echo "Usage:${0} <paths-to-html-files>"
exit 1
fi

# The <script> tag for Sage's MathJax.
OLDJAX='<script type="text/javascript" src="../../_static/MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js"></script>'

# The <script> tag for a working MathJax.
NEWJAX='<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'

# Escape front-slashes in OLD/NEWJAX because otherwise sed will choke
# on them (you can use a different separator in an "s/foo/bar/" match,
# but not in the "1,<pattern>" construct).
OLDJAX="${OLDJAX//\//\\/}" NEWJAX="${NEWJAX//\//\\/}"

# Replace the FIRST reference to Sage's MathJax with the CDN version.
# Then delete the REST of the Sage MathJax instances. Why is the same
# script loaded more than once? You've got me!
sed --in-place \
--expression="1,/${OLDJAX}/ s/${OLDJAX}/${NEWJAX}/" \ --expression="/${OLDJAX}/d" \
\$@


### comment:6 Changed 5 years ago by novoselt

Well, with CDN you can't use files offline (does not really matter if they are not working anyway).

SageMathCell is not using Sage's MathJax? anymore since we don't care about offline usage at all.

Do you have problems with sort-of-end-of-lifed SageNB, or are you talking about plain doc pages in a browser? Those presumably still should be a high priority for people to fix, e.g. by figuring out how to NOT copy MathJax? into every subfolder and then stop stripping it from anything.

### comment:7 Changed 21 months ago by mkoeppe

• Milestone changed from sage-6.8 to sage-9.3

### comment:8 Changed 16 months ago by mkoeppe

• Milestone changed from sage-9.3 to sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

### comment:9 Changed 11 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

### comment:10 Changed 7 months ago by mkoeppe

• Milestone changed from sage-9.5 to sage-9.6

### comment:11 Changed 3 months ago by mkoeppe

• Milestone changed from sage-9.6 to sage-9.7

### comment:13 Changed 3 months ago by novoselt

• Status changed from new to needs_review

The problem here was for SageNB, which is EOL, and SageMathCell, where we use CDN MathJax? now. So I think this problem was not solved, but it is no longer relevant.

### comment:14 Changed 3 months ago by novoselt

• Milestone changed from sage-9.7 to sage-duplicate/invalid/wontfix

### comment:15 Changed 3 months ago by klee

• Reviewers set to Kwankyu Lee
• Status changed from needs_review to positive_review

Okay

### comment:16 Changed 7 weeks ago by mkoeppe

• Resolution set to invalid
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.