Skip to content

Commit 10dc11e

Browse files
committed
Update AsciiMath to include changes since v2.6. Resolves issue #1605
1 parent 405687b commit 10dc11e

File tree

1 file changed

+16
-13
lines changed
  • unpacked/jax/input/AsciiMath

1 file changed

+16
-13
lines changed

unpacked/jax/input/AsciiMath/jax.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,13 @@ function createMmlNode(t,frag) {
382382
}
383383

384384
function newcommand(oldstr,newstr) {
385-
AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
386-
tex:null, ttype:DEFINITION}]);
387-
// #### Added from Version 2.0.1 #### //
388-
AMsymbols.sort(compareNames);
389-
for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
390-
// #### End of Addition #### //
385+
AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION});
386+
refreshSymbols();
387+
}
388+
389+
function newsymbol(symbolobj) {
390+
AMsymbols.push(symbolobj);
391+
refreshSymbols();
391392
}
392393

393394
// character lists for Mozilla/Netscape fonts
@@ -666,14 +667,15 @@ function compareNames(s1,s2) {
666667
var AMnames = []; //list of input symbols
667668

668669
function initSymbols() {
669-
var texsymbols = [], i;
670-
for (i=0; i<AMsymbols.length; i++)
670+
var i;
671+
var symlen = AMsymbols.length;
672+
for (i=0; i<symlen; i++) {
671673
if (AMsymbols[i].tex) {
672-
texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
674+
AMsymbols.push({input:AMsymbols[i].tex,
673675
tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype,
674-
acc:(AMsymbols[i].acc||false)};
676+
acc:(AMsymbols[i].acc||false)});
675677
}
676-
AMsymbols = AMsymbols.concat(texsymbols);
678+
}
677679
refreshSymbols();
678680
}
679681

@@ -684,8 +686,7 @@ function refreshSymbols(){
684686
}
685687

686688
function define(oldstr,newstr) {
687-
AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
688-
tex:null, ttype:DEFINITION}]);
689+
AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION});
689690
refreshSymbols(); // this may be a problem if many symbols are defined!
690691
}
691692

@@ -1316,6 +1317,7 @@ else if(typeof window.attachEvent != 'undefined'){
13161317
13171318
//expose some functions to outside
13181319
asciimath.newcommand = newcommand;
1320+
asciimath.newsymbol = newsymbol;
13191321
asciimath.AMprocesssNode = AMprocessNode;
13201322
asciimath.parseMath = parseMath;
13211323
asciimath.translate = translate;
@@ -1409,6 +1411,7 @@ ASCIIMATH.Augment({
14091411

14101412
define: define,
14111413
newcommand: newcommand,
1414+
newsymbol: newsymbol,
14121415
symbols: AMsymbols,
14131416
names: AMnames,
14141417

0 commit comments

Comments
 (0)