Difference between revisions of "Documentation/OOoAuthors User Manual/Writer Guide/Math Objects"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Relational operators)
(Set operations)
Line 118: Line 118:
  
 
== Set operations ==
 
== Set operations ==
{|
+
{| border="1"
| ||'''''Operation'''''||'''''Command'''''||'''''Display'''''||
+
||'''''Operation'''''||'''''Command'''''||'''''Display'''''||
 
|-
 
|-
| ||Is in||a in B||inline:Object91.png||
+
||Is in||a in B||
 
|-
 
|-
| ||Is not in||a notin B||inline:Object92.png||
+
||Is not in||a notin B||
 
|-
 
|-
| ||Owns||A owns b||inline:Object93.png||
+
||Owns||A owns b||
 
|-
 
|-
| ||Empty set||emptyset||inline:Object94.png||
+
||Empty set||emptyset||
 
|-
 
|-
| ||Intersection||A intersection B||inline:Object95.png||
+
||Intersection||A intersection B||
 
|-
 
|-
| ||Union||A union B||inline:Object96.png||
+
||Union||A union B||
 
|-
 
|-
| ||Difference||A setminus B||inline:Object97.png||
+
||Difference||A setminus B||
 
|-
 
|-
| ||Quotient||A slash B||inline:Object98.png||
+
||Quotient||A slash B||
 
|-
 
|-
| ||Aleph||aleph||inline:Object99.png||
+
||Aleph||aleph||
 
|-
 
|-
| ||Subset||A subset B||inline:Object100.png||
+
||Subset||A subset B||
 
|-
 
|-
| ||Subset or equal to||A subseteq B||inline:Object101.png||
+
||Subset or equal to||A subseteq B||
 
|-
 
|-
| ||Superset||A supset B||inline:Object102.png||
+
||Superset||A supset B||
 
|-
 
|-
| ||Superset or equal to||A supseteq B||inline:Object103.png||
+
||Superset or equal to||A supseteq B||
 
|-
 
|-
| ||Not subset||A nsubset B||inline:Object104.png||
+
||Not subset||A nsubset B||
 
|-
 
|-
| ||Not subset or equal||A nsubseteq B||inline:Object105.png||
+
||Not subset or equal||A nsubseteq B||
 
|-
 
|-
| ||Not superset||A nsupset B||inline:Object106.png||
+
||Not superset||A nsupset B||
 
|-
 
|-
| ||Not superset or equal||A nsupseteq B||inline:Object107.png||
+
||Not superset or equal||A nsupseteq B||
 
|-
 
|-
| ||Set of natural numbers||setN||inline:Object108.png||
+
||Set of natural numbers||setN||
 
|-
 
|-
| ||Set of integers||setZ||inline:Object109.png||
+
||Set of integers||setZ||
 
|-
 
|-
| ||Set of rational numbers||setQ||inline:Object110.png||
+
||Set of rational numbers||setQ||
 
|-
 
|-
| ||Set of real numbers||setR||inline:Object112.png||
+
||Set of real numbers||setR||
 
|-
 
|-
| ||Set of complex numbers||setC||inline:Object113.png||
+
||Set of complex numbers||setC||
 
|-
 
|-
 
|}
 
|}
Line 170: Line 170:
  
 
:
 
:
 
  
 
== Functions ==
 
== Functions ==

Revision as of 04:39, 16 September 2007

Editing.png Статья в работе (ЧЕРНОВИК), и находится в процессе написания.

This page was created by converting ODT to Mediawiki using Writer2MediaWiki. The page needs cleaning up, and figures added.

This is Chapter 16 of the OpenOffice.org 2.x Writer Guide (Third edition), produced by the OOoAuthors group. A PDF of this chapter is available from the OOoAuthors Guides page at OpenOffice.org.

<< User Manuals page
<< Writer Guide Table of Contents
<< Chapter 15 Using Forms in Writer   |    Appendix A Keyboard Shortcuts >>


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.

Documentation note.png The equation editor is for writing equations in symbolic form (as in equation 1). If you want to evaluate a numeric value, 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 Elements window (called “Selection” before Math 3.2 and “Formula Elements” in Math 3.2) may appear. You will also see a small box (with a gray border) in your document, where the formula will be displayed.

Equation Editor, Elements window, 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:

To insert a numbered formula in Writer, type fn then press the  F3  key.

Additional References

For very basic step-by-step instructions and tutorials for specific tasks, see http://plan-b-for-openoffice.org/math/index


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: .

You can enter a formula in three ways:

  • Select a symbol from the Elements window.
  • Right-click on the equation editor and select the symbol from the context menu.
  • Type markup in the equation editor.

The context menu and the Elements window insert the markup corresponding to a symbol. Incidentally, this provides a convenient way to learn the OOoMath markup.

Documentation note.png Click on the document body to exit the formula editor.
Double-click on a formula to enter the formula editor again.

The Elements window

The simplest method for entering a formula is the Elements window, shown below.

Symbols are divided into categories.

The Elements window is divided into two main portions.

  • The top shows the symbol categories. Click on these to change the list of symbols.
  • The bottom shows the symbols available in the current category.
Tip.png You can hide (or unhide) the Elements window with View > Elements.


Example 1: 5 × 4

For this example we will enter a simple formula: 5 × 4

On the Elements window:

  1. Select the top-left button of the categories (top) section.
  2. Click on the multiplication symbol.
Unary/binary operators.

When you select the multiplication symbol on the Elements window, two things happen:

  • The equation editor shows the markup: <?> times <?>
  • The body of the document shows a gray box with the figure:
The multiplication symbol.

The <?> symbols are placeholders that you can replace by other text. The equation will update automatically, and the result should resemble the figure below.

Result of multiplication
Result of entering "5" and "4" next to the "times" operator.

Tip.png To keep the equation from updating automatically, select View > AutoUpdate display. To update a formula manually, press F9 or select View > Update.


Right-click menu

Another way to access mathematical symbols is to right-click on the equation editor. This produces a menu as shown in the figure below.

Right-click menu.
Documentation note.png The entries in this menu correspond exactly to those in the Elements window.

Markup

You can type the markup directly in the equation editor. For example, you can type “5 times 4" to obtain . If you know the markup, this can be the fastest way to enter a formula.

Tip.png The formula markup resembles the way the formula reads in English.


Below is a short list of common equations and their corresponding markup.

Display Command Display Command
a=b a = b a sqrt {a}
a2 a^2 an a_n
f(x)dx int f(x) dx an sum a_n
a≤b a <= b infinity
a×b a times b x·y x cdot y

Greek characters

Greek characters (α, β, γ, θ, etc.) are common in mathematical formulas. These characters are not available in the Elements window or the right-click menu. Fortunately, the markup for Greek characters is simple: Type a % sign followed the name of the character, in English.

  • To type a lowercase character, write the name of the character in lowercase.
  • To type an uppercase character, write the name of the character in uppercase.

See the table below for some examples.

Lowercase Uppercase
%alpha α %ALPHA Α
%beta β %BETA Β
%gamma γ %GAMMA Γ
%psi ψ %PSI Ψ
%phi φ %PHI Φ
%theta θ %THETA Θ
Documentation note.png A complete table of Greek characters is included at the end of the Reference section.

Another way to enter Greek characters is by using the catalog window. Go to Tools > Catalog. The catalog window is shown below. Under “Symbol Set" select “Greek" and double-click on a Greek letter from the list. The markup name of the character is shown below the list window.

Catalog, used for entering Greek characters and some special symbols.

Example 2: π 3.14159

For this example we will suppose that:

  • We want to enter the above formula (the value of pi rounded to 5 decimal places).
  • We know the name of the Greek character ("pi").
  • But we do not know the markup associated with the symbol.

Step 1: Type % followed by the text pi. This displays the Greek character π.

Step 2: Open the Elements window (View > Elements).

Step 3: The symbol is a relation, so we click on the relations button MathRelBtn.png. If you hover the mouse over this button you see the tooltip "Relations".

Tooltip indicates the "Relations" button.
After selecting "Relations".

Step 4: Click on the symbol. The equation editor now shows the markup %pi<?> simeq <?>.

Step 5: Delete the <?> text and add 3.14159 at the end of the equation. Hence we end up with the markup %pi simeq 3.14159. The result is shown below.

Final result.

Formula editor as a floating window

As seen in Figure 1, the formula editor can cover a large part of the Writer window. To turn the formula editor into a floating window, do this:

  1. Hover the mouse over the editor frame, as shown below.
  2. Hold down the Control key and double-click.
Hold down the Control key and double-click on the border of the math editor to turn it into a floating window.

The figure below shows the result. You can make the floating window back into an embedded frame, using the same steps. Hold down the Control key and double-click the window frame.

Equation editor as a floating window.

How can I make a formula bigger?

This is one of the most common questions people ask about OOoMath. The answer is simple, but not intuitive:

  1. Start the formula editor and go to Format > Font size.
  2. Changing font size for a formula.
  3. Select a larger font size under “Base Size" (top-most entry), as shown below.
  4. Edit Base Size

    Edit "Base size" (top) to make a formula bigger.

The result of this change is illustrated below.

Result of changing the base font size.

The most difficult part of using OOo Math comes when writing complicated formulas. This section provides some advice.


Brackets are your friends

OOo Math knows nothing about order of operation. You must use brackets to state the order of operations explicitly. Consider the following example:

Markup Result
2 over x + 1
2 over {x + 1}

Equations over more than one line

Suppose you want to type an equation covering more than one line. For example:

Your first reaction would be to simply press the Enter key. However, if you press the Enter key, though the markup goes to a new line, the resulting equation does not. You must type the newline command explicitly. This is illustrated in the table below.

Markup Result
x = 3
y = 1
x = 3 newline
y = 1



See Also



How do I add limits to my sum/integral?

The “sum" and “int" commands can (optionally) take in the parameters “from" and “to". These are used for lower and upper limits respectively. These parameters can be used singly or together. Limits for integrals are usually treated as subscripts and superscripts.

Markup Result
sum from k = 1 to n a_k
int from 0 to x f(t) dt
or
int_0^x f(t) dt
or
int from Re f
sum to infinity 2^{-n}
Documentation note.png For more details on integrals and sums, see the Math commands reference.

Brackets with matrices look ugly!

For background, we start with an overview of the matrix command:

Markup Result
matrix { a # b ## c # d }
Documentation note.png Rows are separated by two #'s and entries within each row are separated by one #.

The first problem people have with matrices is that brackets do not “scale" with the matrix:

Markup Result
( matrix { a # b ## c # d } ) ()

OOoMath provides “scalable" brackets. That is, the brackets grow in size to match the size of their contents. Use the commands left( and right) to make scalable brackets.

Markup Result
left( matrix { a # b ## c # d } right)
Tip.png Use left[ and right] to obtain square brackets.


How do I make a derivative?

Making derivatives essentially comes down to one trick: Tell OOo it's a fraction.

In other words, you have to use the over command. Combine this with either the letter “d" (for a total derivative) or the partial command (for a partial derivative) to achieve the effect of a derivative.

Markup Result
{df} over {dx}
{partial f} over {partial y}
{partial^2 f} over {partial t^2}
Documentation note.png Notice that we have to use braces (squiggly brackets) to make the derivative.

Numbering equations

Equation numbering is one of OOoMath's best hidden features. The steps are simple, but obscure:

  1. Start a new line.
  2. Type “fn" and then press F3.

The “fn" is replaced by a numbered formula:

(2)

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

(3)

You can reference an equation (“as shown in Equation (2)") with these steps:

  1. Insert > Cross-reference..
  2. Click on the References tab (Figure 15).
  3. Under Type, select Text.
  4. Under Selection, pick the equation number.
  5. Under Format, choose Reference.
  6. 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.

Frame15.png
Tip.png To insert the equation number without parenthesis around it, choose Numbering under Format instead of Reference.


Math commands - Reference

Unary / binary operators

Operation Command Display
+sign +1 +1
-sign -1 −1
+/- sign +-1 ±1
-/+ sign -+1 inline:Object42.png
Boolean not neg a ¬a
Addition + a + b a+b
Multiplication dot a cdot b a·b
Multiplication (X) a times b a×b
Multiplication (*) a * b inline:Object47.png
Boolean and a and b a∧b
Subtraction (-) a - b a−b
Division (fraction) a over b inline:Object294.png
Division (operand)   a div b a÷b
Division (slash) a / b a/b
Boolean or a or b a∨b
Concatenate a circ b inline:Object298.png


Relational operators

Operation Command Display
Is equal a = b a=b
Is not equal a <> b a≠b
Approximately a approx 2 a≈b
Divides a divides b
Does not divide a ndivides b
Less than a < 2 a<b
Greater than a > 2 a>b
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 a≡b
Less than or equal to a <= b a≤b
Greater than or equal to a >= b a≥b
Proportional a prop b
Toward a toward b a→b
Arrow left a dlarrow b a⇐b
Double arrow left and right   a dlrarrow b a⇔b
Arrow right a drarrow b a⇒b


Set operations

Operation Command Display
Is in a in B
Is not in a notin B
Owns 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
Set of natural numbers setN
Set of integers setZ
Set of rational numbers setQ
Set of real numbers setR
Set of complex numbers setC


Functions

Operation Command Display
Exponential func e^{a} inline:Object114.png
Natural logarithm ln(a) inline:Object115.png
Exponential function exp(a) inline:Object116.png
Logarithm log(a) inline:Object117.png
Power a^{b} inline:Object118.png
Sine sin(a) inline:Object119.png
Cosine cos(a) inline:Object120.png
Tangent tan(a) inline:Object121.png
Cotangent cot(a) inline:Object122.png
Square root sqrt{a} inline:Object123.png
Arcsine arcsin(a) inline:Object124.png
Arc cosine arccos(a) inline:Object125.png
Arctangent arctan(a) inline:Object126.png
Arc cotangent arccot(a) inline:Object127.png
nth root nroot{a}{b} inline:Object128.png
Hyperbolic sine sinh(a) inline:Object129.png
Hyperbolic cosine cosh(a) inline:Object130.png
Hyperbolic tangent tanh(a) inline:Object131.png
Hyperbolic cotangent coth(a) inline:Object132.png
Absolute value abs{a} inline:Object133.png
Arc hyperbolic sine arsinh(a) inline:Object134.png
Arc hyperbolic cosine arccosh(a) inline:Object135.png
Arc hyperbolic tangent arctanh(a) inline:Object136.png
Arc hyperbolic cotangent arccoth(a) inline:Object137.png
Factorial fact{a} inline:Object138.png


Operators

All operators can be used with the limit functions (“from" and “to").
Operation Command Display
Limit lim{a} inline:Object139.png
Sum sum{a} inline:Object140.png
Product prod{a} inline:Object141.png
Coproduct coprod{a} inline:Object142.png
Upper and lower bounds shown with integral int from {r_0} to {r_t} a inline:Object143.png
Integral int{a} inline:Object144.png
Double integral iint{a} inline:Object145.png
Triple integral iiint{a} inline:Object146.png
Lower bound shown with summation symbol sum from{3}b inline:Object147.png
Contour integral lint a inline:Object148.png
Double curved integral llint a inline:Object149.png
Triple curved integral lllint a inline:Object150.png
Upper bound shown with product symbol prod to{3} r inline:Object151.png


Attributes

Operation Command Display
Acute accent acute a inline:Object111.png
Grave accent grave a inline:Object152.png
Reverse circumflex check a inline:Object153.png
Breve breve a inline:Object154.png
Circle circle a inline:Object155.png
Vector arrow vec a inline:Object156.png
Tilde tilde a inline:Object157.png
Circumflex hat a inline:Object158.png
Line above bar a inline:Object159.png
Dot dot a inline:Object160.png
Wide vector arrow widevec abc inline:Object161.png
Wide tilde widetilde abc inline:Object162.png
Wide circumflex widehat abc inline:Object163.png
Double dot ddot a inline:Object164.png
Line over overline abc inline:Object165.png
Line under underline abc inline:Object166.png
Line through overstrike abc inline:Object167.png
Triple dot dddot a inline:Object168.png
Transparent (useful to get a placeholder of a given size) phantom a inline:Object169.png
Bold font bold a inline:Object170.png
Italic fontFootNote(Unquoted text that is not a command is considered to be a variable. Variables are, by default, italicized.) ital “a" inline:Object171.png
Resize font size 16 qv inline:Object172.png
Following item in sans serif fontFootNote(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.) font sans qv inline:Object173.png
Following item in serif font font serif qv inline:Object174.png
Following item in fixed font font fixed qv inline:Object175.png
Make color of following text cyanFootNote(For all coloring, the color will apply only to the text immediately following the command until the next space is encountered. In order to have the color apply to more characters, place the text you want in color in curly brackets.) color cyan qv inline:Object176.png
Make color of following text yellow color yellow qv inline:Object177.png
Make color of following text white color white qv inline:Object178.png
Make color of following text green color green qv inline:Object179.png
Make color of following text blue color blue qv inline:Object180.png
Make color of following text red color red qv inline:Object181.png
Make color green returns to default color black color green X qv inline:Object182.png
Brace items to change color of more than one item color green {X qv} inline:Object207.png


Miscellaneous

Operation Command Display
Infinity infinity inline:Object48.png
Partial partial inline:Object49.png
Nabla nabla inline:Object50.png
There exists exists inline:Object54.png
For all forall inline:Object55.png
H bar hbar inline:Object56.png
Lambda bar lambdabar inline:Object60.png
Real part re inline:Object61.png
Imaginary part im inline:Object62.png
Weierstrass p wp inline:Object63.png
Left arrow leftarrow inline:Object64.png
Right arrow rightarrow inline:Object183.png
Up arrow uparrow inline:Object184.png
Down arrow downarrow inline:Object185.png
Dots at bottom dotslow inline:Object186.png
Dots at middle dotsaxis inline:Object187.png
Dots vertical dotsvert inline:Object188.png
Dots diagonal upward dotsup inline:Object189.png
Dots diagonal downward dotsdown inline:Object190.png



Brackets

Operation Command Display
Round Brackets (a) inline:Object191.png
Square Brackets [b] inline:Object192.png
Double Square Brackets ldbracket c rdbracket inline:Object193.png
Single line lline a rline inline:Object194.png
Double line ldline a rdline inline:Object195.png
Braces lbrace w rbrace inline:Object196.png
Angle Brackets langle d rangle inline:Object197.png
Operator Brackets langle a mline b rangle inline:Object198.png
Group brackets (used for program control) {a} inline:Object199.png
Scalable round brackets
(add the word “left before a left bracket and “right" before a right bracket)
left ( stack{a # b # z} right ) inline:Object200.png
Square brackets scalable
(as above)
left [ stack{ x # y} right ] inline:Object201.png
Double square brackets scalable left ldbracket c right rdbracket inline:Object202.png
Line scalable left lline a right rline inline:Object203.png
Double line scalable left ldline d right rdline inline:Object204.png
Brace scalable left lbrace e right rbrace inline:Object205.png
Angle bracket scalable left langle f right rangle inline:Object206.png
Operator brackets scalable left langle g mline h right rangle inline:Object208.png
Over brace scalable {The brace is above} overbrace a inline:Object209.png
Under brace scalable {the brace is below}underbrace {f} inline:Object210.png


Formats

Operation Command Display
Left superscript a lsup{b} inline:Object65.png
Center superscript a csup{b} inline:Object66.png
Right superscript a^{b} inline:Object67.png
Left subscript a lsub{b} inline:Object211.png
Center subscript a csub{b} inline:Object212.png
Right subscript a_{b} inline:Object213.png
Align character to left (text is aligned center by default) stack { Hello world # alignl (a) }
inline:Object220.png
Align character to center stack{Hello world # alignc(a)} inline:Object221.png
Align character to right stack { Hello world # alignr(a)} inline:Object222.png
Vertical stack of 2 binom{a}{b} inline:Object223.png
Vertical stack, more than 2 stack{a # b # z} inline:Object224.png
Matrix stack matrix{a # b ## c # d} inline:Object225.png
Common mathematical arrangement matrix{a # "="b ## {} # "="c} inline:Object226.png
New line asldkfjo newline sadkfj inline:Object227.png
Small gap (grave) stuff `stuff inline:Object228.png
Large gap (tilde) stuff~stuff inline:Object229.png


Characters – Greek

%ALPHA inline:Object68.png %BETA inline:Object214.png %CHI inline:Object215.png %DELTA inline:Object216.png %EPSILON inline:Object230.png
%ETA inline:Object231.png %GAMMA inline:Object232.png %IOTA inline:Object233.png %KAPPA inline:Object234.png %LAMBDA inline:Object235.png
%MU inline:Object236.png %NU inline:Object237.png %OMEGA inline:Object238.png %OMICRON inline:Object239.png %PHI inline:Object240.png
%PI inline:Object241.png %PSI inline:Object242.png %RHO inline:Object243.png %SIGMA inline:Object244.png %THETA inline:Object245.png
%UPSILON inline:Object246.png %XI inline:Object247.png %ZETA inline:Object248.png
%alpha inline:Object249.png %beta inline:Object250.png %chi inline:Object251.png %delta inline:Object252.png %epsilon inline:Object253.png
%eta inline:Object254.png %gamma inline:Object255.png %iota inline:Object256.png %kappa inline:Object257.png %lambda inline:Object258.png
%mu inline:Object259.png %nu inline:Object260.png %omega inline:Object261.png %omicron inline:Object262.png %phi inline:Object263.png
%pi inline:Object276.png %rho inline:Object284.png %sigma inline:Object285.png %tau inline:Object286.png %theta inline:Object287.png
%upsilon inline:Object288.png %varepsilon inline:Object289.png %varphi inline:Object290.png %varpi inline:Object291.png %varrho inline:Object299.png
%varsigma inline:Object300.png %vartheta inline:Object301.png %xi inline:Object302.png %zeta inline:Object303.png


Characters – Special

%and inline:Object344.png %angle inline:Object272.png %element inline:Object273.png %identical inline:Object274.png
%infinite inline:Object275.png %noelement inline:Object345.png %notequal inline:Object346.png %or inline:Object347.png
%perthousand inline:Object348.png %strictlygreaterthan inline:Object349.png %strictlylessthan inline:Object350.png %tendto inline:Object351.png


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).

Personal tools