<< Chapter < Page Chapter >> Page >

Remember that each operator in MathML has a specific number of arguments that can be associated with it. For instance, the operator plus must have at least two arguments (as in x y ) up to an unlimited number of arguments (as in 1 2 3 4 5 6 ...). The operator root has one required argument (the radicand, as in 3 ), as well as one optional argument for specifying which root power (as in 6 3 ).

When you insert a series of characters into the editor, the editor will correctly parse some of the symbols you enter as operators, and some as arguments of the operators. Furthermore, it correctly determines which operator you have typed in, and correctly associates the surrounding symbols as arguments of that operator.

The menu buttons in the toolbar will paste an operator over your highlighted expression, and insert blank blocks for all the required and optional arguments of the operator. This means that keyboard input and toolbar insertion are useful for different things.

  • When you are just beginning a new expression and already know the relations of the arguments to one another. For instance, if you have a written version of an equation in front of you and want to recreate it in the MathML editor so that you can paste the MathML code into a module. We recreate the equation a x 2 b x c in the sections below using only the toolbar, or find a more complicated and in-depth example in the module MathML Editor: Intermediate .
  • When the operator has many arguments associated with it.
  • When the operator does not have a keyboard shortcut, or if you do not know the keyboard shortcut. To the right of each menu entry, there is the keyboard shortcut for that operator. For complicated operators, you often must type in the name of the element (for instance, "root"), and the editor will provide a visual representation (the radical sign, in this case) and blank boxes for argument entry.
  • For most simple MathML entry.
  • When you want your existing expression in the editing area to become one argument of a new operation. To add a new argument to the plus operator x y , you need only type +z . The editor interprets z as one argument of the plus operator, and the previously existing expression as the other argument. Toolbar insertion cannot do this. Some examples of workarounds are given below.

The following sections will show you how to create an expression from scratch using mainly toolbar entry, and how to use part or all of your existing expression as one argument of a new operator.

Creating a new expression

The toolbars are useful when creating new expressions because you work "from the top down". The operator with the broadest scope is inserted from the menus first. Then, the arguments are filled in with variables and numbers, or with another complex expression. If one complex expression is itself an argument of an operator, you can use the toolbar to insert the operator first, and then fill in the arguments again. Continue this iteration with successively narrower scoped operators, until only number and variables are left to be inserted as arguments.

Let's create a x 2 b x c using the toolbar menus, and in the same order that we created it with keyboard input above . We'll first insert x 2 b x , then add c as an argument to the existing plus operator, and finally add a as an argument in a new operation.

Make sure the editing area in the MathML editor is blank. It should already be blank if you've just opened it. If you have some text entered, delete it first.

The expressions x 2 and b x stand in relation to one another as arguments of a plus operator, so we will start by inserting a plus operator and then inserting successively smaller chunks of the expression.

  1. Click the plus operator from the toolbar.
  2. To create the x 2 expression, click within the first block in the plus operation, then select the power operator from the toolbar.
  3. Click within the first block in the power operation, and type in x .
  4. Click within the second block in the power operation, and type in 2 .
  5. To create the b x expression, click within the remaining block, which should be the second argument of the plus operation, and select the times operator from the toolbar.
  6. Click within the first block of the times operation, and type in b .
  7. Click within the second block of the times operation, and type in x .

Adding an argument to an existing operation

There are two ways we can add the final argument c to the plus operator. One way would have been to add an extra argument to the plus operation immediately after we inserted it from the toolbar menu. After Step 1 above, click in either blank block on each side of the + sign. Then insert another plus operation. Essentially we are inserting the entire operator as an argument of the first plus operator, but the editor will correctly condense this and turn all three blocks into arguments of one plus operator. The same thing occurs with keyboard input when, say, you replace the 6 in 6 7 with 5 6 .

The second method would be to want to add a new argument to the plus operator after we already created the expression x 2 b x . In this case, we essentially want to make x 2 b x the first argument of a new plus operator, and then add c as the second operator. This is known as " wrapping " existing math in a new operation.

  1. Select the entire expression and cut it by pressing Ctrl+X (or ⌘+X on a Mac), so that you are left with a blank editing area.
  2. Select the plus operator from the toolbar menu.
  3. Paste in the expression x 2 b x as the first argument of the operation.
  4. Click in the remaining block and type in c .

Creating a new operation

You will also have to wrap existing math when inserting a new operation. Let's change the first expression x 2 to a x 2 .

  1. Select and cut the power operation x 2 . You should be left with a blank block + b x c .
  2. Insert a times operator from the toolbar menu.
  3. Click on the first block of the times operator and type in a .
  4. Click on the second block of the times operator and paste in the expression that you cut.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Connexions guide to mathml. OpenStax CNX. Aug 24, 2009 Download for free at http://cnx.org/content/col10963/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Connexions guide to mathml' conversation and receive update notifications?

Ask