JsMath comes with the information necessary to handle six of the TeX fonts: cmr10, cmmi10, cmsy10, cmex10, cmti10 and cmbx10. These are the Computer Modern roman, math italic, math symbol, extended symbol, text italic and bold text fonts. These are also the fonts whose .ttf files are available on the fonts download page. These are adequate for most situations, but some authors will want some of the other TeX fonts. Adding Fonts to jsMath
Several of the additional common fonts are available from the extra-fonts download page. These include the Computer Modern bold italic math font (cmmib10), the AMS Fractur, Greek and caligraphic fonts (eufm10, eurm10 and eusm10), and the AMS math symbol fonts (msam10, msbm10).
To use these fonts in your own pages, first download and unpack the correct
.ZIP
file from the extra-fonts download page. Put the resulting folder into thejsMath/fonts
folder on your server. So if you are planning to use cmmib10, then you should end up with a folder calledjsMath/fonts/cmmbi10
on your server.In the HTML file that will be using the new font, include the line
<SCRIPT> jsMath.Font.Load("cmmib10") </SCRIPT>right after loadingjsMath.js
. That will load the data needed for jsMath to handle the cmmib10 font. Some of the definition files will include macros for accessing the contents of the font; for example, cmmib10 defines\cmmib
for switching to cmmib10 (in the same way that\rm
and\bf
switch fonts in math mode). See the comments within the individual def.js files for details of what is defined by the file.If there are no special macros for accessing the font, you can still produce the various characters from the font by using the
\char{font}{number}
macro, wherefont
is the name of the font andnumber
is the position of the character in the font, either in decimal or hexadecimal. For example,\char{cmmib10}{15}
) and\char{cmmib10}{0x0F}
both should produce a bold italic lower-case epsilon. (See the font tables available on the extra-font download page for the characters available in each font and their positions.)You may need to enclose the
\char
command within a macro like\mathrel
or\mathop
to let jsMath know how you plan to use the symbol. For example, you may use\mathrel{\char{msam10}{0x26}}
to get a greater-than sign over a tilde as a relation, and\mathbin{\char{msam10}{0x01}}
to get a plus-sign in a square as a binary operator. See The TeXBook page 155 for more details on these macros.If you will be using a symbol frequently, you can define a macro to make it easier to access the character. For example
<SCRIPT> jsMath.Macro('boxplus','\\mathbin{\\char{msam10}{0x01}}'); </SCRIPT>(after you loadjsMath.js
) will define\boxplus
so that it produces the plus-sign in a box as a binary operator. See Defining macros for jsMath for more details.
|
|