Math Objects
Math Objects
Math Objects i
Overview
Overview
OpenOffice.org has a component (OOo Math) for mathematical equations. OOo Math
provides mathematical objects which can be embedded in other OOo documents, or saved on
their own.
Feedback
Please direct any comments or suggestions about this document to:
[email protected]
Acknowledgments
This chapter is based on two documents written by Fred Saalbach.
Math Objects ii
Introduction
Introduction
OpenOffice.org (OOo) has a component for mathematical equations. It is most commonly
used as an equation editor for text documents, but it can also be used with other types of
documents or stand-alone. When used inside Writer, the equation is treated as an object
inside the text document.
Important note: The equation editor is for writing equations in symbolic form (as in equation 1).
If you want to evaluate a numeric value, this is not the chapter you want. See the Calc guide.
df x
=ln xtan−1 x 2 (1)
dx
Getting started
To insert an equation, go to Insert > Object > Formula.
The equation editor opens at the bottom of the screen, and the floating Selection toolbox
appears. You will also see a small box (with a gray border) in your document, where the
formula will be displayed.
Figure 1. Writer document showing Equation Editor , Selection toolbar, and location of resulting equation.
Math Objects 1
Introduction
The equation editor uses a markup language to represent formulas. For example, “%beta”
creates the Greek character beta ( ). This markup is designed to read similar to English
whenever possible. For example, “a over b” produces a fraction:
a
b
Entering a Formula
There are three main ways of entering a formula:
• Type markup in the equation editor.
• Right-click on the equation editor and select the symbol from the context menu.
• Select a symbol from the Selection toolbox.
The context menu and the Selection toolbox insert the markup corresponding to a symbol.
Incidentally, this provides a convenient way to learn the OOoMath markup. When you select
a symbol from the Selection toolbox, it will show up like this in this equation editor:
<?> times <?>
And it will display on screen in Writer like this:
×
When you are editing in the equation editor, you need to remove the <?> and replace it with
the terms of the equation. For example, “5 times 4” produces 5×4 . Below is a short list of
common equations and their corresponding markup.
Display Command Display Command
a=b a=b %gamma %GAMMA
a
2 a^2 an a_n
a a over b a stack { a # b }
b b
a sqrt {a}
u vec u
Math Objects 2
Complex Formulas
Complex Formulas
Of course, most people can figure out how to do something simple like a . The problems
appear when you try to write more complex equations. This section explores some general
situations and suggests solutions.
Tip: Squiggly brackets can be used to collect terms without the bracket appearing in the
equation.
Tip: Though they look the same, the “sum” command is more flexible than “%SIGMA”.
Tip: Use “infinity” to produce the ∞ symbol.
Math Objects 3
Complex Formulas
Matrices
Matrices are done through the matrix command. The basic syntax is:
Display Command
a b matrix { a # b ## c # d }
c d
A single “#” symbol is used to separate entries within a given row. Two “#” symbols are
used to separate different rows.
One of the first problems people have with matrices is working with brackets. Regular
brackets have a fixed size, which doesn't fit well with matrices (see the table below).
OOoMath provides “scalable brackets”. These brackets adjust in size (“scale”) to fit the size
of their contents. To obtain scalable brackets, use the left( and right) commands.
a b det left( matrix { a # b ## c # d } right) scalable
det
c d
Derivatives
To write a derivative, or a partial derivative, use the “over” command. That is, treat it as if it
were a fraction. For higher-order derivatives, use the ^ symbol, like an exponent.
Display Command
df t ∂ f dx ∂ f dy {df(t)} over {dt} = {partial f} over {partial x} {dx } over {dt}
= + {partial f} over {partial y} {dy } over {dt}
dt ∂ x dt ∂ y dt
Math Objects 4
Complex layout
Complex layout
Often, the problem is not in writing the equation as such, but obtaining the desired layout.
There are some features that can help:
• Adjust alignment with “alignl” (left alignment), “alignr” (right alignment) and
“alignc” (centered).
• Use matrices for columned layout.
• Use white space and several lines to make your equation understandable.
• Use ~ or ‘ to produce white space on the equation.
Tip: You can insert white space and additional lines in the markup without affecting the output
of the equation.
The following example illustrates most of the above.
Display Command
In addition to matrices, you can also used the newline command to move to a new line.
Notice (below) that the newline command does not have to be on a line of its own.
Display Command
x y=3 x + y = 3 newline x – y = 1
x− y=1
Math Objects 5
Tips and tricks
Numbering equations
Equation numbering is possible and simple. Sadly, this feature is deeply hidden. To insert a
formula with a number, follow these steps:
1) Start a new line.
2) Type fn and then press F3.
You will see a numbered formula appear:
2
E =mc (2)
Then double-click on the formula to edit it. For example, here is the Riemann Zeta function:
∞
1
z =∑ (3)
n=1 nz
The number in the equation is stored in the form of a field. To refer to an equation by its
number (for example, “as shown in Equation (2)”):
1) Insert > Cross-reference..
2) Click on the References tab. (See Figure 2.)
3) Under Type, select Text.
4) Under Selection, pick the equation number.
5) Under Format, choose Reference.
6) Click Insert.
Math Objects 6
Tips and tricks
Done! If you later add more equations to the paper before the referenced equation, all the
equations will automatically renumber and the cross-references will update.
Math Objects 7
Math commands - Reference
Math Objects 8
Math commands - Reference
Relational operators
Table 2. Commands, relations
Math Objects 9
Math commands - Reference
Set operations
Table 3. Commands, set operators
Math Objects 10
Math commands - Reference
Functions
Table 4. Commands, function
Math Objects 11
Math commands - Reference
Operators
All operators can be used with the limit functions (“from” and “to”)
Table 5. Commands, operators
Intigral int{a}
∫a
Double intigral iint{a}
∬a
Tripple Intigral iiint{a}
∭a
Lower limit shown with
summation symbol
sum from{3}b ∑b
3
Math Objects 12
Math commands - Reference
Attributes
Table 6. Attributes
1 Unquoted text that isn't a command is considered to be a variable. Variables are, by default, italicized.
2 There are three custom fonts: sans serif (without kicks), serifs (with kicks), and fixed (non proportional). To
change the actual fonts used for custom fonts and the fonts used for variables (unquoted text), numbers and
functions, use: Format > Fonts.
Math Objects 13
Math commands - Reference
Math Objects 14
Math commands - Reference
Others
Table 7. Commands, others
Math Objects 15
Math commands - Reference
Brackets
Table 8. Commands, braces
Scalable round brackets left ( stack{a # b # z} right ) a
(add the word “left before a
left bracket and “right” b
before a right bracket). z
[ xy ]
Square brackets scalable left [ stack{ x # y} right ]
(as above).
Math Objects 16
Math commands - Reference
Formats
Table 9. Commands, formats
Math Objects 17
Math commands - Reference
Characters – Greek
Table 10. Characters, Greek
%ALPHA A %BETA B %CHI X %DELTA %EPSILON E
%ETA H %GAMMA %IOTA I %KAPPA K %LAMBDA
%MU M %NU N %OMEGA %OMICRON O %PHI
%PI %PSI %RHO P %SIGMA %THETA
%UPSILON %XI %ZETA Z
%alpha %beta %chi %delta %epsilon
%eta %gamma %iota %kappa %lambda
%mu %nu %omega %omicron %phi
%pi %rho %sigma %tau %theta
%upsilon %varepsilon %varphi %varpi %varrho ϱ
%varsigma %vartheta %xi %zeta
Characters - Special
Table 11. Characters, special
%and ∧ %angle ∢ %element ∈ %identical ≡
%infinite ∞ %noelement ∉ %notequal ≠ %or ∨
%perthousand %strictlygreaterthan ≫ %strictlylessthan ≪ %tendto
Math Objects 18