Input mathematics with the expression editor
The expression editor is a Java applet for editing mathematical
expressions that exemplifies the use of the techexplorer Java interface
to the Document Object Model (DOM) API.
With the expression editor you can use the keyboard and mouse to create and edit
mathematical structures that have been created either for the purpose of displaying
mathematics in a document or performing a scientific computation.
The design of the expression editor is distinguished by
three interrelated subcomponents:
- it is based on a hierarchy of mathematical objects that
relates to both the graphical rendering of the mathematics on the printed page,
and the interpretation of the formulas by a computational system;
- it provides for WYSIWYG ("what-you-see-is-what-you-get")
editing of mathematics by use of a single visual cue: a highlighted subexpression; and,
- it correlates these mathematical objects with keyboard actions for purposes of insertion, deletion, and navigation.
In what follows we introduce the basic use of the expression editor by examining
how to create a basic expression, use the
arrow keys, insert
and delete mathematical expressions,
and perform matrix edit commands.
Before trying out the editor, please change the color and font to the
recommendations
given below. Once you've done that, you are ready to start editing equations!
Creating a Basic Expression
First here is how you create an expression from scratch. The expression
editor first presents you with an empty box. You fill this box with the first character
that you type from the keyboard. As you type in new characters, the highlight moves to the right.
The expression editor has a single visual clue:
a highlighted current expression. Here is a summary of basic
principles:
- An empty box denotes an
expression to be filled in. Your initial expression is an empty box.
In general, your expression may contain any number of empty boxes.
- The current expression
is highlighted. Each new expression you
type becomes the new current expression, i.e., becomes highlighted.
- Variables names have single
alphabetic characters. Thus xy is interpreted as the product of two variables x
and y.
- LaTeX control words are entered
with a backslash. For LaTeX control words, type a backslash (\) then one or more leading
alphabetic letters of its name. Use TAB to
complete the word as far as possible, then any non-alphabetic character to accept that completion.
Alternatively, right-click on the characters typed so far
to get a context menu of choices for completions.
Control words like \sum and \int create variable-sized
operators.
- An open-parenthesis creates an empty enclosed expression. Typing an
open parenthesis, bracket, or curly brace, creates an empty enclosed expression.
Want to change them?
Use the right/left-arrow keys to move to the delimiter then type a new one (use a dot "." if you want it invisible).
- A close-parenthesis wraps the highlighted expression in parentheses.
Typing a closed parenthesis, bracket, or curly brace
wraps the current expression with identical delimiters.
- Infix operators like % or + create
an empty box for the second operand.
Operator % creates a two-dimensional fraction
with an empty box for denominator.
Simlarly ^, _, and # create two-dimensional forms for powers, subscripts, and
roots ( for an n root, type left-arrow to get its box ).
Operators +, -, =, *, and / create no two-dimensional structure but
give you an empty box for the right operand.
Arrow Keys
As is customary with text editors, the arrow keys move you in the direction indicated by the arrow.
Left and right arrows move you systematically across the characters of the math expression. Up and down
move from superscript to subscript, numerator to denominator, and so on.
Adding the CTRL key, lets you navigate the math expression as a tree
structure.
-
CTRL+Left and CTRL+Right move
across siblings. Adding CTRL to the left- and right-arrow keys moves the highlight
to the left or right sibling of the current expression tree.
-
CTRL+Up means larger.
Type CTRL+up arrow to move the highlight to
the parent of the current expression.
-
CTRL+Down means smaller.
Type CTRL+down arrow to move the highlight to
a child of the current expression.
-
CTRL+SHIFT+Right/Left means extend.
When CTRL+SHIFT is held down when typing the
right- or left-arrow, the highlight is extended
in the direction of the arrow.
Insertion and Deletion
- New characters are always inserted to the right unless preceded by typing the INSERT key.
The characters you type are always inserted to the right of the currently highlighted
expression. If you must insert a character to the left, just type the INSERT prior to that typing that character.
- DELETE (or ALT + d ) and BACKSPACE (or ALT+b ) delete the
current expression.
- The DELETE key deletes the current expression
and moves the highlight to the right.
- The BACKSPACE key deletes the current expression and moves the
highlight to the left.
- DELETE and BACKSPACE delete enclosing
parentheses.
Once you have an expression enclosed in any kind of left-right delimiters:
parentheses, brackets, or curly braces, typing
DELETE or BACKSPACE replaces the enclosed expresssion by
the expression itself.
- Left- and right-arrow introduce insertion boxes.
When positioned at the right-end of an expression, successive right-arrows create
an insertion box that moves "up" one level at a time.
Alternatively, left-arrow can be used to introduce an insertion box to the left of the expression.
Recomended techexplorer settings
- Colors recommendation: suggest light gray--bottom row, 3rd from right, in table of basic
colors for Selection Background( Options...->Colors from context menu on the Expression
Editor window)
- Font recommendation: Times New Roman 13 for normal and italic math
(Options...-->Fonts from context menu on Expression Editor window).
IBM techexplorer Hypermedia Browser is a trademark of the
IBM Corporation.
Send comments and questions to
techexpl@us.ibm.com.
Visit the official techexplorer home page at
http://www.software.ibm.com/techexplorer/.