Difference between revisions of "Documentation/UserGuide/Math/Syntax"
Line 54: | Line 54: | ||
Other examples the the sum operator, the integral (int), close integral (oint), etc. | 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 <math>\frac{a}{b}</math> | ||
+ | |||
+ | '''a >= b''' will give <math>a \geq b</math> | ||
+ | |||
+ | == 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 <math>\int\limits_a ^b f</math> | ||
+ | |||
+ | 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 | ||
+ | |||
+ | [[File: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 a unitary 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 <math>\frac{a}{b}+c</math> while the second will give <math>\frac{a}{b + c}</math>. | ||
+ | |||
+ | 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|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 bellow.}} | ||
+ | |||
+ | 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 <math>\lbrace \frac{a}{b} \rbrace</math>, while | ||
+ | |||
+ | left lbrace a over b right rbrace | ||
+ | |||
+ | will give <math>\left \lbrace \frac{a}{b} \right\rbrace</math> | ||
+ | |||
+ | 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, <math>\left ] \frac{a}{b} \right (</math> y <math>\left [ \frac{a}{b} \right.</math> | ||
[[Category:Documentation]] [[Category:Documentation/Math]] | [[Category:Documentation]] [[Category:Documentation/Math]] |
Revision as of 23:50, 3 February 2013
Template:Documentation/DraftPage
On 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 on the section about inserting a Math object, the Math editor works on "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.
Commands that Needs Parameters
Some commands needs to be applied to other object 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
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.
Unitary Operators
Unitary operators only need one element. Example of unitary 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
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 a unitary 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.
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, y