Allow element ID's to use \label name rather than equation number (optionally). Requested in issue #71.
This commit is contained in:
parent
44344c7142
commit
f4eecb684e
|
@ -393,13 +393,14 @@ MathJax.Hub.Config({
|
|||
// Equation numbering parameters.
|
||||
//
|
||||
equationNumbers: {
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+n}, // element ID to use for reference
|
||||
// formatURL: function (n) {return '#mjx-eqn-'+escape(n)}, // URL to use for references
|
||||
|
||||
autoNumber: "none" // "AMS" for standard AMS environment numbering,
|
||||
// or "all" to number all displayed equations
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/[:'"<>&]/g,"")},
|
||||
// // element ID to use for reference
|
||||
// formatURL: function (id) {return '#'+escape(id)}, // URL to use for references
|
||||
useLabelIds: true // make element ID's use \label name rather than equation number
|
||||
}
|
||||
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.10",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%",equationNumbers:{autoNumber:"none",formatNumber:function(a){return a},formatTag:function(a){return"("+a+")"},formatID:function(a){return"mjx-eqn-"+a},formatURL:function(a){return"#mjx-eqn-"+escape(a)}}}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.10",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%",equationNumbers:{autoNumber:"none",formatNumber:function(a){return a},formatTag:function(a){return"("+a+")"},formatID:function(a){return"mjx-eqn-"+String(a).replace(/[:"'<>&]/g,"")},formatURL:function(a){return"#"+escape(a)},useLabelIds:true}}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
|
||||
|
|
|
@ -393,13 +393,14 @@ MathJax.Hub.Config({
|
|||
// Equation numbering parameters.
|
||||
//
|
||||
equationNumbers: {
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+n}, // element ID to use for reference
|
||||
// formatURL: function (n) {return '#mjx-eqn-'+escape(n)}, // URL to use for references
|
||||
|
||||
autoNumber: "none" // "AMS" for standard AMS environment numbering,
|
||||
// or "all" to number all displayed equations
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/[:'"<>&]/g,"")},
|
||||
// // element ID to use for reference
|
||||
// formatURL: function (id) {return '#'+escape(id)}, // URL to use for references
|
||||
useLabelIds: true // make element ID's use \label name rather than equation number
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -175,8 +175,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
var ref = AMS.labels[label] || AMS.eqlabels[label];
|
||||
if (!ref) {ref = "??"; AMS.badref = !AMS.refUpdate}
|
||||
var tag = ref; if (eqref) {tag = CONFIG.formatTag(tag)}
|
||||
if (CONFIG.useLabelIds) {ref = label}
|
||||
this.Push(MML.mrow.apply(MML,this.InternalMath(tag)).With({
|
||||
href:CONFIG.formatURL(ref), "class":"MathJax_ref"
|
||||
href:CONFIG.formatURL(CONFIG.formatID(ref)), "class":"MathJax_ref"
|
||||
}));
|
||||
},
|
||||
|
||||
|
@ -395,7 +396,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
*/
|
||||
getTag: function () {
|
||||
var global = this.global, tag = global.tag; global.tagged = true;
|
||||
if (global.label) {AMS.eqlabels[global.label] = global.tagID}
|
||||
if (global.label) {
|
||||
AMS.eqlabels[global.label] = global.tagID;
|
||||
if (CONFIG.useLabelIds) {tag.id = CONFIG.formatID(global.label)}
|
||||
}
|
||||
delete global.tag; delete global.tagID; delete global.label;
|
||||
return tag;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,9 @@ MathJax.InputJax.TeX = MathJax.InputJax({
|
|||
// or "all" for all displayed equations
|
||||
formatNumber: function (n) {return n},
|
||||
formatTag: function (n) {return '('+n+')'},
|
||||
formatID: function (n) {return 'mjx-eqn-'+n},
|
||||
formatURL: function (n) {return '#mjx-eqn-'+escape(n)}
|
||||
formatID: function (n) {return 'mjx-eqn-'+String(n).replace(/[:"'<>&]/g,"")},
|
||||
formatURL: function (id) {return '#'+escape(id)},
|
||||
useLabelIds: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user