File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -234,12 +234,17 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
234
234
if ( param == null ) { return this . GetArgument ( name ) }
235
235
var i = this . i , j = 0 , hasBraces = 0 ;
236
236
while ( this . i < this . string . length ) {
237
- if ( this . string . charAt ( this . i ) === '{' ) {
237
+ var c = this . string . charAt ( this . i ) ;
238
+ if ( c === '{' ) {
238
239
if ( this . i === i ) { hasBraces = 1 }
239
240
this . GetArgument ( name ) ; j = this . i - i ;
240
241
} else if ( this . MatchParam ( param ) ) {
241
242
if ( hasBraces ) { i ++ ; j -= 2 }
242
243
return this . string . substr ( i , j ) ;
244
+ } else if ( c === "\\" ) {
245
+ this . i ++ ; j ++ ; hasBraces = 0 ;
246
+ var match = this . string . substr ( this . i ) . match ( / [ a - z ] + | ./ i) ;
247
+ if ( match ) { this . i += match [ 0 ] . length ; j = this . i - i }
243
248
} else {
244
249
this . i ++ ; j ++ ; hasBraces = 0 ;
245
250
}
@@ -254,6 +259,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
254
259
*/
255
260
MatchParam : function ( param ) {
256
261
if ( this . string . substr ( this . i , param . length ) !== param ) { return 0 }
262
+ if ( param . match ( / \\ [ a - z ] + $ / i) &&
263
+ this . string . charAt ( this . i + param . length ) . match ( / [ a - z ] / i) ) { return 0 }
257
264
this . i += param . length ;
258
265
return 1 ;
259
266
}
You can’t perform that action at this time.
0 commit comments