Math Objects:

The Equation Editor

Contents

Overview	ii

Copyright and trademark information	ii

Feedback	ii

Acknowledgments	ii

Modifications and updates	ii

Starting Math: inserting an equation	1

Customizing the interface	1

Entering a formula	1

Working with Math within Writer	2

Math commands	3

Unary / binary operators	3

Relational operators	4

Set operations	5

Functions	6

Operators	7

Attributes	8

Others	10

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.

Copyright and trademark information

The contents of this Documentation are subject to the Public Documentation License, Version 1.0 (the "License"); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at:
http://www.openoffice.org/licenses/PDL.rtf

The Original Documentation is Math Objects: The Equation Editor. The Initial Writer(s) of the Original Documentation is/are Ian Laurenson © 2004. All Rights Reserved. (Initial Writer contact(s): hillview@paradise.net.nz. The Initial Writer contact(s) is to report errors in the documentation. For questions regarding how to use the software, subscribe to the Users Mail List and post your question there: http://support.openoffice.org/index.html.)

Contributor(s): Daniel Carrera rewrote the explanatory section of the document.

Portions created by Daniel Carrera are Copyright © 2004. All Rights Reserved. (Contributor contact(s): dcarrera@openoffice.org.)

All trademarks within this guide belong to legitimate owners.

Feedback

Please direct any comments or suggestions about this document to:
authors@user-faq.openoffice.org

Acknowledgments

This chapter is based on two documents written by Fred Saalbach.

Modifications and updates

Version	Date	Description of Change
1.0	21 November 2004	First published edition

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.

	(1)

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.

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:

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:

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 . Below is a short list of common equations and their corresponding markup.

Display	Command	Display	Command
	a = b		%gamma %GAMMA
	a^2		a_n
	int f(x) dx		sum a_n
	a <= b		infinity
	a over b		stack { a # b }
	sqrt {a}		vec u
	x times y		x cdot y

Complex Formulas

Of course, most people can figure out how to do something simple like . The problems appear when you try to write more complex equations. This section explores some general situations and suggests solutions.

Brackets are your friends

You may have heard your professor say this. It is true for science, and it is true for OOo. The equation editor knows nothing of order of operation. To make moderately complex formulas, you must use brackets. For example:

Display	Command
	x = { -b +- sqrt { b^2 - 4ac } } over { 2a }

Tip: Squiggly brackets can be used to collect terms without the bracket appearing in the equation.

Sums and integration

The “sum” and “int” commands can optionally take in “from” and “to” parameters. These are used in a way that is meant to resemble how the equation is read in English. These parameters can be used singly or together. For example:

Display	Command
	sum from { n = 1 } to infinity { a_n + 1 over n^2}
	sum from { i in A } { a^3 }
	int from a to b { x^2 + 1 over x dx }
	int from %alpha { r(%theta)e^{i%theta} d %theta }

Tip: Though they look the same, the “sum” command is more flexible than “%SIGMA”.

Tip: Use “infinity” to produce the symbol.

Matrices

Matrices are done through the matrix command. The basic syntax is:

Display	Command
	matrix { a # b ## 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.

Display	Command	Type
	det ( matrix { a # b ## c # d } )	normal
	det left( matrix { a # b ## c # d } right)	scalable

Tip: Use left[ and right] to obtain square brackets.

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)} over {dt} = {partial f} over {partial x} {dx } over {dt} + {partial f} over {partial y} {dy } over {dt}

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
	matrix { S_n #{}={}# alignl 1 + r + r^2 + dotsaxis + r^n ## rS_n #{}={}# alignl r + dotsaxis + r^n + r^{n+1} ## (1-r)S_n #{}={}# alignl 1 - r^{n+1} ## S_n #{}={}# alignl {1 - r^{n+1} } over {1-r} }

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 newline x – y = 1

Tips and tricks

Customizing the interface

There are a few ways to customize the equation editor's interface to make you more productive. Here are some suggestions:

Show/hide the Selection toolbox with View > Selection.

Turn off AutoUpdate with View >AutoUpdate display to improve speed. You can still update the formula manually by pressing F9 or through View > Update.

Turn the editor into a floating window:

Hover the mouse above the border of the equation editor.

Hold down the Control key.

Drag the editor away from the main window.

Numbering equations

Equation numbering is possible and simple. Sadly, this feature is deeply hidden. To insert a formula with a number, follow these steps:

Start a new line.

Type fn and then press F3.

You will see a numbered formula appear:

	(2)

Then double-click on the formula to edit it. For example, here is the Riemann Zeta function:

	(3)

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)”):

Insert > Cross-reference..

Click on the References tab. (See Figure 2.)

Under Type, select Text.

Under Selection, pick the equation number.

Under Format, choose Reference.

Click Insert.

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.

Figure 2. Inserting a cross-reference to an equation number.

Math commands - Reference

Unary / binary operators

Table 1. Commands, unary & binary

Operation	Command	Display
+sign	+1	
-sign	-1	
+/- sign	+-1	
-/+ sign	neg 1	
Boolean not	neg a	
Addition +	a + b	
Multiplication dot	a cdot b	
Multiplication (X)	a times b	
Multiplication (*)	a * b	
Boolean and	a and b	
Subtraction (-)	a - b	
Division (fraction)	a over b	
Division (operand)	a div b	
Division (slash)	a / b	
Boolean or	a or b	
Concatenate	a circ b	

Relational operators

Table 2. Commands, relations

Operation	Command	Display
Is equal	a = b	
Is not equal	a <> b	
Approximately	a approx 2	
Divides	a divides b	
Does not divide	a ndivides b	
Less than	a < 2	
Greater than	a > 2	
Similar to or equal	a simeq b	
Parallel	a parallel b	
Orthogonal to	a ortho b	
Less than or equal to	a leslant b	
Greater than or equal to	a geslant b	
Similar to	a sim b	
Congruent	a equiv b	
Less than or equal to	a <= b	
Greater than or equal to	a >= b	
Proportional	a prop b	
Toward	a toward b	
Arrow left	a dlarrow b	
Double arrow left and right	a dlrarrow b	
Arrow right	a drarrow b	

Set operations

Table 3. Commands, set operators

Operation	Command	Display
Is in	a in B	
Is not in	a notin B	
Owens	A owns b	
Empty set	emptyset	
Intersection	A intersection B	
Union	A union B	
Difference	A setminus B	
Quotient	A slash B	
Aleph	aleph	
Subset	A subset B	
Subset or equal to	A subseteq B	
Superset	A supset B	
Superset or equal to	A supseteq B	
Not subset	A nsubset B	
Not subset or equal	A nsubseteq B	
Not superset	A nsupset B	
Not Superset or equal	A nsupseteq B	
Natural Numbers Set	setN	
Set of Integers	setZ	
Set of rational numbers	setQ	
Set of real numbers	setR	
Set of complex numbers	setC	

Functions

Table 4. Commands, function

Operation	Command	Display
Exponential	func e^{a}	
Natural logarithm	ln(a)	
Exponential function	exp(a)	
Logarithm	log(a)	
Power	a^{b}	
Sine	sin(a)	
Cosine	cos(a)	
Tangent	tan(a)	
Cotangent	cot(a)	
Square root	sqrt{a}	
Arcsine	arcsin(a)	
Arc cosine	arccos(a)	
Arctangent	arctan(a)	
Arc cotangent	arccot(a)	
nth root	nroot{a}{b}	
Hyperbolic sine	sinh(a)	
Hyperbolic cosine	cosh(a)	
Hyperbolic tangent	tanh(a)	
Hyperbolic cotangent	coth(a)	
Absolute value	abs{a}	
Arc hyperbolic sine	arsinh(a)	
Arc hyperbolic cosine	arccosh(a)	
Arc hyperbolic tangent	arctanh(a)	
Arc hyperbolic cotangent	arccoth(a)	
factorial	fact(a)	

Operators

All operators can be used with the limit functions (“from” and “to”)

Table 5. Commands, operators

Operation	Command	Display
Limit	lim(a)	
Sum	sum(a)	
Product	prod(a)	
Coproduct	coprod(a)	
Limits from and to (shown with intigral)	int from {r_0} to {r_t} a	
Intigral	int{a}	
Double intigral	iint{a}	
Tripple Intigral	iiint{a}	
Lower limit shown with summation symbol	sum from{3}b	
Curved intigeral	lint a	
Double curved intigeral	llint a	
Tripple curved intigeral	lllint a	
Upper limit shown with product symbol	prod to{3} r	

Attributes

Table 6. Attributes

Operation	Command	Display
Acute accent	acute a	
Grave accent	grave a	
Reverse circumflex	check a	
Breve	breve a	
Circle	circle a	
Vector arrow	vec a	
Tilde	tilde a	
Circumflex	hat a	
Line above	bar a	
Dot	dot a	
Wide vector arrow	widevec abc	
Wide tilde	widetilde abc	
Wide circumflex	widehat abc	
Double dot	ddot	
Line over	overline abc	
Line under	underline abc	
Line through	overstrike acb	
Ripple dot	dddot a	
Transparent (useful to get a placeholder of a given size)	phantom a	
Bold font	bold a	
Italic font	ital a	
Resize font	size 16 qv	
Following item in sans serif font	font sans qv	
Following item in serif font	font serif qv	
Following item in fixed font	font fixed qv	
Make color of following text cyan	color cyan qv	
Make color of following text yellow	color yellow qv	
Make color of following text green	color white qv	
Make color of following text white	color green qv	
Make color of following text blue	color blue qv	
Make color of following text red	color red qv	
Make color green returns to default color black	color green X qv	
Brace items to change color of more than one item	color green {X qv}	

Others

Table 7. Commands, others

Operation	Command	Display
Infinity	infinity	
Partial	partial	
Nabla	nabla	
There exists	exists	
For all	forall	
H bar	hbar	
Lambda bar	lambdabar	
Real part	re	
Imaginary part	im	
Weierstrss p	wp	
Left arrow	leftarrow	
Right arrow	rightarrow	
Up arrow	uparrow	
Down arrow	downarrow	
Dots at bottom	dotslow	
Dots at middle	dotsaxis	
Dots vertical	dotsvert	
Dots diagonal upward	dotsup	
Dots diagonal downward	dotsdown	

Brackets

Table 8. Commands, braces

Operation	Command	Display
Round Brackets	(a)	
Square Brackets	[b]	
Double Square Brackets	ldbracket c rdbracket	
Single line	lline a rline	
Double line	ldline a rdline	
Braces	lbrace w rbrace	
Angle Brackets	langle d rangle	
Operator Brackets	langle a mline b rangle	
Group brackets (used for program control)	{a}	
Scalable round brackets (add the word “left before a left bracket and “right” before a right bracket).	left ( stack{a # b # z} right )	
Square brackets scalable (as above).	left [ stack{ x # y} right ]	
Double square brackets scalable	left ldbracket c right rdbracket	
Line scalable	left lline a right rline	
Double line scalable	left ldline d right rdline	
Brace scalable	left lbrace e right rbrace	
Angle bracket scalable	left langle f right rangle	
Operator brackets scalable	left langle g mline h right rangle	
Over brace scalable	{The brace is above} overbrace a	
Under brace scaleable	{the brace is below}underbrace {f}	

Formats

Table 9. Commands, formats

Operation	Command	Display
Left Superscript	a lsup{b}	
Center Superscript	sum(a)a csup{b}	
Right Superscript	a^{b}	
Left subscript	a lsub{b}	
Center subscript	a csub{b}	
Right subscript	a_{b}	
Align character to left	stack { Hello world # alignl (a) }	
Align character to center	stack{Hello world # alignc(a)}	
Align character to right	stack { Hello world # alignr(a)}	
Vertical stack of 2	binom{a}{b}	
Vertical stack, more than 2	stack{a # b # z}	
Matrix stack	matrix{a # b ## c # d}	
Common mathematical arrangement	matrix{a # "="b ## {} # "="c}	
New Line	asldkfjo newline sadkfj	
Small gap (apostrophe)	stuff`stuff	
Large gap (tilde)	stuff~stuff	

Characters – Greek

Table 10. Characters, Greek

%ALPHA		%BETA		%CHI		%DELTA		%EPSILON	
%ETA		%GAMMA		%IOTA		%KAPPA		%LAMBDA	
%MU		%NU		%OMEGA		%OMICRON		%PHI	
%PI		%PSI		%RHO		%SIGMA		%THETA	
%UPSILON		%XI		%ZETA					
%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

Unquoted text that isn't a command is considered to be a variable. Variables are, by default, italicized.

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 commands - Reference

Math Objects	5

Title:	Math Objects: The Equation Editor
Version:	1.0
First edition:	November 2004
First English edition:	November 2004

Overview

Math Objects	v

Math Objects

Jean Hollis Weber

2004-11-13T12:44:03