Up: WebEQ Home Page

Webtex: A Mark-up Language for WebEQ

Webtex is an equation mark-up language for WebEQ. In the style of its syntax, it is similar to LaTeX. However, there are some differences between the two. For one thing, the underlying WebEQ layout engine is based on MathML, a new proposed standard for HTML Math, and not TeX. The benefit is that WebTeX is better adapted to electronic documents.

WebTeX is a rich mathematical markup language. It has basically the same expressive power as the LaTeX math mode, and it is generally reasonably easy to convert WebTeX math markup into LaTeX markup. A utility program that converts an HTML/WebTeX document into a LaTeX document is under development, and should help meet the needs of authors who need both electronic and traditional paper versions of a technical document.

Work is also under way on utilities to convert LaTeX documents into HTML/WebTeX documents. However, this is a harder problem, since there are many variants and dialects of TeX. In general, authors should not expect to easily convert existing TeX documents to WebTeX.

Table of Contents


2. Using WebEQ with WebTeX

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.

3. Macros

In addition to general applet parameters like 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.

4. The Sizer

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.

5. Mathematical expressions

5.1 Superscripts and Subscripts

As in LaTeX, the carat (^) is used for superscripts and the underscore (_) is used for subscripts. In general, braces should be put around the raised or lowered expression.

e^{i\pi}

If the superscript or subscript consists only of a single character, the braces are not necessary.

y_0 = x_0^2

WebTeX displays multiple indices as tensor notation. Additional scripts attached to a base (as in the example R^i_j^k_l ) are raised or lowered by the same amount as the first set, and aligned in vertical columns. One can "turn off" the tensor indicies in WebTeX by inserting extra braces:

{R^i_j}^k_l

The Tour of WebEQ includes examples of superscripts and subscripts, as well as an example of tensor notation.

5.2. Prescripts

Superscripts and subscripts may also be placed before the expression they are associated with. These are called prescripts. Prescripts function just like ordinary scripts with the exception that braces around the scripts are not optional. Preceding superscripts are created with the command \^ and preceding subscripts are created with \_. The script is the first argument, and the base expression is the second argument. Multiple prescripts also act like tensor indicies by default.

\_{1}{A}
\^{2}{A}
\_{1}\^{2}{A}
\_{3}\^{4}\_{1}\^{2}{A}

The Tour of WebEQ includes an example of prescripts.

5.3. Fractions and Binomial coefficients

Fractions may be created with \frac by placing the numerator in the first argument and the denominator in the second argument.

`One over x' is created with

\frac{1}{x}

The command \binom is the same as \frac. It places the first argument over the second argument, without drawing the horizontal fraction bar. To create a binomial coefficient, you will need to add parentheses with the \left ( and \right ) commands.

\left ( \binom{5}{2} \right )

See the section on delimiters for further discussion of \left and \right.

5.4. Square roots and n-th roots

The command \sqrt displays the square root of its argument.

For the n-th root, use the command \root with n as the first argument and the expression under the radical as the second argument.

\sqrt{3}
\sqrt{x^2+2x+3}
\root{5}{x+1}
The Tour of WebEQ includes more examples of roots.

5.5. Integrals, Sums, and other variable size operators

Some symbols will be larger in display style than they are in text style. These are

Upper and lower limits for integrals or other variable size symbols can be specified with ^ and _ respectively. In display mode, these limits will be above and below the integral symbol. In text mode, the limits will be placed to the right of the symbol.

\textstyle{ \sum_{k=0}^{\infty} c_k x^k }
\displaystyle{ \sum_{k=0}^{\infty} c_k x^k }
The symbol \iint draws a double integral, and \iiint draws a triple integral. These draw the integral symbols closer together than they normally would get with

\int \int or \int \int \int.

Use \displaystyle {\cup} to force the cup symbol to be large when the surrounding expressions are otherwise in text style.

The following five symbols will be large, regardless of the current style:

The Tour of WebEQ includes examples of a displayed integral and the difference between display style and text style.

5.6. Logarithms and other functions

Many functions are traditionally typeset in an upright font. The following WebTeX commands automatically have this property.

\arccos   \cos   \csc   \exp   \ker     \limsup   \min   \sinh
\arcsin   \cosh  \deg   \gcd   \lg      \ln       \Pr    \sup
\arctan   \cot   \det   \hom   \lim     \log      \sec   \tan
\arg      \coth  \dim   \inf   \liminf  \max      \sin   \tanh

The limit functions will deal with subscripts and superscripts in a manner similar to the operators in the previous section. In display style, \lim_{x \to 0} f(x) will place the subscript underneath the limit symbol.
\textstyle{\lim_{x \to 0} f(x)}
\displaystyle{\lim_{x \to 0} f(x)}

If you have a function that is not on the list above, you may force any identifier to behave as an operator using the

	\mathop{function}

command. For instance, the cosine function would normally be used this way:

	\cos x 
However, if the cosine function wasn't already on the list above, the command
        \mathop{cos} x
would produce the same effect. That is, the "cos" would appear in an upright font, extra space would be included before the "x" and subscripts and superscripts would be treated as limits.

The Tour of WebEQ includes examples of a few of the functions mentioned above.

5.7. Delimiters

Delimiters are the symbols such as parentheses and brackets which enclose a mathematical expression. These symbols, when used with the \left and \right commands, will grow to fit the size of the expression they enclose. The delimiters which WebTeX recognizes are:

Note that the curly braces must be specified with \{ and \} since braces alone are interpreted by WebEQ as part of the commands. A simple example is
\left ( \frac{2}{4+x} \right )^3

The \left and \right commands must be used in pairs, since WebTeX expects the expression that determines the height of the delimiters to be surrounded by a pair of \left and \right commands. However, only the \left and \right keywords must appear in pairs; either delimiter may be omitted:
\left \frac{x}{y} \right|_{x=0}

Caution: This is a significant difference between WebTeX and TeX. In TeX, some delimiter is required after the \right or \left command, and uses a special invisible delimiter in situations like the one illustrated above.

By default, delimiters grow symmetrically around the horizontal axis of the equation. When enclosing a matrix that is aligned at its top or bottom, for example, one needs the delimiters to "float" to match the alignment of the enclosed expression. To accomplish this, use the \floatleft and \floatright commands instead. For matching purposes, a \floatleft will match a plain \right and vice versa.

The tour of WebEQ includes examples of delimiters.

5.8. Accents

There are seven accents which place a one-character wide accent above their arguments:

The wide versions of these five accents stretch to the width of the enclosed expression.

\widehat{a+b}
\widecheck{a+b}
\widebar{a+b}
\widevec{a+b}
\widetilde{a+b}
The Tour of WebEQ includes examples of these accents.

5.9. Placing symbols over or under an expression

The command \overbrace places a horizontal brace that stretches over its argument, and \underbrace stretches a brace underneath its argument.

Besides braces, any symbol may be placed above or below an expression with the commands \overset or \underset. These are generalizations of \overbrace and \underbrace. Instead of a brace, any symbols that are in the first argument will be typeset above or below the main expression in the second argument.
\overset{\text{$n$ terms}}{\overbrace{1+2+\cdots+n}}
The Tour of WebEQ includes examples of the overbrace and overset commands.

5.10. Mathematical symbols and extended characters

There are many other mathematical symbols which are supported by WebTeX.

Greek letters

Both capital and lower-case Greek letters are available. The capital letters that are not listed on the table below are the same as the Roman capitals.

Capital letters:

Lower-case letters:

Arrows:

Relations:

Binary operations:

Dots:

Miscellaneous Symbols:

6. Changing fonts

6.1. Font families

The letters a through z, in both upper and lower case, will normally be displayed in an italic font, to show that they are variables. They can be changed to one of the following eight font families:
\mathrm{AbcD}Roman
\mathit{AbcD}Italic
\mathbf{AbcD}Bold
\mathfr{AbcD}Fraktur
\mathsf{AbcD}Sans Serif
\mathtt{AbcD}Typewriter
\mathbb{ABCD}Blackboard Bold
\mathcal{ABCD}Calligraphic

The calligraphic and blackboard bold fonts contain only capital letters; any lower case letters inside between the braces will be displayed as the usual italic characters.

6.2. Changing the size of fonts

The point size of the characters inside a WebEQ applet is determined by the applet's size parameter. The size parameter sets the base font size. However, given a base font size, WebTeX uses two additional smaller font sizes. Most characters are drawn in the base font size. Subscripts are smaller, and subscripts of subscripts are smaller yet. The smaller sizes are also used for fractions, indices, and other similar situations.

WebEQ chooses between these three sizes based on each character's place in the formula. You may, however, force WebEQ to use another size with the commands \textsize{}, \scriptsize{}, and \scriptscriptsize{}. For example, you could keep the exponent of x-squared from getting smaller by using x^{\textsize{2}}

6.3. Display style vs. Text style

WebEQ uses two formatting styles for displaying mathematical symbols. The text style is used when the expression is part of a sentence. In this style, the formulas are kept as vertically compact as possible. For example, the limits of an integral are placed to the right of the integral symbol to prevent the integral from being too tall, and the numerator and denominator of a fraction are set in a smaller font. When preparing a source file for the Sizer, formulas enclosed in $ ... $ will appear in text style.

The display style is used for an expression that is set out from the surrounding text centered on its own line. An integral in this style will have its limits above and below the integral symbol, and so on. In TeX, displayed equations are indicated by $$ ... $$ and in LaTeX by \[ ... \]. The Sizer will display expressions enclosed in \[ ... \].

When working directly with a WebEQ applet, the default style is the text style. To change to display style, enclose the expression in the eq parameter within the braces of the \displaystyle{} command.

Note that the commands \displaystyle and \textstyle in WebEQ are not identical to the corresponding commands in TeX and LaTeX. The TeX commands \displaystyle and \textstyle, together with the similar commands \scriptstyle and \scriptscriptstyle, control both the size of symbols and the style in which things like limits and fractions are presented. WebTeX splits these two functions between the size commands (\textsize, \scriptsize, and \scriptscriptsize) and the formatting style commands (\displaystyle and \textstyle).

The Tour of WebEQ includes an example showing the difference between display style and text style.

6.4. Text boxes

Sometimes it is necessary to insert some text in a mathematical expression, particularly when creating functions with multiple domains (see below). Text may be included by putting it in a text box with the command

	\text{Put text here }
Text inside the braces will be shown in an upright Roman font. Spaces inside the braces will be used, so be sure to put a space at the beginning and end of the text string.

Mathematical symbols may be placed within the text box by using dollar-signs, $ .... $, as in TeX.

The tour of WebEQ includes an example of the use of text boxes.

7. Arrays, tables and matrices

One of the biggest differences between WebTeX and LaTeX is how arrays are handled. The WebTeX arrays are much more closely related to MathML and HTML tables. In practical terms, this mostly affects the way in which array layout options can be changed, and the command syntax for doing so. At the same time, LaTeX users will also find many familiar features in WebTeX arrays.

7.1. Creating an array

The \array command may be used for creating a table of any kind. A simple 2x2 array would be given by
\array{ a & b \\
        c & d }
An ampersand (&) is placed between entries (called cells) in each row, while rows are separated by a double backslash (\\). Note that there is no & at the end of each row and no \\ after the final row. Spaces and line feeds are ignored by WebEQ; they are only used here to make the WebTeX code easier to read. The expression

\array{a&b\\c&d}
is displayed the same way as the example above.

Arrays may be nested, as in the example
\array{ \array{0&1 \\ 1&0} & A \\
                B         & \array{0&1 \\ 1&0}
      }

7.2. Options

7.2.1. Array options

The first element of an array may be the command \arrayopts{}. This command allows you some control over the layout of the matrix. You may place one or more of the following commands within the braces of \arrayopts{}:

Alignment of columns

Each column may be individually left justified, right justified, or centered. The \collayout command justifies each column according to the list of positions given in its argument. Type one of left, center, or right for each column, separated by spaces. Place solid or dashed where you would like to separate columns with a solid or dashed line.

Example: An array with three columns, the first flush left and the other two flush right, is given by

\array{ \arrayopts{\collayout{left solid right right}} a & b & c}
Note that there is a solid vertical line between the first and second columns, but no line after the second column.

The tour of WebEQ includes an example of the alignment of columns within an array.

Vertical alignment of the whole array

The whole array may be shifted vertically using the \align{} option. The default is \align{center}, which places the center of the array even with the middle of the surrounding expression. Replace center with top or bottom to align the top row or the bottom row with the surrounding text. A fourth possibility is to align the array at a certain row. Type \align{r2} to align at the second row.

The Tour of WebEQ includes an example of the vertical alignment of arrays.

Padding between array entries

WebEQ inserts a small amount of space between entries in an array. The \padding{} command adjust these gaps. The argument may be any floating point number, including negative numbers. The default is \padding{1}. An argument greater than one spreads the cells, and a number less than one pushes them closer together. Negative values may cause the array entries to overlap.

The Tour of WebEQ includes an example which shows the effect of using different values for the argument of \padding.

Equal-sized rows and columns

The command \equalrows{true} causes all the rows of an array to be the same height. The corresponding \equalcols{true} does the same for the width of all columns. The default for both options is false, which lets each row or column be individually scaled to acommodate the entry with the largest height or width.

The Tour of WebEQ includes an example of the use of \equalrows and \equalcols.

7.2.2 Row options

The first element of each row of an array may be the command \rowopts{}. This command allows you some control over the alignment of the text in each row and provides a way to insert horizontal lines between rows.

Alignment of rows

In contrast to the array option \align, placing this option within the command \rowopts{} controls the vertical position of each entry in the row. The whole row is aligned vertically according to the option given. The choices are top (the top of each entry is placed flush with the top of the row), bottom (the bottom of each entry sits on the bottom of the row), center (all entries are centered) and base (all entries align on their natural baselines). The default is \rowopts{base}, in which the baseline of all entries are matched.

The Tour of WebEQ includes an example of the alignment of rows.

Lines between rows

A horizontal line just below the current row may be added with the command \rowopts{\underline{solid}}. For a dashed line, replace solid with dashed. By default, there are no lines between the rows.

The Tour of WebEQ includes an example of underlining.

7.2.3. Cell options

The command \cellopts{} may be placed at the beginning of any cell with any combination of the following options to adjust that individual cell.

Cell entries covering more than one row or column

These two options, \rowspan and \colspan, allow an entry in the matrix to cover two or more cells. For example, \colspan could be used to create a heading for a table which is centered over the two columns.

The argument of \rowspan is the number of rows including and below the current row that will be covered by the cell.

Similarly, the argument of \colspan is the number of columns including and to the left of the current column that will be covered by the cell.

Note that the \rowspan and \columnspan options options merely control the number of rows and columns that a given cell can cover. They do not affect the contents of adjacent cells in the array. Thus, it is the responsibility of the author to make sure that the adjacent cells are empty. Otherwise the contents of the spanning cell and the adjacent cells may overlap. Another way to think of this is that, for example, a 3x3 array always contains nine cells, whether or not some of them span multiple rows and columns. If there are spanning cells, they are "controlled" from their top left corner cell (where the \rowspan and \colspan options are given), and they merely overlay the appropriate neighboring cells.

The Tour of WebEQ includes an example of the use of \rowspan and \colspan.

Vertical and horizontal alignment within cells

The cell options \rowalign and \colalign change the vertical or horizontal placement of an entry within its cell, much the same as the array option \collayout and the row option \align, which work on whole columns or rows.

The \rowalign command changes the vertical alignment. The expression in the current cell is placed at the top, center, or bottom of the row by using one of these words as the argument of \rowalign. The default is \rowalign{base}, which places the cell entry on the baseline.

Horizontal alignment is controlled by the \colalign command, which has the possible arguments left, center, or right. The default is \colalign{center}.

The Tour of WebEQ includes an example of the alignment of array entries.

7.3. Example: A Matrix

We can take our array example above and turn it into a matrix equation:

A = \left ( \array{ a & b \\
                    c & d }
    \right )
By default, delimiters grow symmetrically around the horizontal axis of the equation. When enclosing a matrix that is aligned at its top or bottom, for example, one needs the delimiters to "float" to match the alignment of the enclosed expression. To accomplish this, use the \floatleft and \floatright commands instead.

This example of a 3x2 matrix with its top row aligned with the equals sign requires the use of \floatleft and \floatright .

A = \floatleft ( \array{ \arrayopts{\align{top}}
                    a & b \\
                    c & d \\
                    e & f }
    \floatright )

The Tour of WebEQ includes several more examples of the use of arrays.

7.4. Example: A function with multiple cases

Another use of WebTeX arrays besides matrices is the creation of a function defined on two or more domains. Here we use a 2x3 array to define the absolute value function:

|x| = \left \{
          \array{ \arrayopts{\collayout{right center left}}
                  x & \text{ for } & x \geq 0 \\
                 -x & \text{ for } & x \lt 0 }
      \right

The x's in the first and third columns are lined up using the \collayout array option. The \text commands in the center column ensure that the word `for' is in a roman font. Also notice that there is no right delimiter, even though the \right command is required.

7.5. Example: Commutative diagrams (Overlap commands)

Arrays can also be used to create commutative diagrams. Some overlap commands may be needed to help set the function names at the correct location relative to the arrows. These commands are \llap{} (Argument is left of center), \rlap{} (Argument is right of center), \ulap{} (Argument is above center), and \dlap{} (Argument is below center).

A letter g may be placed above an arrow

   X \overset{\ulap{g}}{\longrightarrow} Y

\overset puts the letter above the arrow. Using \ulap gives the effect that the center of the g / arrow combination is aligned with the arrow itself. If we did not use it, the whole structure would be centered, leaving the arrow too low.

To create a square commutative diagram, we use this as the first row of a 3x3 array, placing a & between the letters and the arrow.

\array{
   \rowopts{\align{center}}
   X &            \overset{\ulap{g}}{\longrightarrow}    & Y \\
   \downarrow \rlap{\mathop{id}} &         & \llap{\alpha}{\downarrow} \\
   \rowopts{\align{center}}
   X &            \underset{\dlap{h}}{\longrightarrow}   & Z
   }

The tour of WebEQ includes an example of a commutative diagram.

8. Spaces and Rules

8.1. Adding and removing spaces

Frequently you will want to add an amount of space to "tweak" the appearance of an equation, when WebEQ does not automatically put it there by itself. A common example is the integral
\int x dx
WebEQ would take out the space between the x and the dx and show the integrand as xdx, since there is nothing in the source code to indicate that these symbols are not just three variables multiplied together. To obtain the traditional appearance for the integrand, it is necessary to place a thin space between these two symbols:
\int x \thinsp dx or \int x \, dx

There are three other sizes of spaces; in order of increasing width, these are \medsp, \thicksp, and \quad.

It is also possible to remove a space with the `negative space' command, \negsp. This command moves subsequent symbols to the left by a small amount.

There are short cuts for the two commands \thinsp and \negsp. The command \, is equvalent to \thinsp and \! is equivalent to \negsp.

x x
x \thinsp x
x \medsp x
x \thicksp x
x \quad x
x \negsp x
The Tour of WebEQ includes an example of the different spacing commands.

8.2. Arbitrary size spaces and rules

Spaces of any size may be created with the \space{ht}{dp}{wd} command. This command has three parameters. The first parameter ht controls the height of the top of the box above the baseline, the second parameter dp controls the depth of the bottom of the box below the baseline, and the third parameter wd controls the width of the box.

The two vertical variables, ht and dp, are measured in units of tenths of an ex (the height of the letter x) and the horizontal variable wd is measured in units of tenths of an em (the width of the letter M).

The command \rule is similar to the \space command. The three arguments have the identical effect, with the difference that \rule creates a solid rectange instead of a blank space.

WARNING: The three arguments of \rule and \space are quite different from those used in LaTeX for the same commands.

The Tour of WebEQ includes an example showing the effect of using different arguments in \rule and \space.

9. Browser actions

9.1. Colorful symbols

The typical WebEQ applet displays its symbols in black, but you can change the color of any symbol with the \fontcolor command. This command has two arguments. The first gives the color and has the form of a # symbol followed by a six digit hexidecimal number ( #rrggbb ). The first two digits rr give the amount of red between 00 (black) and ff (bright red). The gg and bb have the same effect on the amount of green and blue, respectively.

The symbols that will be displayed in this color are placed in the second argument.

Here are some examples:

\fontcolor{#00ff00}{A}
produces a bright green letter `A'.
\fontcolor{#0000ff}{B}
produces a bright blue letter `B'.
\fontcolor{#ff0000}{C}
produces a bright red letter `C'.
\fontcolor{#880000}{D}
produces a darker red letter `D'.
\fontcolor{#ffffff}{\frac{1}{3}}
produces a bright white `one-third'.

The Tour of WebEQ includes examples of the use of \fontcolor.

9.2. Links to other pages

Since WebEQ displays applets on World Wide Web browsers, it is possible to create hyperlinks inside the applets. Any expression expr can be linked to the page at a given URL with the command \href{URL}{expr}. The expression expr will be highlighted in blue and clicking on this expression will send the browser to the URL in the first argument.

\href{http://www.geom.uiuc.edu/einsteinshomepage.html}{E=mc^2}

The Tour of WebEQ includes an example of the use of a hyperlink in a mathematical formula.

9.3. Footnotes on the status line

The status line on a web browser is the area at the bottom of a browser window that displays messages from time to time. Among other things, the status line tells the destination of a link when the mouse cursor passes over the linked text.

You may use the command \statusline{message}{expr} to create a text message which displays on the status line when the mouse moves over the expression expr. Think of this as similar to a footnote.

\statusline{This message is displayed when cursor touches y=2.}{y=2}

The Tour of WebEQ includes an example that uses the status line to explain the reason for the truth of an equation.

9.4. Highlighted expressions

In addition to creating footnotes, there are other things that you can get to happen when the mouse cursor touches special symbols in your applet. Any expression in the applet can be highlighted in a different color when touched by the mouse. This is done with the command \fghilight{color}{expr}, where the first argument is a hexidecimal number representing the highlighted color, and the second argument is the expression that is highlighted.

To highlight the equation y=x in yellow when the cursor passes over it, type

\fghilight{#ffff00}{y=x}
There also is a command \bghilight{}{}, which highlights the background in the given color, as opposed to the expression itself.

The Tour of WebEQ includes an example of highlighted symbols.

9.5. Toggling expressions

Another interaction between the mouse and WebEQ applets is provided by the \toggle{expr1}{expr2}{prompt1}{prompt2} command. Initially, the first expression expr1 is displayed. Once the cursor lies above this expression, the status line shows prompt1, as with the \statusline command above.

With a click of the mouse (left button), the first expression is replaced with a second expression, expr2. The second prompt, prompt2 will now be displayed when the cursor is over the second expression. Another mouse click will return the first expression.

In short, we can toggle between expr1 and expr2, with the two prompts to guide us.

The Tour of WebEQ includes an example of nested toggles.


Up: WebEQ Home Page


[HOME] The Geometry Center Home Page

Copyright © 1996-1997 by The Geometry Center. All rights reserved.


Last modified: Wed Jun 25 15:37:58 1997