December 7, 2009

Add Formulas to Documents with Math

binomial identityWhat if I asked you to add the formula shown in Figure 1 into an OpenOffice document? How would you do that? Would you attempt to create it using Writer? If so how? Would you have to somehow manipulate tables and font sizes and add special characters? Or would you attempt to create a graphic in The Gimp and then insert a png or jpg file? But what if that formula needed to change? Would you then have to go back and re-create the formula and re-add the image? 

What if I told you that has a tool specifically for the creation and use of formulas into the various pieces of the suite? Math is an outstanding means to creating complex formulas which can then be inserted as objects into of the tools. And although Math does require both an understanding of the formulas you want to create and a little bit of problem solving, it is not complicated to use. But ultimately, without Math, the task of using complex formulas in your documents would be ex harder.

In this tutorial you are going to see how to create complex formulas with Math, and then use those formulas within

Understanding Objects

Before we go about working with these formulas it might be wise to first understand how objects work in An OLE (Object Linking and Embedding) object is an object created in one application and linked to from another application. And if you have any understanding of linking, you know that if the original object is changed that change will be reflected in the document that links to it.

Let me explain it another way:

  1. You create Object A in Math.
  2. You insert Object A as an Object in Writer.
  3. You decide the Object is incorrect so you open up Math and make a change.
  4. That change is automatically reflected in the inserted object in the Writer document.

That is why using objects like a Math formula is so much more efficient than creating and inserting images. If you created an image for your formula, you would have to edit the image and then re-insert the image in Writer in order for the change to be reflected. And who knows how difficult editing that image would be. 

Creating Your First Formula

Now let's get to the creation of a formula.  If you look in the Office subdirectory of your main menu you should see an entry for Math entry. If not, in order to open Math, you will have to do so from within another one of's applications. Most likely, however, you will have an entry for Math.

Math main windows

When you open up Math you will see two windows (see Figure 2). The larger of the two windows is where you do your work. In that window the upper pane is the preview pane and the lower pane is the work pane. 

The smaller of the two windows is  the Selection window. Here pieces of formulas are selected and added to your work. The Selection does not have to be used. All formulas can be entered manually in the bottom pane of the work window. The Selection window just offers an easier solution for those not as familiar with creating formulas with Math.

For our first formula we will start simple. Let's use the Pythagorean theorem for our first example. This theorem (for those that do not know) is:


Although this theorem is fairly simple to create in a word processor, it makes for easy demonstration. Here's the steps for adding this formula:

  1. Pythagorean's TheoremFrom the upper section of the Selection window click on the Uniary/Binary Operators button.
  2. Click on the a+b button.
  3. Highlight the first in the lower pane of the working window.
  4. Click on the Formats button.
  5. Click on the xb button and you will see ^{} appear in the lower pane of the working window.
  6. Replace the first with "a" (no quotes).
  7. Replace the second (inside the braces) with "2" (no quotes).
  8. Highlight the first after the  "+" symbol.
  9. Click on the xb button in the Selection window again.
  10. Replace the first with "b" (no quotes).
  11. Replace the second (inside the braces) with "2" (no quotes). 

What you should now see will resemble what you see in Figure 3. Of course what is missing is the right side of the equation.

  1. Go back to the Selection window and click the Relations button.
  2. Click the a=b button.
  3. In the lower pane of the working window you will see that = has been added. 
  4. Delete the first from new section.
  5. Highlight the remaining .
  6. Go back to the Formats section in the Selections window.
  7. Click on the xb button.
  8. Replace the first with "c" (no quotes).
  9. Replace the final with "2" (no quotes).

 You now have Pythagorean's theorem ready to save and use as an OLE object for any tool in

Because this particular formula is so simple, you could have just typed in the following (in the lower pane of the working window):

a^2 + b^2 = c^2

which would render the same results.

Now you need to save your formula. Follow these steps:

  1. Go to the File menu and select Save.
  2. Navigate to the directory where you want to save your formula.
  3. Select .odf as the file type.
  4. Click Save.

Your formula is ready to be used in another application. Open up Writer and follow these steps in order to insert your formula:

  1. Click on the Insert menu.
  2. Click on the Object sub-menu.
  3. Select OLE Object.
  4. Click the Create from file radio button.
  5. Click the Search button.
  6. Navigate to where you saved the formula and select that formula.
  7. Click OK.

The formula will appear in your document. 

Activated objectNow, say you need to make changes to your formula. Go to the new document you created. If you right click on your formula a new menu will appear. From that menu select the "Activate OLE Object" entry and a new pane will open up (see Figure 4). In the lower pane you can edit the formula to reflect your changes. Once you are done making your changes click anywhere in the upper pane to dismiss the editor and your changes will automatically appear.

The adding of formulas is the same, no matter how complex they are and no matter which tool you use.

Final Thoughts

Without Math, creating formulas for documents would be a nightmare of a task. But thankfully has taken care of that task. If you find yourself having trouble piecing together more complex formulas, you might check out the Math Command Wiki. That resource will go a long way to help you getting your formulas together.




Click Here!