81
5.4.1 The HTML Functions
The HTML functions are contained in a package, MSP HTML , which is part of the webMathematica layout. Since
the package is loaded when webMathematica starts there is no need to load the package manually. However, if you
wish to use it in Mathematica outside of webMathematica, you will need to copy the package into your AddOns/Ap
plications directory, this is described in a
previous
section.
HTMLTableForm
As explained above, the MSP HTML package is available for webMathematica and can be installed into regular
Mathematica. It can then be loaded as shown below.
In[1]:=
Needs@"MSP HTML "D
The function HTMLTableForm takes an input and formats it into an HTML table.
In[2]:=
HTMLTableForm@ 88a, b, c<, 8d, e, f<
Out[2]=
It takes a TableHeadings option which works similar to that of TableForm.
In[3]:=
HTMLTableForm@ 88a, b, c<, 8d, e, f<<, TableHeadings O 88r1, r2<, 8c1, c2, c3<
Out[3]=
|
| c1 |
| c2 |
| c3 |
| r1 |
| a |
| b |
| c |
| r2 |
| d |
| e |
| f |
If you wish to apply special formatting to each element, you can provide a formatting function as a second element.
The formatting function must return a string. Here every element is formatted into MathML.
In[4]:=
HTMLTableForm@ 88x^ 2, Sin@xD<<, ExportString@#, "MathML"D &D
.
<
New Page 1
Comcast Web Hosting