Syntax Elements for Math

From Apache OpenOffice Wiki
Jump to: navigation, search

Editing.png This page is in a DRAFT stage.



In this section some basic elements about how to build a mathematical expression on Apache OpenOffice Math will be provided.

Simple Commands and Functions

As seen in the section about inserting a Math object, the Math editor works in "text mode".

There are several kinds of Math instructions, all of them represented by text with a particular meaning. For example, writing %gamma a Greek character will be obtained, cos will be interpreted as the cosine function while newline will insert a new line on the expression.

Documentation note.png A space on Math will not be considered as such unless inserted between double quotes (see below). To insert a small horizontal space the ` accent is needed while a bigger space is introduced with ~
Documentation note.png Any text that it is not a command (function, operator, etc) will be considered as variable. By default, variables are shown in italics.

For a partial list of commands, see this page.

Tip.png With a right click on the Math editor area, you have access to an organized list with all available commands.


Commands that Needs Parameters

Some commands need to be applied to other objects because alone do not have sense. For example, the "decorations" like a vector arrow:

 vec a

will give while

 widevec a

will give

This second command can be used to put the arrow over more than one element, to obtain for example

There are also instructions that need the use of parameters to define their action, for example the command "color"

 A color red {BC} D

will give

Placeholders

When inserting operators from the contextual menu or the Elements window, the following structure will be introduced too

 <?>

This is a "placeholder" used to avoid errors for missing arguments and can be replaced with the needed content. On the preview a placeholder shows as a box with a shadow.

Operators and Relations

Writing on a Math object the command over without any other text, only a red question mark will be obtained: the command over is a binary operator that needs two objects (numerator and denominator of the fraction) to work.

Unary Operators

Unary operators only need one element. Example of unary operators are:

+a will give

-a will give

+-a will give

-+a will give

Other examples the the sum operator, the integral (int), close integral (oint), etc.

Binary Operators

As commented above, binary operators need two elements. Examples of binary operators are

a over b will give

a >= b will give

Special Operators

Some operators modify the output of other operators. For example, the operators from and to can be used to insert limits on operators

int from a to b f will give

A particular operator is "nospace": this operator reduce the horizontal space between two elements, as it is possible to see on the following screen shot

ES-Nospace.png

Finally, there are two operators that can be used to turn any element into an operator: oper and boper. The first one turn the following element into an unary operator while the second turn the element on a binary operator. The reader can check the result of the following line of code on a Math object

 oper A from a to b A

Groups and Brackets

Compare the result of the following expressions

 a over b + c
 a over {b + c}

the first one will give while the second will give .

The braces are used to group elements on an equation. It is important to note that the braces, as well as the brackets, needs to be closed: with only a left brace or a right brace Math will display an error.

Documentation caution.png Braces and brackets must be closed on the same line: it is not possible to insert a newline command between two brackets. The braces to group must be closed on each line. For the brackets, see below.

To insert braces that can be seen on the resulting expression, the commands lbrace and rbrace must be used for { and } respectively.

Brackets can be inserted from the keyboard directly.

To obtain scalable brackets that grows with the expression the commands left and right must be used. For example

 lbrace a over b rbrace

will give , while

 left lbrace a over b right rbrace

will give

Using left and right it is possible to match any pair of brackets, or even left one extreme "empty" with the none command

 left ] a over b right (
 left [ a over b right none

will give, respectively, and

It is possible to use single, non scalable brackets by inserting a slash before them

 \(
 \[
 \lbrace

etcetera. They will be considered by Math as single characters without special meaning.

Inserting "Normal" Text

As commented above, every text not recognized as command or function will be considered as variable, displaying, on the default configuration, on italics.

To insert short text sections, the best way is to enclose it between double quotes. The reader can try the following on a Math object

 two words "two words"

On the first part, the text will show on italics and without space between the words while the second part will be displayed as normal text.

Personal tools