To use WebEQ to put math in a web page, an author puts an applet tag in the HTML source code at the point where the notation should appear. The applet tag tells the browser to start the WebEQ applet, and what equation it should display. The typical WebEQ applet looks like this:
<applet codebase="classes" code="geom.webeq.app.mdraw" width=500 height=100> <param name=size value=36> <param name=eq value=" y = x + 1 "> </applet>View this applet
WebEQ understands a number of parameters, such as
size
, which control general aspects of how WebEQ should
display an equation. Among other things, these parameters determine
whether WebEQ expects mathematical expressions to be described with
WebTeX commands, or by some other markup language. By default, WebEQ
is configured to expect WebTeX.
This document mostly describes the WebTeX language, which is used
to fill in the value of the parameter eq
, and a few
special applet parameters for use with WebTeX. For general
instructions about how to set up and use WebEQ, including the use of
general applet parameters, consult the pages on getting started with WebEQ.
color
,
WebEQ understand two parameters designed to be used specifically with
WebTeX. As in TeX and LaTeX, you may create macros which allow you to
define a keyword that represents a more complicated expression.
The macros
parameter is written as follows:
<param name=macros value="\define{\plusfifty}{+ 50}">Here we have used the
\define{}{}
command to define a new
keyword, \plusfifty
, which
can then be used in the equation to signify where the symbols +
50
should be placed. In other words, the new keyword
\plusfifty
will be replaced by the expression "+ 50".
Thus, if the equation markup is
<param name=eq value="y \plusfifty = x \plusfifty ">the end result is that the applet will display:
y + 50 = x + 50
Macros can also be written using arguments, just as in TeX. WebTeX
macros use the symbols #1
, #2
,
#3
and so on to represent the arguments passed to a
macro. Thus, the macro definition
<applet codebase="classes" code="geom.webeq.app.mdraw" width=500 height=100> <param name=macros value="\define{\plusN}[1]{+ #1}"> <param name=eq value="y \plusN{35} = x \plusN{z - w}"> </applet>produces the output
y + 35 = x + z - w
Note that in the definition of \plusN
, the number of
arguments is specified in square brackets immediately after the braced
expression containing the keyword. Also, notice that when using a
macro that accepts arguments, the arguments must always be enclosed in
curly braces.
The macrofile
parameter is used to specify a file
containing macro definitions. The value of the macrofile parameter is
actually a URL, so several documents can share the same macro
definition file in a central location. For example, if the file
"my_macros.def" contains:
\define{\plusfifty}{+ 50}one could write
<applet codebase="classes" code="geom.webeq.app.mdraw" width=500 height=100> <param name=macrofile value="my_macros.def"> <param name=eq value="y \plusfifty = x \plusfifty"> </applet>in a document living in the same directory as "my_macros.def", while a document on another computer might contain an applet call something like this:
<applet codebase="classes" code="geom.webeq.app.mdraw" width=500 height=100> <param name=macrofile value="http://www.macros.com/my_macros.def"> <param name=eq value="y \plusfifty = x \plusfifty"> </applet>The Tour of WebEQ includes an example of macros.
In general, it can be quite tedious to insert applet tags in the document source for each bit of mathematical notation to be displayed. Among other things, in order to properly align the mathematical notation with the surrounding text, one must determine the height and width of the equation.
A great deal of this work is done automatically by a program provided with the WebEQ system called the Sizer. To use the Sizer, an author prepares an HTML document, including the WebTeX markup in the text. The WebTeX markup is surrounded by dollar signs (e.g. $x=2$) for inline equations, and by escaped brackets (e.g. \[ x=2 \]) for displayed equations. This will be familiar to authors accustomed to preparing LaTeX documents.
Once the source document is complete, the author then runs the Sizer program, which goes through the source file, finds the WebTeX markup, computes the equation sizes, and writes out a final HTML file with the proper WebEQ applet tags included. The Sizer has many options that can be set in order to control what applet parameters are set, and how macros are processed, among other things.
One can think of running the Sizer to produce a final HTML file as
being analogous to running TeX to produce a DVI file. WebEQ and the
web browser work together to display the output of the Sizer, just as
a program like xdvi
can be used to display the output of
TeX. One of the main differences is that the HTML file produced by
the Sizer is still a plain text file that one can look at and edit
further by hand if necessary, whereas a DVI file is a binary file that
is very difficult to work with.
The Sizer is a very useful aid in producing HTML/WebTeX documents. For more information, see Using the Sizer.
Copyright © 1996-1997 by The Geometry Center. All rights reserved.