[VCLab-Main] [Software] [HotEqn]

# HotEqn

## The IMGless Equation Viewer Applet

 HotEqn is a AWT-based Java applet to view and display mathematical equations on the Web. The applet uses the familiar LaTeX notation to code its equations. Fontsizes are variable, so the applet can be used to display inline equations as well. The window below shows the output of an applet.

Try out various LaTeX expressions. Simply type your code in the text
area above and click on with your left mouse button.
Try also a right mouse button click in the applet window.

Mathematics ---- LaTeX ---- LaTeX Primer ---- Applets ---- Developer
HotEqn ---- cHotEqn ----sHotEqn ---- dHotEqn ---- mHotEqn ---- Inheritance
FAQ --- Update --- Errors

### New: Version 4.00

• AWT component based applet implementation
• Swing component available
• mHotEqn compatible with XPCOM scriptability

### Viewing mathematics with HotEqn

The applet scans and parses LaTeX strings. In the example shown above, a LaTeX string has been given as an applet parameter. After pressing the button "Set", the string entered in the text area, is interpreted and fonts are downloaded from the server where the applet is stored on. This may take a while and is shown by the red hour glass symbol in the center of the applet window. Load activities and error messages are displayed in the Navigator's status line.

### The LaTeX language support

The applet supports the LaTeX mathematics described in chapter 5 of the books of H. Kopka. With the exception of some seldom used features, the full mathematics style is available. The display of formulas may look slightly different from that of the printed version. In addition to the base language set, some extensions to LaTeX are introduced, which make the display on the screen more comfortable. A short look on the LaTeX features is included in the primer section.

### A short look on the applet set

The equation viewer comes up with three different applet versions:
HotEqn
is the kernel applet for equation viewing. This applet supports all LaTeX features, but does not include methods for equation editing, variable substitution, and for more sophisticated interactive elements. This applet is preferably for only showing mathematics statically. A minimum of mouse operations for debugging purposes is supported.
dHotEqn
is a dynamical superclass extension of the base applet. It has the same functionality as the base plus methods for setting equations, left- and right-side equation setting and extraction, and the facilities to substitute dynamically variables by expressions from other applet instants on the same page on mouse clicks. This is the applet shown at the top of this page.
mHotEqn
is a dynamical superclass extension of the dHotEqn applet. It has the same functionality as dHotEqn plus methods for interaction with MATLAB. Expressions or m-files associated with the applet can be send on click to MATLAB and executed by the MATLAB machine. Results from MATLAB can be imported in LaTeX notation and represented on mouse click or requested periodically. This applet needs the MATLAB plugin.

### HotEqn developers edge

For those who intend to use HotEqn locally or from their home server, the applet should be stored on their sites. The HotEqn applet is freeware and can be downloaded from the download section on the developers edge page. The applet consists of a set of class and font files, which are described on the developers edge page.

### A HotEqn LaTeX primer

The following sections lists all LaTeX features of the HotEqn applet. More details on specific parts can be found on separate example pages. If you click on the eye in the specific row, you will see equations generated from the HotEqn applet.

The code syntax description uses the following notation:

• LaTeX command elements are shown in bold blue.
• A LaTeX entity, which is a LaTeX command or a string without including a separator, is marked as <ent>.
• A LaTeX group, which consists of a string of entities, is marked as <grp>.
• Parts of LaTeX commands and strings included in [ ] are optional.
• A LaTeX expression, marked by <eqn>, may be a <ent> or a { <grp> }.
• Both, <ent> and <grp> may be empty.
• Text in italics is comment.
• LaTeX command elements signed by *) are HotEqn extensions.
Elements Code Syntax Examples
Operators  + - * / = < > # ~ ; : , !
Subscripts  _<eqn>
Superscripts  ^<eqn>
Fractions  \frac<eqn numerator><eqn denominator>
Square Roots  \sqrt[[<grp>]]<eqn>
Sums  \sum[_<eqn lower limit>][^<eqn upper limit>]
Products  \prod[_<eqn lower limit>][^<eqn upper limit>]
Integrals  \int[_<eqn lower limit>][^<eqn upper limit>] \oint[_<eqn lower limit>][^<eqn upper limit>]
Accents
 \acute \bar \dot \ddot \grave \hat \tilde \vec \widehat \widetilde 
Functions  \arccos \arcsin \arctan \arg \cos \cosh \cot \coth \csc \def \deg \det \dim \exp \gcd \hom \ker \lg \ln \log \sec \sin \sinh \tan \tanh 
 \det[_] \gcd[_] \inf[_] \lim[_] \liminf[_]   \limsup[_] \max[_] \min[_] \Pr[_] \sup[_] 
Brackets  \left<char> \right<char> <char> <char> :=  (  )  [  ]  {  }  |  \|  .(dot)  \langle  \rangle 
Overline
Underline
 \overline<eqn> \underline<eqn>
Overbrace
Underbrace
 \overbrace<eqn>[^<eqn>] \underbrace<eqn>[_<eqn>]
Stackrel  \stackrel<eqn upper><eqn lower>
Choose
Atop
 { <grp upper> \choose <grp lower>}
 { <grp upper> \atop <grp lower> }
Additional Space  \quad \qquad \, \: \; \!
Arrays  \begin{array}{<format>} <grp> [& <grp>][\\ <grp>[& <grp>]]\end{array}
 \begin{eqnarray} <grp> [& <grp>][\\ <grp>[& <grp>]]\end{eqnarray}
 \array{ <grp> [& <grp>][\\ <grp>[& <grp>]]}*)
Text  \mbox{<text>}
Framebox  \fbox<eqn>
Foreground
Background color
\fgcolor{ rrggbb }<eqn>*)
\bgcolor{ rrggbb }<eqn>*)
Greek symbols  \alpha \beta \gamma \delta \epsilon \varepsilon \zeta \eta \theta \vartheta \iota \kappa \lambda \mu \nu \xi \pi \varpi \rho \varrho \sigma \varsigma \tau \upsilon \phi \varphi \chi \psi \omega \Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \sum \prod Loading these examples

may take some time!
Binary symbols  \pm \mp \times \div \cdot \cdots \vdots \ldots \ddots \ast \star \dagger \ddagger \amalg \cap \cup \uplus \sqcap \sqcup \vee \wedge \setminus \wr \circ \bullet \diamond \lhd \rhd \unlhd \unrhd \oslash \odot \bigcirc \Box \Diamond \bigtriangleup \bigtriangledown \triangleleft \triangleright \oplus \ominus \otimes  Loading these examples

may take some time!
Relationial symbols  \le \leq \ll \subset \subseteq \sqsubset \sqsubseteq \in \vdash \models \ge \geq \gg \supset \supseteq \sqsupset \sqsupseteq \ni \dashv \perp \neq \doteq \approx \cong \equiv \propto \prec \preceq \parallel \sim \simeq \asymp \smile \frown \bowtie \succ \succeq \mid  Loading these examples

may take some time!
Negation \not<eqn>
Arrows  \leftarrow \gets \Leftarrow \rightharpoonup \rightarrow \to\rightharpoondown \Rightarrow \leadsto \leftrightarrow \uparrow \Leftrightarrow \Uparrow \mapsto \downarrow \Downarrow \leftharpoonup \updownarrow \leftharpoondown \Updownarrow \rightleftharpoons \nearrow \longleftarrow \searrow \Longleftarrow \swarrow \longrightarrow \nwarrow \Longrightarrow \longleftrightarrow \Longleftrightarrow \longmapsto \hookrightarrow \hookleftarrow Loading these examples

may take some time!
Other symbols  \aleph \forall \hbar \exists \imath \neg \jmath \flat \ell \natural \wp \sharp \Re \angle \Im \backslash \mho \prime \emptyset \triangle \nabla \clubsuit \diamondsuit \partial \heartsuit \top \spadesuit \bot \Join \infty \Laplace \Fourier Loading these examples

may take some time!

## HotEqn Family Inheritance

java.lang.Object
|
+----java.awt.Component
|
+----atp.cHotEqn
|
+----javax.swing.JComponent
|
+----atp.sHotEqn

java.applet.Applet
|
+---HotEqn - atp.cHotEqn
|
+---dHotEqn
|
+---mHotEqn

public class cHotEqn
extends Component
implements MouseListener, MouseMotionListener
public class sHotEqn
extends JComponent
implements MouseListener, MouseMotionListener
public class HotEqn
extends Applet
public class dHotEqn
extends HotEqn
implements MouseListener
public class mHotEqn
extends dHotEqn
implements Runnable

### HotEqn Applet Syntax

The following is the minimal form shown using an example:

     <applet code=HotEqn.class height=300 width=400 name="my equation">
<param name="equation" value="3.5*x+\frac{5}{x+y}+4">
</applet>

The second line shows a parameter with the general parameter syntax
<param name="name"value="value">

which is a necessary parameter. You can specify either this type of necessary parameter by
<param name="equation" value="<eqn LaTeX-expression>">
or splitted into a left- and right-side expression of an equation by the two parameters
<param name="leftside"  value="<eqn LaTeX-expression>">
<param name="rightside" value="<eqn LaTeX-expression>">

#### Optional HotEqn Parameters

Parameter Code Syntax Type Examples Font type  fontname = Helvetica (default) TimesRoman Courier Dialog Font sizes Max. 4 font sizes can be specified. The fontsize1 value specifies the normal font size. All other fontsize values must be smaller. The size value must decrease with increasing fontsize number. If only the normal font is specified, for all other sizes decreasing sizes are taken automatically.  size = 18 14 (default) 12 10 8 Foreground color The applet default foreground color (default: black) can be modified by the hex value rrggbb  Background color The applet default background color (default: white) can be modified by the hex value rrggbb  Rectangular border frame The border color is given by the hex value rrggbb  Rounded border frame Alternatively to the rectangular border frame a frame with rounded edges can be specified  Rounded border environment If a frame with rounded edges is specified, the environment color of the edges can be specified (default: background color)  Horizontal alignment Expressions are aligned within the applet window in horizontal direction, if there is enough space available. If the space is too small, alignment is left and the overhanging part on the right side will be cut.  position = left (default) center rightIf the space is too small, the necessary width and height parameters will be printed on the Java console. Vertical alignment Expressions are aligned within the applet window in vertical direction, if there is enough space available. If the space is too small, alignment is middle and the overhanging parts on the top and bottom will be cut.  position = top (default) middle bottomIf the space is too small, the necessary width and height parameters will be printed on the Java console. Debug mode  booleanvalue = true (default) reports on console false

#### HotEqn Mouse Actions

Mouse Operations Actions
Left mouse button click with pressed Ctrl key Applet window width and height are printed on the Java Console.

### dHotEqn Applet Syntax

The applet syntax is similar to that of the HotEqn base applet. The following is the minimal form shown using an example:

     <applet code=dHotEqn.class height=300 width=400 name="my equation">
<param name="equation" value="3.5*x+\frac{5}{x+y}+4">
</applet>


#### Optional dHotEqn Parameters

All optional HotEqn parameters are also valid for this applet.

Parameter Code Syntax Type Examples Interactive equations dHotEqn is able to replace variables in a given equation by the corresponding right side of other equations located in any applet on the same page. Those variables are defined in applets referenced by the prev parameter. The number of substitutions is arbitrary.  The variables are not substituted automatically. This is performed only on mouse click (see examples). Edit mode Makes the component almost editable. Parts of the displayed equation are selectable when editable is set true.  booleanvalue = false (default) true

#### dHotEqn Mouse Actions

Mouse Operations Actions Examples
Left mouse button click
If a prev parameter is specified in the applet:
The variables in the applet are substituted by the expressions defined in the referenced applet.
Multiple clicks will substitute the variables sequently starting from prev0.
If no prev parameter is specified in the applet:
Name identifier of the applet is printed on the Java Console.
Right mouse button click The original equation specified in the applet is shown again if a prev parameter is specified.
Left mouse button down, mouse dragging and mouse button up If edit mode is on, the expression between button down and up position is highlighted and set selectable. The selected part is printed on the Java Console.
Left mouse button click with pressed Ctrl key Applet window width and height are printed on the Java Console.

#### dHotEqn Methods

Methods Syntax Examples
Sets expression <applet name>.setEquation("<eqn LaTeX-expression>")
Sets both sides of an equation <applet name>.setEquation("<eqn left side LaTeX-expression>,<eqn right side LaTeX-expression>")
Sets left side of an equation <applet name>.setLeftSide("<eqn left side LaTeX-expression>")
Sets right side of an equation <applet name>.setRightSide("<eqn right side LaTeX-expression>")
Gets left side of an equation String value=<applet name>.getLeftSide()
Gets right side of an equation String value=<applet name>.getRightSide()
Gets applet window width int value=<applet name>.getWidth()
Gets applet window height int value=<applet name>.getHeight()
Sets the applet background color <applet name>.setBGColor("rrggbb")
Sets the applet foreground color <applet name>.setFGColor("rrggbb")
Returns the size required to display the given equation
 Dimension dim=<applet name>.getSizeof("<eqn
LaTeX-expression>")


### mHotEqn Applet Syntax

The applet syntax is similar to that of the dHotEqn or HotEqn base applet. The following is the minimal form shown using an example:

     <applet code=mHotEqn.class height=300 width=400 name="my equation" MAYSCRIPT>
<param name="equation" value="3.5*x+\frac{5}{x+y}+4">
</applet>


This applet extends the dHotEqn functionality with MATLAB features. Thus it needs the MATLAB plugin to communicate with MATLAB. Observe, that this applet must be specified with the MAYSCRIPT parameter to enable JavaScript access out from the applet. The optional parameters refer to properties and facilities in connection with MATLAB and they parametrize the actions on mouse button clicks.

#### Optional mHotEqn Parameters

All optional HotEqn and dHotEqn parameters are also valid for this applet.

 Parameter Code Syntax Type Examples MATLAB Plugin identification  The MATLAB Plugin is referenced by its wrapped Matlab object. The reference to the MATLAB Plugin is given by this parameter. The default name is matlab. Observe, that pressing will start an example which uses MATLAB. Be sure, that the MATLAB Plugin is installed correctly. MATLAB m-file execution  MATLAB m-file to be executed on a left mouse button click. MATLAB expression execution  MATLAB command string to be executed on a left mouse button click. This action is performed after the mEvalMFile parameter evaluation, if defined. Import results from MATLAB  This parameter specifies the name of a matrix in the MATLAB workspace. The content of this matrix is converted to LaTeX notation and the equation = is displayed on a left mouse button click or updated periodically if the update parameter is set (see below). This action is performed after the mEvalString parameter evaluation, if defined. Import results from VCLab  The content of the VCLab matrix buffer is converted to LaTeX notation and the equation = is displayed on a left mouse button click. This action is performed after the mGetArray parameter evaluation, if defined. Periodic updating  Specifies the update interval in milliseconds for importing results from the MATLAB workspace periodically according to the mGetArray parameter.

The mHotEqn applet needs to have internally access to the scriptable methods mEvalString, mEvalMfile, mMatrix2LaTeX and mGetArray of the MATLAB plugin. As plugins for Netscape Gecko or Mozilla Browsers do not support direct calling of methods from Java applets, a JavaScript interface must be used that wrapps plugin addresses and methods.

The following JavaScript code in the header section of the current document will define a Matlab wrapper for the plugin and the methods:

function Matlab(obj)
{
// object to allow unwrapping
this.matlab = obj;
this.command = "";
}
Matlab.prototype = {
mEvalString : function(expression)
{
this.matlab.mEvalString(expression);
},
mEvalMFile : function(file)
{
this.matlab.mEvalMFile(file);
},
mMatrix2LaTeX : function()
{
return this.matlab.mMatrix2LaTeX();
},
mGetArray : function(list)
{
if (arguments.length == 1)
return this.matlab.mGetArrayLaTeX(arguments[0]);
else
if (arguments.length == 3)
return this.matlab.mGetArray(arguments[0],arguments[1],arguments[2]);
}
};


When referencing the MATLAB plugin it must be used in the wrapped version, e.g. in the following ways:
With var matlabwrappedobject = new Matlab(document.matlab);
the wrapped object is generated. In this example matlab is the name of the MATLAB plugin that is included in the same document. It must be observed that the wrapped object can only be created by new Matlab after the MATLAB plugin is initialised. In the applet declaration the parameter specification
<param name="vclab" value="matlabwrappedobject">
must be given.

#### mHotEqn Mouse Actions

Mouse Operations Actions
Left mouse button click The actions specified by the mEvalMFile, mEvalString, mGetArray or mMatrix2LaTeX parameters are performed.
Left mouse button down and mouse dragging If edit mode is on, parts of the dragged equation are highlighted and set selectable. The selected part is printed on the Java Console.
Left mouse button click with pressed Ctrl key Applet window width and height are printed on the Java Console.

#### mHotEqn Methods

The mHotEqn Methods are the same as the dHotEqn Methods.