|
This extension allows you to have numbered displayed equations and references to those equations within your HTML pages. It uses The
eqn-number
Extension\label
and\ref
macros similar to those in LaTeX. References work both forward and backward, but only to equations within the same file; you would need to hand code the references to equations in other HTML files.Equations can be set to be numbered automatically, or numbers can be requested for specific equations individually. You can set the styles used for the numbering (for example, to make them be on the left rather than the right) and can specify the formats for how the labels and references should appear within the text of your page.
If you want to refer to the number elsewhere in your page, include
\label{ID}
in the TeX code for the displayed equation, whereID
is an identifier that will be used to refer to the equation later on. For example:<DIV CLASS="math"> \label{eqn1} \sqrt{x+1\over x-1} </DIV>would create a numbered equation with an ID ofeqn1
.To refer to an equation with a particular ID, use
\ref{id}
in your web page at the point you want the reference. Note, however, that unlike real TeX or LaTeX, the\ref
command must be within math mode (as jsMath does not process anything outside of math mode), and it must be the only thing in that particular math element. So you could useas seen in equation <SPAN CLASS="math">\ref{eqn1}</SPAN>to refer to the formula labeledeqn1
. If you are using the tex2math plugin, then you could useas seen in equation \(\ref{eqn1}\)to do the same thing, or possiblyas seen in equation $\ref{eqn1}$if you have enabled the single-dollar math delimiters.If you have configured
eqn-number
to perform automatic numbering, then every display-math formula will get an equation number automatically, whether it is labeled or not; otherwise, only those with an explicit\label
command will be numbered. If automatic numbering is in effect, you can prevent specific equations from being numbered by using the\nolabel
command somewhere within the TeX code for the equation.Configuring the
You control the settings for theeqn-number
plugineqn-number
plugin by setting values in thejsMath.EqnNumber
object before loading the plugin.If you want automatic equation numbers, use
<SCRIPT> jsMath.EqnNumber = {autonumber: 1} </SCRIPT>You can control the placement and style of the numbers by setting
<SCRIPT> jsMath.EqnNumber = {styles: { '.jsMath_number': {style-settings}, '.jsMath_ref': {style-settings}, }; </SCRIPT>where style-settings are lists of name-value pairs that indicate the style settings you want to override. The defaults are equivalent to<SCRIPT> jsMath.EqnNumber = {styles: { '.jsMath_number': { position: 'absolute', right: '2em', top: '50%', 'margin-top': '-.5em', height: 'auto', width: 'auto' }, '.jsMath_ref': {'text-decoration': 'none'} }}; </SCRIPT>For example,
<SCRIPT> jsMath.EqnNumber = {styles: { '.jsMath_number': {right: null, left: '1em'} }}; </SCRIPT>would put the numbers on the left at 1em in from the margin.You can control the way the numbers are formatted by supplying a function for
jsMath.EqnNumber.format
. The default is to just return the number, but you could alter this, for example to include a dot:<SCRIPT> jsMath.EqnNumber = {format: function (n) {return n+"."}}}; </SCRIPT>You can also specify how the numbers are used within the labels and references through the
formatLabel
andformatRef
values. The defaults are:<SCRIPT> jsMath.EqnNumber = { formatLabel: function (n) { return '<A NAME="eqn-'+n+'">('+n+')</A>' }, formatRef: function (n) { return '(<A CLASS="jsMath_ref" HREF="#eqn-'+n+'">'+n+'</A>)' } }}; </SCRIPT>Note that these include the HTML code to make a named anchor for the label and a link from the reference. You can override these behaviors by supplying your own functions. For example, you could include the parenthses within the link in a reference if you wish.Loading the
To activate theeqn-number
plugineqn-number
extension, add"extensions/eqn-number.js"
to theloadFiles
array in yourjsMath/easy/load.js
file:loadFiles: ["extensions/eqn-number.js"],If you are using the autoload plugin instead of
easy/load.js
, you can set thejsMath.Autoload.loadFiles
array to include"extensions/eqn-number.js"
in order to have the extension loaded automatically when jsMath is needed.If you are loading
jsMath.js
by hand rather than usingeasy/load.js
or theautoload
plugin, then include the command<SCRIPT> jsMath.Extension.Require("eqn-number"); </SCRIPT>in your HTML file after loading jsMath. Alternatively, you can use<SPAN CLASS="math"> \require{eqn-number} </SPAN>to activate the extension from within the typeset mathematics itself.
|
|