Skip to content

Commit 159eb5d

Browse files
committed
Update MathJax to version 4.0.
For the most part, there isn't much that is needed. The javascript files are no longer in the `es5` subdirectory, and the workaround for changing the math renderer was removed (as noted in the comment above it). The `mathInteraction.pg` problem in the student orientation has been updated, although further updates may be needed. The screen shots the problem uses were updated, but someone else might need to create better screen shots. Mine seem to have come out quite a bit smaller than the previous ones. I removed the rather old examples of the `$pg{specialPGEnvironmentVars}{problemPreamble}` and `$pg{specialPGEnvironmentVars}{problemPostamble}` variables in `defaults.config` and `localOverrides.conf.dist` that include examples of doing things with MathJax that weren't even valid for MathJax 3. I also made the deprecation statement for that variables stronger. There is a minor css tweak in `system.scss` to ensure that the MathJax expression eplorer help dialog is above the masthead and stick problem navigation bar. Further modification to the MathJax configuration (in `htdocs/js/MathJaxConfig/mathjax-config.js`) may be needed as per the discussion in issue #2828. But that can wait until we have more information.
1 parent d712732 commit 159eb5d

File tree

12 files changed

+51
-95
lines changed

12 files changed

+51
-95
lines changed
-75.3 KB
Loading
-51.5 KB
Loading

assets/pg/Student_Orientation/mathInteraction.pg

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Once focus is on a math expression, using the space bar will activate the "MathJ
2626
by right-clicking (Windows/Linux) or [|control|]*-clicking (MacOS) a piece of math. Try activating the MathJax menu now.
2727
It should look like the following.
2828

29-
>> [!MathJax contextual menu!]{'mathjaxmenu.png'} <<
29+
>> [!MathJax contextual menu!]{'mathjaxmenu.png'}{140} <<
3030

3131
There are many features that help you to engage with math content. Explore the menu options to survey what is available.
3232

@@ -36,9 +36,9 @@ vision disabilities see the content better. And it may help all users to see som
3636
a moment to explore these settings and select options that you would be comfortable with. (Of course you can change
3737
these settings at any time.)
3838

39-
Also in the main menu, there is an "Accessibility" submenu. In that menu, if accessibility is not already activated,
40-
select "Activate". After activating this, you may need to refresh the web page to see the math expression again. Now you
41-
have the option to see math content verbalized. To do this, place focus onto a math expression and hit [|enter|]*.
39+
Also in the main menu, there is an "Accessibility" submenu. Accessibility is enabled by default, but you can also select
40+
"Show Subtitles" in the "Speech" submenu. This allows you to see math content verbalized. To do this, place focus onto
41+
a math expression and hit [|enter|]*.
4242
* At first, the entire expression is highlighted and there will be a verbal rendering of the expression.
4343
[!Speech string for the quadratic formula!]{'explorerfull.png'}{600}
4444
* Use the down arrow to navigate "down" into a smaller piece of the math expression.
@@ -47,16 +47,16 @@ have the option to see math content verbalized. To do this, place focus onto a m
4747
you can see a verbalization for just this part of the expression above:
4848
[!Speech string for the radicand of the quadratic formula!]{'explorerpiece.png'}{600}
4949
* Return to the MathJax menu, Accessibility submenu, to explore options for how this explorer tool works.
50-
* Under "Speech" you will find options to use MathSpeak, ClearSpeak, or ChromeVox rules. The default is to use
51-
"MathSpeak verbose" rules, which try try to read math "literally" without context. For example, it reads [`(1,3)`] as
52-
"left parenthesis 1 comma 3 right parenthesis". Other speech rules can produce more meaningful verbal renderings. For
53-
example with the right ClearSpeak settings, the same math expression produces "the point with coordinates 1 comma 3"
54-
or "the interval from 1 to 3 not including 1 or 3".
50+
* Under "Speech" you will find options for MathSpeak and ClearSpeak rules. The default is to use "MathSpeak verbose"
51+
rules, which try try to read math "literally" without context. For example, it reads [`(1,3)`] as "left parenthesis 1
52+
comma 3 right parenthesis". Other speech rules can produce more meaningful verbal renderings. For example with the right
53+
ClearSpeak settings, the same math expression produces "the point with coordinates 1 comma 3" or "the interval from 1 to
54+
3 not including 1 or 3".
5555

5656
Some keyboard-navigating users might find it undesirable for each piece of math content to be tab-indexed. If this is
57-
the case, then in the "Accessibility" sub menu you can uncheck "Include in Tab Order". Just note that in order to undo
58-
this and make math content tabbable again, you will need to access the menu, and so you will need some way other than
59-
tabbing to bring focus back to a piece of math content.
57+
the case, then in the "Options" sub menu of the "Accessibility" submenu you can uncheck "Include in Tab Order" and
58+
"Semantic Enrichment". Just note that in order to undo this and make math content tabbable again, you will need to
59+
access the menu, and so you will need some way other than tabbing to bring focus back to a piece of math content.
6060
END_BODY
6161

6262
$images = <<END_BODY;
-50 KB
Loading

conf/defaults.config

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,36 +1240,7 @@ $pg{specialPGEnvironmentVars}{convertFullWidthCharacters} = 0;
12401240
$pg{specialPGEnvironmentVars}{problemPreamble} = { TeX => '', HTML=> '' };
12411241
$pg{specialPGEnvironmentVars}{problemPostamble} = { TeX => '', HTML=>'' };
12421242

1243-
# this snippet checks to see if Moodle has already called MathJax
1244-
# $pg{specialPGEnvironmentVars}{problemPreamble} = { TeX => '', HTML=> <<END_PREAMBLE };
1245-
#
1246-
# <script type="text/x-mathjax-config">
1247-
# if (MathJax.Hub.Startup.params.config && MathJax.Hub.config.config.length) {
1248-
# MathJax.Hub.Config({
1249-
# config: [],
1250-
# skipStartupTypeset: false
1251-
# });
1252-
# }
1253-
# </script>
1254-
# END_PREAMBLE
1255-
1256-
#
1257-
# $pg{specialPGEnvironmentVars}{problemPostamble} = { TeX => '', HTML=> <<END_POSTAMBLE };
1258-
#
1259-
#
1260-
# END_POSTAMBLE
1261-
1262-
# Note! problemPreamble and problemPostamble are becoming depreciated,
1263-
# so you probably wouldn't use them
1264-
# To have the problem body indented and boxed, uncomment:
1265-
#$pg{specialPGEnvironmentVars}{problemPreamble}{HTML} = qq!<div class="problem-content">\n!;
1266-
#$pg{specialPGEnvironmentVars}{problemPostamble}{HTML}= qq!</div>\n!;
1267-
1268-
# To have the problem body indented and boxed, uncomment:
1269-
# $pg{specialPGEnvironmentVars}{problemPreamble}{HTML} = '<BLOCKQUOTE>
1270-
# <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=15 BGCOLOR=#E8E8E8><TR><TD>';
1271-
# $pg{specialPGEnvironmentVars}{problemPostamble}{HTML} = '</TD></TR></TABLE>
1272-
# </BLOCKQUOTE>';
1243+
# Note: problemPreamble and problemPostamble are depreciated, so don't use them.
12731244

12741245
##### PG modules to load
12751246

conf/localOverrides.conf.dist

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -435,25 +435,6 @@ $mail{feedbackRecipients} = [
435435
# use this setting when running Rserve in a docker container.
436436
#$pg{specialPGEnvironmentVars}{Rserve} = {host => "r"};
437437

438-
439-
################################################################################
440-
# Serving Opaque client questions to moodle
441-
################################################################################
442-
443-
444-
# this snippet checks to see if Moodle has already called MathJax
445-
# $pg{specialPGEnvironmentVars}{problemPreamble} = { TeX => '', HTML=> <<END_PREAMBLE };
446-
#
447-
# <script type="text/x-mathjax-config">
448-
# if (MathJax.Hub.Startup.params.config && MathJax.Hub.config.config.length) {
449-
# MathJax.Hub.Config({
450-
# config: [],
451-
# skipStartupTypeset: false
452-
# });
453-
# }
454-
# </script>
455-
# END_PREAMBLE
456-
457438
################################################################################
458439
# Authentication
459440
################################################################################

htdocs/js/MathJaxConfig/mathjax-config.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,6 @@ if (!window.MathJax) {
9898
AM.symbols.splice(i, 0, { input: trigger, ...newTriggers[trigger].symbols });
9999
}
100100

101-
// The following is a workaround for a bug in MathJax when the math renderer is changed.
102-
// Note that this should be removed when we have upgraded to MathJax 4.
103-
const { STATE } = MathJax._.core.MathItem;
104-
const { Menu } = MathJax._.ui.menu.Menu;
105-
const { mathjax } = MathJax._.mathjax;
106-
Menu.prototype.rerender = function (start = STATE.TYPESET) {
107-
this.rerenderStart = Math.min(start, this.rerenderStart);
108-
if (!Menu.loading) {
109-
if (this.rerenderStart <= STATE.COMPILED) this.document.reset({ inputJax: [] });
110-
MathJax.startup.promise.then(() => {
111-
mathjax.handleRetriesFor(() => {
112-
this.document.rerender(this.rerenderStart);
113-
this.rerenderStart = STATE.LAST;
114-
});
115-
});
116-
}
117-
};
118-
119101
return MathJax.startup.defaultReady();
120102
}
121103
},

htdocs/js/System/system.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,3 +1054,7 @@ td.alt-source {
10541054
width: 100%;
10551055
}
10561056
}
1057+
1058+
mjx-help-background {
1059+
z-index: 1055;
1060+
}

htdocs/package-lock.json

Lines changed: 25 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htdocs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"jquery": "^3.7.1",
2222
"jquery-ui-dist": "^1.13.3",
2323
"luxon": "^3.7.1",
24-
"mathjax": "^3.2.2",
24+
"mathjax": "^4.0.0",
2525
"minisearch": "^7.1.2",
2626
"shortcut-buttons-flatpickr": "^0.4.0",
2727
"sortablejs": "^1.15.6"

0 commit comments

Comments
 (0)