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

Don't strip MathJax fonts #18596

Closed
novoselt opened this issue Jun 2, 2015 · 11 comments
Closed

Don't strip MathJax fonts #18596

novoselt opened this issue Jun 2, 2015 · 11 comments

Comments

@novoselt
Copy link
Member

novoselt commented Jun 2, 2015

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.

CC: @kiwifb @vbraun @orlitzky

Component: packages: standard

Reviewer: Kwankyu Lee

Issue created by migration from https://trac.sagemath.org/ticket/18596

@novoselt novoselt added this to the sage-6.8 milestone Jun 2, 2015
@novoselt
Copy link
Member Author

novoselt commented Jun 2, 2015

comment:1

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).

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Jun 3, 2015

comment:2

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) ?

@novoselt
Copy link
Member Author

novoselt commented Jun 4, 2015

comment:3

Replying to @sagetrac-tmonteil:

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.

@orlitzky
Copy link
Contributor

comment:4

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.

@orlitzky
Copy link
Contributor

comment:5

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" \
    $@

@novoselt
Copy link
Member Author

comment:6

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.

@mkoeppe mkoeppe modified the milestones: sage-6.8, sage-9.3 Oct 8, 2020
@mkoeppe
Copy link
Member

mkoeppe commented Mar 15, 2021

comment:8

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

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Mar 15, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 11, 2022
@kwankyu
Copy link
Collaborator

kwankyu commented Apr 14, 2022

comment:12

See #25833 comment:67.

@novoselt
Copy link
Member Author

comment:13

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.

@novoselt novoselt removed this from the sage-9.7 milestone Apr 14, 2022
@kwankyu
Copy link
Collaborator

kwankyu commented Apr 14, 2022

Reviewer: Kwankyu Lee

@kwankyu
Copy link
Collaborator

kwankyu commented Apr 14, 2022

comment:15

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants