Deleting Mathematical Expressions

This section helps you understand how to delete the operators and identifiers that make up the basic structure of mathematical expressions in Zed, including the use of the delete/backspace keys, undo and redo, and special templates for removing expression structure.


Tokens
Operators
Cut and Paste
Undo and Redo

Once you've found your way around the process of using the templates, menus, palettes, and keyboard accelerators to create mathematical expression structure in Zed, you will want to be able to reverse the process and remove the structures you are able to create. Whether to correct inadvertent additions, or when you decide that you really need a completely different structure, Zed provides operations for reversing any insertion action supported by the editor. Familiarity with the operations for deleting expression structure will encourage you to experiment with the editor, knowing that you can always go back to where you started, or to any point since then, and try a different direction.


Tokens

The special token input mode described in the Juxtaposition paragraph of the previous section allows you to enter the character data for the MathML token elements supported by the editor. As you type letters and numbers that become part of these elements, the Backspace and Delete keys are used to remove these characters. In token input mode, these keys work just about as you would expect from using a word processor or text editor. That is, using the Backspace key removes characters to the left of the insertion point, and using the Delete key removes characters to the right of the insertion point.


Operators

Outside of token input mode, the operation of the Backspace and Delete keys will depend on the operator being used in the parent element of the current expression. If an operator is declared as an nary operator, that is, an operator that accepts a variable number of child elements, then when the current expression is a child element of such an operator, the Backspace and Delete keys operate much as they do for token input mode. Using the Backspace key removes child elements to the left of the insertion point, and using the Delete key removes child elements to the right of the insertion point. Quite a few operators are declared as nary operators, including those that accept optional qualifier elements. The complete list of nary operators used in Zed is given in paragraphs on Nary Operators in the Operators section in the Reference part of the Users Guide.

The operation of the Backspace and Delete keys works somewhat differently in the context of array operators, like <matrix>. When the current expression is an element of the matrix, these keys provide operations for removing rows and columns of the matrix. Using the Backspace key removes matrix entries from right to left, bottom to top, from within the matrix, and using the Delete key removes the column containing the current expression. These column operations are augmented by keyboard accelerators for deleting rows of the matrix. Typing Ctrl+Backspace removes the array row containing the current expression and moves the expression cursor to the previous row, while typing the Ctrl+Delete key removes the array row containing the current expression and moves the expression cursor to the next row.

In addition to the uses of the Backspace and Delete keys described above, there are two other special operations for removing structure. For any operator that is being used in the parent element of the current expression, that operator can be removed by typing Shift+Delete. The result of this operation is that the parent element is completely replaced by the current expression, that is, the current expression is moved up in the expression tree.

For associative operators, when the current expression is an application of the same operator as is present in the parent element, typing the Shift+Up key flattens the one level of grouping implied by the structure of the current expression: the child elements of the current expression become child elements of the parent element, removing one level of structure.


Cut and Paste

The cut and paste operations on the Edit menu include standard operations for deleting portions of the document. By convention, the Edit→Cut operation removes the current expression, replacing it with a placeholder element, and copies it to the clipboard. Similarly, the Edit→Delete operation removes the current expression without copying it to the clipboard. Note especially that the delete operation on the Edit menu removes the current expression, while the delete operation invoked by the Delete key often deletes an expression to the right of the insertion point.

More information on the cut and paste operations and how they are supported in Zed can be found in the Cut and Paste paragraphs in the Basic Editing section.


Undo and Redo

One final pair of operations can also be used to achieve the result of removing a piece of structure that has just been created. Since the Edit→Undo and Edit→Redo menu items can be used to reverse any sequence of operations you perform in the editor, using these operations to undo the effect of an operation that just created something has the effect of removing whatever was just created. Successively applying the undo operation quite often provides a convenient alternative to the Backspace and Delete keys.