Up: The WebEQ Math Viewer Applet

WebEQ Math Viewer Applet
Features and Capabilities

The WebEQ Math Viewer is an applet that runs in a Web browser to display interactive equations. The Math Viewer applet works best when it is installed in the readers browser, like a plug-in. However, a web server can also be configured to download the applet program files along with Web pages that need it.

The WebEQ distribution contain the necessary software to set up a Web server in this way, as well as the self-installing archive files which enable readers to install the applet in their browsers. See Distributing the Math Viewer Applet from a Web Server for more details.

Applet tags in an HTML file instruct a Web browser to request that the Math Viewer applet be loaded and executed. These applet tags contain a number of parameters which control WebEQ options. In particular, these parameters tell the web browser what equation to display. All of the valid applet parameters are described in detail on a separate page.

Some WebEQ features can also be controlled interactively by the reader. An obvious example is the WebEQ control panel which can be used to select a pointsize. Other kinds of interactivity can be described in the equation markup. These include foreground and background hilighting, status line cues, linking and toggling between expressions. Finally, many other more sophisticated kinds of interactivity can achieve by programming the Math Viewer behaviour via JavaScript. See Programming WebEQ with JavaScript for details.

Using the Math Viewer in IE5

Starting in Internet Explorer 5, is it possible to take advantage of proposed behavior extensions to CSS in order to set up the Math Viewer as a rendering behavior (sometimes called a DHTML behavior) for MathML markup included in HTML files. This is done by including some initialization code in the header of the document, and putting two additional JavaScript files in the same directory with your document. See Using the Math Viewer in IE5 for details.

There are several major advantages to using the Math Viewer as a DHTML behavior:

  • Your documents contain only MathML/XML markup, in strict compliance with World Wide Web Consortium Recommendations.
  • When running as a behavior, the Math Viewer negotiates for screen space with the browser, sizing and positioning math notation much more accurately relative to the surrounding text than is possible with images or applets.
  • The Math Viewer behavior resizes equations to match viewer preference. Hitting "reload" after changing your font preferences will automatically update the equation sizes.

Another big advantage to using the Math Viewer behavior in IE5 is that it allows you to create documents in which the MathML renders properly in both IE5 and the new Mozilla browser, which will also render strict MathML.

Using Math Viewer Applets

It is important to keep in mind that an applet is actually a program, and therefore you must run it in order to see how a particular equation is going to display. The standard way of running an applet is with a Web browser. For Java-savvy authors who already have a Java Developers Kit installed, Math Viewer applets, like any other applet, can also be viewed using an applet viewer.

To view an applet in a browser, make sure that Java is enabled, and then view an HTML page containing the proper applet tags in the ordinary way. By default, a Web browser will first check to see if the applet is locally installed, and then look for it on the server in the same directory as the HTML file containing the applet tags. If the Math Viewer program files have been installed elsewhere on a server, the applet tags can specify the location. The applet tags also specify the equation to be displayed. Once the browser locates the applet, it automatically runs it to display the equation in the HTML page.

If you haven't done so, you should look at the WebEQ Tour to see this in action. You might find it interesting to look at the HTML files as well, to get an idea of what applet tags look like.

One subtlety that arises when viewing applets in a browser is that HTML pages you open on your local disk behave somewhat differently than pages you open from a Web server over the internet. As noted above, the applet tags may specify a location where the browser should look for the Math Viewer program files. When the Math Viewer applet is installed in your browser, the browser just uses the installed copy, and the location specified in the applet tags is not used. However, if the Math Viewer is not installed in your browser the location specified in the applet tags is used, and what values are valid for the location depend on whether the file is on the local file system or on a server: when you are opening a page on your local disk, the applet tags can either specify a location on the local file system, or a URL where the browser can find the classes directory. However, if you are opening the page through a Web server, the applet tags must specify a URL. So in general, it is safer to always use relative URLs to specify locations, since that works no matter where the file is located.

This is most noticeable when you are using the WebEQ tools to create and view pages on your local computer, but your ultimate intention is to publish them on a Web server. Coordinating between the actual physical location of the WebEQ program files directory and the location specified in your HTML pages is perhaps the most common source of problems when using applets.

Interactivity Features

The main point of using WebEQ Math Viewer applets is to create interactive equations. The Math Viewer facilitates two kinds of interactivity: general purpose controls that are available to the reader independent of the specific equation being displayed, and specialized actions for a specific equation, specified by the author.

General Controls

By right-clicking on a Math Viewer applet, a reader can bring up a control panel. The control panel enables the reader to change the base pointsize for WebEQ equations. Because fonts are highly system dependent, the numerical values for pointsizes may not match up with the sizes given in the Web browser; however, the closest match is usually adequate.

The control panel is shared by all Math Viewer applets. Once a control panel is created, it lurks in the background, and takes charge of new equations as they appear. In particular, the control panel will override pointsize values specified by parameters in applet tag. This means that the first Math Viewer applet with a control panel your browser encounters will determine the pointsize for all subsequent applets.

In some cases, this behavior is undesirable. For example, if JavaScript size controls are being used to change both equation and font sizes in tandem, it is important that the control panel feature be disabled, so it doesn't interfere. In general, if an author wants to control the pointsize of an applet, instead of allowing the reader this privilege, its access to the control panel must be disabled. This can be done using the controls applet parameter.

Another feature which can be enabled or disabled with a parameter is cut-and-paste. When cut-and-paste is enabled, a reader can select a subexpression in a WebEQ equation by holding down the left mouse button and sweeping out a region, as usual. Holding down the control key while left-clicking displays the MathML encoding for the selection to a pop-up window. From there, the MathML code can be selected, copied and pasted into other applications.

Equation-specific Actions

By using WebTeX commands or the MathML <maction> command, authors can bind any of four actions to any subexpression in an equation:

Links
Authors can make standard HTML-style links from any part of an equation to other HTML pages. Links can even be nested, with the innermost subexpression taking precedence over containing expressions.

Highlighting
WebEQ can highlight the foreground and background of a subexpression when the reader passes the mouse over it. The author can control what highlight colors are used.

Status Line Messages
Instead of highlighting, the Math Viewer applet can be set to display a message on the browser status line when the reader moves the mouse over a particular subexpression.

Toggles
Perhaps the most powerful interactivity feature is the ability to toggle between two subexpressions in response to a mouse click. For example, one might toggle between an ellipsis and the missing terms the ellipsis represents in a long expression. By default, WebTeX toggles also define status line messages to cue the reader about the effect of toggling.

These interactivity features can all be used in conjuction with each other. A typical situation where this is convenient might be setting up a status line message in conjuction with a link.

For details about specifying interactivity features using WebTeX or MathML, consult the reference documentation linked above.

Writing Applet Tags

Generating applet tags in your HTML files is generally no more difficult than generating images. As an author, the hard part is to either write out the commands which describe the equation, or build it up in the Equation Editor.

If you are using commands, generating the necessary applets can be easily accomplished by processing the input with the Wizard. There are a number of other Wizard options that determine the values that the Wizard sets for applet parameters. To master what all these options do, you will want to look at both the Wizard Options and Applet Parameters reference pages.

If you are using the Equation Editor, use "Save As Applet" instead of the other "Save" options. The Equation Editor generates generic applet tags. In general, you may wish to customize the applet tags, adding addition parameters by hand, when you import them into your HTML file.

Even if you generate your applet tags using the WebEQ tools, you will still have to understand enough of how an applet tag works to choose the correct settings for the Wizard, or to customize tags generated by the Equation Editor. The nuts and bolts of Math Viewer applet tags are described in detail in the Anatomy of a WebEQ Math Viewer Applet Tag. It is strongly recommended that you work your way through this discussion if you plan to use applets extensively.


[HOME] WebEQ 2.5 Documentation Table of Contents

Created: Aug 08 1997 --- Last modified: Sun Sep 10 11:43:25 2000
Copyright © 1997-2000 Design Science, Inc. All rights reserved.