File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -550,7 +550,8 @@ MathJax.Hub.Config({
550
550
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
551
551
// formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/[:'"<>&]/g,"")},
552
552
// // element ID to use for reference
553
- // formatURL: function (id) {return '#'+escape(id)}, // URL to use for references
553
+ // formatURL: function (id,base) {return base+'#'+escape(id)},
554
+ // // URL to use for references
554
555
useLabelIds : true // make element ID's use \label name rather than equation number
555
556
} ,
556
557
Original file line number Diff line number Diff line change @@ -53,6 +53,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
53
53
return WW . join ( " " ) ;
54
54
} ;
55
55
56
+ //
57
+ // Get the URL of the page (for use with formatURL) when there
58
+ // is a <base> element on the page.
59
+ //
60
+ var baseURL = ( document . getElementsByTagName ( "base" ) . length === 0 ) ? "" :
61
+ String ( document . location ) . replace ( / # .* $ / , "" ) ;
62
+
63
+
56
64
/******************************************************************************/
57
65
58
66
TEXDEF . Add ( {
@@ -203,7 +211,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
203
211
if ( ! ref ) { ref = { tag :"???" , id :"" } ; AMS . badref = ! AMS . refUpdate }
204
212
var tag = ref . tag ; if ( eqref ) { tag = CONFIG . formatTag ( tag ) }
205
213
this . Push ( MML . mrow . apply ( MML , this . InternalMath ( tag ) ) . With ( {
206
- href :CONFIG . formatURL ( ref . id ) , "class" :"MathJax_ref"
214
+ href :CONFIG . formatURL ( ref . id , baseURL ) , "class" :"MathJax_ref"
207
215
} ) ) ;
208
216
} ,
209
217
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ MathJax.InputJax.TeX = MathJax.InputJax({
42
42
formatNumber : function ( n ) { return n } ,
43
43
formatTag : function ( n ) { return '(' + n + ')' } ,
44
44
formatID : function ( n ) { return 'mjx-eqn-' + String ( n ) . replace ( / [: " ' < > & ] / g, "" ) } ,
45
- formatURL : function ( id ) { return '#' + escape ( id ) } ,
45
+ formatURL : function ( id , base ) { return base + '#' + escape ( id ) } ,
46
46
useLabelIds : true
47
47
}
48
48
} ,
You can’t perform that action at this time.
0 commit comments