Chapter 9
Getting Started with Math
LibreOffice’s Formula (Equation) Editor
This document is Copyright © 2017 by the LibreOffice Documentation Team. Contributors are listed below. You may distribute it and/or modify it under the terms of either the GNU General Public License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0/), version 4.0 or later.
All trademarks within this guide belong to their legitimate owners.
Jean Hollis Weber |
Hazel Russman |
Laurent Balland-Poirier |
John A Smith |
Martin Saffron |
Peter Schofield |
Olivier Hallot |
|
|
Please direct any comments or suggestions about this document to the Documentation Team’s mailing list: documentation@global.libreoffice.org
Note: Everything you send to a mailing list, including your email address and any other personal information that is written in the message, is publicly archived and cannot be deleted.
This chapter is based on the OpenOffice.org 3.3 Math Guide. The contributors to that book are:
Daniel Carrera |
Agnes Belzunce |
TJ Frazier |
Peter Kupfer |
Ian Laurenson |
Janet M. Swisher |
Jean Hollis Weber |
Michele Zarri |
|
Additional material has been added from the German Math Handbuch for LibreOffice 3.4 (translated to English by Hazel Russman). Contributors to that book are:
Regina Henschel |
Christian Kühl |
Florian Reisinger |
Gisbert Friege (Dmaths) |
Jochen Schiffers |
|
Additional material has been added from the French How-To Math for LibreOffice (translated to English by Laurent Balland-Poirier). Contributors to that book are Bernard Siaud and Frédéric Parrenin.
Published 16 February 2017. Based on LibreOffice 5.2.
Some keystrokes and menu items are different on a Mac from those used in Windows and Linux. The table below gives some common substitutions for the instructions in this chapter. For a more detailed list, see the application Help.
Windows or Linux |
Mac equivalent |
Effect |
Tools > Options menu selection |
LibreOffice > Preferences |
Access setup options |
Right-click |
Control+click or right-click depending on computer setup |
Opens a context menu |
Ctrl (Control) |
⌘ (Command) |
Used with other keys |
F5 |
Shift+⌘+F5 |
Open the Navigator |
F11 |
⌘+T |
Open the Styles and Formatting window |
Contents
LibreOfficeMath is a formula editor you can use to create or edit formulas (equations) in a symbolic form within LibreOffice documents or as standalone objects. Example formulas are shown below. However, if you want to evaluate numeric values using formulas, then refer to the Calc Guide for more information; Math does not carry out any actual calculation.
Using the Formula Editor, you can create a formula as a separate document or file for a formula library, or insert formulas directly into a document using LibreOffice Writer, Calc, Impress, or Draw.
To create a formula as a separate document or file, use one of the following methods to open an empty formula document in LibreOffice Math (Figure 1):
•On the menu bar, go to File > New > Formula.
•From the Start Center, click Math Formula.
•On the Standard toolbar, click the triangle to the right of the New icon and select Formula from the context menu.
•In Math, use the keyboard shortcut Ctrl+N.
•Use command Import MathML from the clipboard.
As you enter the markup language in the Formula Editor, the formula will appear in the Preview window during and after input of the markup. The Elements window to the left of the Preview window may also appear, if it has been selected in View on the menu bar. For more information on creating formulas, see “Creating formulas” on page 7.
LibreOffice’s native file format for formulas is ODF Formula, with extension *.odf. You can also embed formula objects in other documents like presentations, spreadsheets, or text documents. LibreOffice can also read and save formulas in MathML 1.01 format, with extension .mml.
LibreOffice Math can import MathML Presentations directly from the clipboard. To import a MathML Presentation formula, copy the formula from the external equation editor and issue Tools > Import MathML from Clipboard. For example, the MathML code on the left of Table 1 displays the equation on the right.
Table 1: MathML 1.01 language imported from the clipboard
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <semantics> <mrow> <mi>E</mi> <mo stretchy="false">=</mo> <msup> <mi mathvariant="italic">mc</mi> <mn>2</mn> </msup> </mrow> </semantics> </math> |
|
To insert a formula into a LibreOffice document, open the document in Writer, Calc, Draw, or Impress. The LibreOffice module in use affects how you position the cursor to insert the formula.
•In Writer, click in the paragraph where you want to insert the formula.
•In Calc, click in the spreadsheet cell where you want to insert the formula.
•In Draw and Impress, the formula is inserted into the center of the drawing or slide.
Then, go to Insert > Object > Formula on the menu bar to open the Formula Editor. Alternatively, go to Insert > Object > OLE Object on the menu bar to open the Insert OLE Object dialog, select Create new option and Formula from the sub-menu, then click OK to open the Formula Editor. The Elements window to the left of the Preview window may also appear, if it has been selected in View on the menu bar. For more information on creating formulas, see “Creating formulas” on page 7.
Figure 2 shows an example Writer document with the formula box selected ready for a formula to be entered.
When you have completed entering the markup for the formula, close the Formula Editor by pressing the Esc key or by clicking an area outside the formula in the document. Double-clicking on the formula object in the document will open the Formula Editor again so that you can edit the formula.
Formulas are inserted as OLE objects into documents. As with any OLE object, you can change how the object is placed within the document. For more information on OLE objects, see the user guides for Math, Writer, Calc, Draw, and Impress.
If you frequently insert formulas into documents, you might like to add the Formula button to the Standard toolbar or create a keyboard shortcut. See Chapter 14, Customizing LibreOffice, for more information.
You can insert elements into a formula using one of the following methods:
•Select a category from the drop-down list, then a symbol using the Elements window.
•Right-click in the Formula Editor and select a category, then a symbol from the context menu.
•Enter markup language directly in the Formula Editor.
Note
Using the Elements window or the context menus to insert a formula provides a convenient way to learn the markup language used by LibreOffice Math.
The Elements window can easily be used when entering formula data. In addition to the list of categories at the top of the window, it also provides an Example category with example formulas to use as a starting point for a formula or equation.
1) Go to View on the menu bar and select Elements to open the Elements window.
2) Select the category you want to use in the formula from the drop-down list at the top of the Elements window.
3) Select the symbol you want to use in the formula from the Elements window. The symbols that are available change according to the selected category.
Note
The Elements window is positioned by default to the left of the Preview and Formula Editor windows, as shown in Figure 1 and Figure 2. It can be floated in the same way as other docked windows.
The Formula Editor also provides a context menu to access categories and symbols when creating a formula. Right-click in the Formula Editor to open the context menu. Select a category and then select the markup example that you want to use from the sub-context menu. An example is shown in Figure 3.
Note
The Elements window and the context menu contain only the most common commands that are used in formulas. For some seldom-used commands, you must always enter the command using the markup language. For a complete list of commands, see the Math Guide.
Table 2: Example commands using markup language
Display |
Command |
Display |
Command |
|
a = b |
|
sqrt {a} |
|
a^2 |
|
a_n |
|
int f(x) dx |
|
sum a_n |
|
a <= b |
|
infinity |
|
a times b |
|
x cdot y |
Greek characters are commonly used in formulas, but Greek characters cannot be entered into a formula using the Elements window or the context menu. Use the English names of Greek characters in markup language when entering Greek characters into a formula. See Appendix A, Commands Reference, in the Math Guide for a list of Greek characters that can be entered using markup language.
•For a lowercase Greek character, type a percentage % sign, then type the character name in lowercase using the English name. For example, typing %lambda creates the Greek character λ.
•For an UPPERCASE Greek character, type a percentage % sign, then type the character name in UPPERCASE using the English name. For example, typing %LAMBDA creates the Greek character Λ.
•For an italic Greek character, type a percentage % sign followed by the i character, then the English name of the Greek character in lower or UPPER case. For example, typing %iTHETA creates the italic Greek character Θ.
Greek characters can also be entered into a formula using the Symbols dialog.
1) Make sure the cursor is in the correct position in the Formula Editor.
2) Go to Tools > Symbols on the menu bar or click on the Symbols icon on the Tools toolbar to open the Symbols dialog (Figure 4).
3) Select Greek from the Symbol set drop-down list. For italic characters, select iGreek from the drop-down list.
4) Select the Greek character from the symbol list, then click Insert. When selected, the name of a Greek character is shown below the symbol list.
5) Click Close when you have finished entering Greek characters into the formula.
1) Make sure the cursor is flashing in the Formula Editor, then select the category Unary/Binary Operators and symbol Multiplication using one of the following methods:
–Right-click in the Formula Editor and select Unary/Binary Operators > a times b from the context menu.
2) Select the first placeholder <?> before the word times in the Formula Editor and replace it with the character 5. The formula in the document updates automatically.
3) Select the second placeholder <?> after the word times in the Formula Editor and replace it with the character 4. The formula in the document updates automatically.
Tip
To move forward from one placeholder to the next placeholder in a formula, press the F4 key. To move backward from one placeholder to the previous placeholder in a formula, use the key combination Shift+F4.
Note
If necessary, you can prevent a formula in a document from updating automatically. Go to View on the menu bar and deselect AutoUpdate display. To then manually update a formula, press F9 key or select View > Update on the menu bar.
1) Make sure the cursor is flashing in the Formula Editor.
2) Enter %pi in the Formula Editor to enter the Greek character for pi (π).
3) Select the category Relations and symbol Is Similar Or Equal using one of the following methods:
–Right-click in the Formula Editor and select Relations > a simeq b from the context menu.
4) Delete the first placeholder <?> before the word simeq in the Formula Editor.
How you edit a formula and switch into formula editing mode depends on whether the formula is in Math or another LibreOffice component.
1) In Math, double-click on a formula element in the formula that appears in the Preview window to select the formula element in the Formula Editor, or directly select a formula element in the Formula Editor.
2) In Writer, Calc, Impress, or Draw, double-click on the formula, or right-click on the formula and select Edit from the context menu, to open the Formula Editor in editing mode. The cursor is positioned at the start of the formula in the Formula Editor.
Note
3) Select the formula element you want to change, using one of the following methods:
–Click on the formula element in the preview window, position the cursor at the beginning of the formula element in the Formula Editor, then select the formula element in the Formula Editor.
–Double-click on the formula element in the preview window to select the formula element in the Formula Editor.
–Position the cursor in the Formula Editor at the formula element you want to edit, then select that formula element.
–Double-click directly on the formula element in the Formula Editor to select it.
4) Make your changes to the selected formula element.
6) In
Math, save your changes to the formula after editing.
In Writer, Calc, Impress, or Draw, click anywhere in your document
away from the formula to leave editing mode, then save the document
to save your changes to the formula.
This section provides some advice on how to layout complex formulas in Math or in a LibreOffice document.
LibreOffice Math knows nothing about order of operation within a formula. You must use braces (also known as curly brackets) to state the order of operations that occur within a formula. The following examples show how brackets can be used in a formula.
Example 1
Math has recognized that the 2 before and the x after the over as belonging to the fraction, and has represented them accordingly. If you want x+1 rather than x to be the denominator, you must bracket them together using braces so that both will be placed there.
Example 2
Math has recognized the minus sign as a prefix for the 1 and has therefore placed it in the numerator of the fraction. If you wish to show that the whole fraction is negative, with the minus sign in front of the fraction, you must put the fraction in braces to signify to Math that the characters belong together.
Example 3
When braces are used in markup language, they are used to define the layout of the formula and are not displayed or printed. If you want to use braces within your formula, you use the commands lbrace and rbrace within the markup language.
Scalable brackets can be used with any element of a formula, such as a fraction or square root.
Tip
Use the commands left[ and right] to obtain scalable square brackets. A list of all brackets available within Math can be found in Appendix A, Commands Reference, in the Math Guide.
Tip
If you want all brackets to be scalable, go to Format > Spacing to open the Spacing dialog. Click on Category, select Brackets from the drop-down list and then select the option Scale all brackets.
When using brackets in a formula, Math expects that for every opening bracket there will be a closing one. If you forget to add a closing bracket, Math places an inverted question mark next to where the closing bracket should have been placed. This inverted question mark disappears when all the brackets are paired. However, an unpaired bracket is sometimes necessary and you have the following options.
A backslash \ is placed before a non-scalable bracket to indicate that the following character should not be regarded as a bracket, but as a literal character.
To create unpaired scalable brackets or braces in a formula, the markup commands left, right, and none are used.
Example
To remove the inverted question marks and create the correct formula, you have to use the markup commands left, right, and none.
To create the correct formula, change the entry in the Formula Editor to
abs x = left lbrace stack {x "for" x >= 0 # -x "for" x < 0} right none.
In the basic installation of Math, Math outputs functions in normal characters and variables in italic characters. However, if Math fails to recognize a function, you can tell Math that you have just entered a function. Enter the markup command func before a function forces Math to recognize the following text as a function and uses normal characters.
For a full list of functions within Math, see the Math Guide.
Some Math functions have to be followed by a number or a variable. If these are missing, Math places an inverted question mark where the missing number or variable should be. To remove the inverted question mark and correct the formula, you have to enter a number, a variable, or a pair of empty brackets as a placeholder.
Tip
You can navigate through errors in a formula using the key F3 or the key combination Shift+F3.
Example
It is not possible in Math to create multiple-line formulas when a line ends with an equals sign and you want to continue the calculation on a new line without completing the term on the right side of the equals sign. If you require a multiple line formula to have an equals sign at the end of a line without a term after the equals sign, then use either empty quotes "" or empty braces {} or the space characters grave ` or tilde ˜.
By default, a multiple line formula is centrally aligned. For more information on alignment using the equals sign, see the Math Guide.
Spacing between the elements in a formula is not set by using space characters in the markup language. If you want to add spaces into the formula, use one of the following options:
•Grave ` to add a small space.
•Tilde ~ for a large space.
•Add space characters between quotes " ". These spaces will be considered as text.
Any spaces at the end of a line in the markup language are ignored by default. For more information, see the Math Guide.
The sum and integral commands can take the parameters from and to if you want to set the lower and upper limits respectively. The parameters from and to can be used singly or together as shown by the following examples. For more information on the sum and integral commands, see the Math Guide.
Examples
When writing derivatives, you have to tell Math that it is a fraction by using the over command. The over command is combined with the character d for a total derivative or the partial command for a partial derivative to achieve the effect of a derivative. Braces {} are used each side of the element to surround the element and make the derivative as shown by the following examples.
Examples
Note
To write function names with primes, as is normal in school notation, you must first add the symbols to the catalog. See the Math Guide for more information.
Characters that are used as controls in markup language cannot be entered directly as normal characters. These characters are: %, {, }, &, |, _, ^ and ". For example, you cannot write 2% = 0.02 in markup language and expect the same characters to appear in the formula. To overcome this limitation, use one of the following methods:
•Add the character to the Math Catalog, for example the double quote character.
Note
The Special Characters dialog used by other LibreOffice modules is not available in Math. If you regularly require special characters in Math, the characters should be added to the catalog of Math symbols. See the Math Guide for more information.
The font used for text in a formula will be the default font that has been set in the Fonts dialog. For more information on how to change fonts used for in formulas, see “Changing formula appearance” on page 17.
By default, text alignment is left-justified in formulas. To change text alignment, see “Adjusting formula alignment” on page 20.
Formatting commands are not interpreted within text used in formulas. If you want to use formatting commands within formula text, then you must break up the text using double quotes in the Formula Editor.
Example
Enter the following in the Formula Editor:
"In " color blue bold "isosceles" "triangles, the base angles are equal"
LibreOffice Math does not have a command for aligning formulas on a particular character. However, you can use a matrix to align formulas on a character and this character is normally the equals sign (=).
Example
Creating the matrix:
matrix{ alignr x+y # {}={} # alignl 2 ## alignr x # {}={} # alignl 2-y }
Note
The empty braces each side of the equals sign are necessary because the equals sign is a binary operator and requires an expression on each side. You can use spaces, or ` or ~ characters each side of the equals sign, but braces are recommended as they are easier to see within the markup language.
You can reduce the spacing on each side of the equals sign if you change the inter-column spacing of the matrix. See “Adjusting formula spacing” on page 19 for information on how to adjust adjust formula spacing.
To change the font size used for a formula already inserted in Math or another LibreOffice module:
1) Click in the markup language in the Formula Editor.
2) Go to Format > Font size on the menu bar to open the Font Sizes dialog (Figure 6).
3) Select a different font size using the Base size spinner or type a new font size in the Base Size box.
4) Click OK to save your changes and close the dialog. An example result when you change font size is shown below.
Example
To change the default font size used for all formulas in Math or another LibreOffice module:
1) Before inserting any formulas into a document, go to Format > Font size on the menu bar to open the Font Sizes dialog (Figure 6).
2) Select a different font size using the Base size spinner or type a new font size in the Base Size box.
3) Click Default and confirm your changes to the base size font. Any formulas created from this point on will use the new base size font for formulas.
4) Click OK to save your changes and close the Font Sizes dialog.
Note
If you have already inserted formulas into a document and you change the default font size, only formulas inserted after the change in default font size will use the new default settings. You have to individually change the font size of formulas already inserted if you want these formulas to use the same font size as the default settings. For more information on changing the font size, see the Math Guide.
To change the fonts used for the current formula in Math or another LibreOffice module:
1) Click in the markup language in the Formula Editor.
2) Go to Format > Fonts on the menu bar to open the Fonts dialog (Figure 7).
3) Select a new font for each the various options from the drop-down lists.
4) If the font you want to use does not appear in the drop-down list, click Modify and select the option from the context menu to open a fonts dialog. Select the font you want to use and click OK to add it to the drop-down list for that option.
5) Click OK to save your changes and close the Fonts dialog.
To change the default fonts used for all formulas in Math or another LibreOffice module:
1) Before inserting any formulas into a document, go to Format > Fonts on the menu bar to open the Fonts dialog (Figure 7).
2) Select a new font where required for each of the various options from the drop-down lists.
3) If the font you want to use does not appear in the drop-down list, click Modify and select the option from the context menu to open a fonts dialog. Select the font you want to use and click OK to add it to the drop-down list for that option.
4) Click Default and confirm your changes to the fonts. Any formulas created from this point on will use the new fonts for formulas.
5) Click OK to save your changes and close the Fonts dialog.
Note
If you have already inserted formulas into a document and you change the default fonts, only formulas inserted after the change in default fonts will use the new default settings. You have to individually change the font of formulas already inserted if you want these formulas to use the same font as the default settings. For more information on changing the font, see the Math Guide.
Use the Spacing dialog (Figure 8) to determine the spacing between formula elements. The spacing is specified as a percentage in relation to the defined base size for fonts.
To change the spacing used for the current formula in Math or another LibreOffice module:
1) Click in the markup language in the Formula Editor.
2) Go to Format > Spacing on the menu bar to open the Spacing dialog (Figure 8).
3) Click Category and select one of the options from the drop-down list. The options in the Spacing dialog change according to the category selected.
4) Enter new values for the spacing category and click OK.
5) Check the result in your formula. If it is not to your satisfaction, repeat the above steps.
To change the default spacing used for all formulas in Math or another LibreOffice module:
1) Before inserting any formulas into a document, go to Format > Spacing on the menu bar to open the Spacing dialog (Figure 8).
2) Click Category and select one of the options from the drop-down list. The options in the Spacing dialog change according to the category selected.
3) Click Default and confirm your changes to the formula spacing. Any formulas created from this point on will use the new spacing for formulas.
4) Click OK to save your changes and close the Spacing dialog.
Note
If you have already inserted formulas into a document and you change the spacing, only formulas inserted after the change in spacing will use the new default settings. You have to individually change the spacing of formulas already inserted if you want these formulas to use the same spacing as the default settings. For more information on changing the formula spacing, see the Math Guide.
The alignment settings determine how formula elements located above one another are aligned horizontally relative to each other.
Note
It is not possible to align formulas on a particular character and formula alignment (using the method described below) does not apply to text elements, which are always aligned left.
Independent of using formula alignment given below, it is possible to align formulas using the commands alignl, alignc and alignr. These commands also work for text elements.
To change the alignment used for the current formula in Math or another LibreOffice module:
1) Click in the markup language in the Formula Editor.
2) Go to Format > Alignment on the menu bar to open the Alignment dialog (Figure 9).
3) Select either Left, Centered, or Right for horizontal alignment.
4) Click OK and check the result in your formula. If it is not to your satisfaction, repeat the above steps.
To change the default alignment used for all formulas in Math or another LibreOffice module:
1) Before inserting any formulas into a document, go to Format > Alignment on the menu bar to open the Alignment dialog (Figure 9).
2) Select either Left, Centered, or Right for horizontal alignment.
3) Click Default and confirm your changes to the formula alignment. Any formulas created from this point on will use the new alignment for formulas.
4) Click OK and check the result in your formula. If it is not to your satisfaction, repeat the above steps.
Note
If you have already inserted formulas into your document and you change the formula alignment, only formulas inserted after the change in alignment will use the new default settings. You have to individually change the alignment of formulas already inserted if you want these formulas to use the same alignment as the default settings.
For information on the colors available in Math, see the Math Guide.
Tip
For ease of use, the Elements window includes the category Attributes, which lists standard colors. Click on the required color to insert the command into your formula.
It is not possible to select a background color for formulas in LibreOffice Math. The background color for a formula is by default the same color as the document or frame that the formula has been inserted into. However, in LibreOffice documents, you can use object properties to change the background color for a formula. For more information on using a background color (area fill for objects) with a formula, please refer to the user guides for Writer, Calc, Draw, and Impress.
If you regularly insert the same formulas into your documents, you can create a formula library using formulas that you have created using the Formula Editor. Individual formulas can be saved as separate files using the ODF format for formulas with the file suffix of .odf, or in MathML format with the file suffix of .mml.
You can use LibreOffice Math, Writer, Calc, Draw, or Impress to create formulas and build up your formula library.
1) Create a folder on your computer to contain your formulas. Give the folder a memorable name, for example Formula Library.
2) In LibreOffice, go to File > New > Formula on the menu bar, or click on Math Formula in the opening splash screen to open LibreOffice Math and create your formula using the Formula Editor. See “Formulas as separate documents or files” on page 5 for more information.
3) Go to File > Save As on the menu bar or use the keyboard shortcut Ctrl+Shift+S to open a Save As dialog.
4) Navigate to the folder you have created for your formula library.
5) Type a memorable name for your formula in the File name text box.
6) Select from the drop-down list for File type either ODF Formula (.odf) or MathML 1.01 (.mml) as the file type for your formula.
7) Click Save to save the formula and close the Save As dialog.
1) Create a folder on your computer to contain your formulas. Give the folder a memorable name, for example Formula Library.
2) Open a document using Writer, Calc, Draw, or Impress.
3) Go to Insert > Object > Formula on the menu bar to open the Formula Editor and create your formula. See “Formulas in LibreOffice documents” on page 6 for more information.
4) Right-click on the formula object and select Save Copy as from the context menu to open a Save As dialog.
5) Navigate to the folder you have created for your formula library.
6) Type a memorable name for your formula in the File name text box.
7) Select from the drop-down list for File type either ODF Formula (.odf) or MathML 1.01 (.mml) as the file type for your formula.
8) Click Save to save the formula and close the Save As dialog.
You cannot insert a formula from your library into a document by dragging and dropping using the mouse, nor by using Insert > File on the menu bar. You must insert a formula from your library into your document as an OLE object.
1) Open the document in Writer, Calc, Draw, or Impress.
2) Go to Insert > Object > OLE Object on the menu bar to open the Insert OLE Object dialog.
3) Select the option Create from file.
4) Click Search to open a file browser dialog.
5) Navigate to the folder you have created for your formula library.
6) Select the formula you want to insert and click Open, or double-click on the formula you want to insert.
7) Click OK to insert the formula as an OLE object in the document and close the OLE Object dialog.
When a formula is inserted into a document, LibreOffice Writer inserts the formula into a frame and treats the formula as an OLE object. Double-clicking on an inserted formula will open the Formula Editor in LibreOffice Math, where you can edit the formula.
This section explains what options you can change for each individual formula within a Writer document. Please refer to the chapters on styles in the Writer Guide for information on how to change the default settings for frame styles for OLE objects.
Automatic numbering of formulas for cross-reference purposes can only be carried out in LibreOffice Writer.
1) Start a new line in your document.
2) Type fn (mnemonic for formula numbered) and then press the F3 key. A two-column table with no borders is inserted into the document with the left column containing a sample formula and the right column containing a reference number, as shown below.
|
3) Delete the sample formula and insert your formula as an object in the left column. See “Creating formulas” on page 7 for more information on inserting formulas.
Alternatively, you can first insert your formula into the document, then carry out Steps 1 and 2 above, replacing the sample formula with your formula.
Note
If you want to use square parentheses instead of round ones around the formula number, or if you want the formula number to be separated from the formula by tabs instead of using a table, then you need to modify the AutoText entry for fn. Refer to the section on AutoText in Chapter 4, Getting Started with Writer.
1) Click in the document where you want the cross-reference to appear.
2) Go to Insert > Cross-reference on the menu bar to open the Fields dialog (Figure 10).
3) Click on the Cross-references tab, then select Text in the Type section.
4) In the Selection section, select the formula number you want to refer to.
5) In the Insert reference to section, select Reference and click Insert.
6) When you have finished creating cross-references, click Close to close the Fields dialog.
Tip
To insert the cross-reference number without parentheses, select Numbering instead of Reference in the Insert reference to section.
A formula is treated as an object within Writer and its default anchoring is As character within a paragraph when it is inserted into a document. To change the anchoring of a formula object:
1) Right-click on the selected formula object and select Anchor from the context menu.
2) Select a new anchoring option from the context sub-menu. The anchoring positions available are To page, To paragraph, To character, or As character.
Alternatively,
1) Right-click on the selected formula object and select Object from the context menu, or go to Format > Frame/Object on the menu bar to open the Object dialog (Figure 11).
2) Make sure the Type page is selected and select a new anchoring position from the Anchor section.
3) Click OK to save your changes and close the Object dialog.
Note
The anchoring options are not available in the Object dialog when you are making changes to the various options available for frame styles. For more information on how to modify frame styles, please refer to the chapters on styles in the Writer Guide.
The normal default setting for vertical alignment for formula objects is to use the text base line as a reference. This default setting can be changed by modifying the formula frame style. See the chapters on styles in the Writer Guide for more information.
To change the vertical alignment position of an individual formula object:
1) Right-click on the selected formula object and select Object from the context menu, or go to Format > Frame/Object to open the Object dialog (Figure 11).
2) Make sure the Type page is selected and select a new alignment position from the drop-down list in the Position section. The vertical alignment options available are Top, Bottom, Center or From bottom.
3) If necessary, type in the text box a plus or minus value for vertical alignment. This option is only available if From bottom vertical alignment has been selected.
4) Select the type of text alignment from the drop-down list in the Position section. The text alignment options available are Base line, Character and Row.
5) Click OK to save your changes and close the Object dialog.
Note
If the Position section in the Object dialog is grayed out and not available, then go to Tools > Options > LibreOffice Writer > Formatting Aids and uncheck the option Math baseline alignment. This setting is stored with the document and applies to all formulas within it. Any new documents created will also use this setting for Math baseline alignment.
A formula object, when inserted into a Writer document, has spacing on each side. The default value used for spacing is set within the frame style for formula objects and can be changed by modifying the formula frame style, see the chapters on styles in the Writer Guide for more information.
You can individually adjust the spacing for each formula object within a document as follows:
1) Create the formula in your Writer document.
2) Right-click on the selected formula object and select Object from the context menu, or go to Format > Frame/Object on the menu bar to open the Object dialog.
3) Click on the Wrap tab to open the Wrap page in the Object dialog (Figure 12).
4) In the Spacing section, enter the spacing value for Left, Right, Top and Bottom spacing.
5) Click OK to save your changes and close the Object dialog.
In large formulas placed within a line of text, the formula elements can often be higher than the text height. Therefore, to make large formulas easier to read, it is recommended to always insert them into a separate paragraph of their own.
However, if it is necessary to place a large formula within a line of text, double-click on the formula to open the Formula Editor and then go to Format > Text Mode on the menu bar. The Formula Editor will try to shrink the formula to fit the text height. The numerators and denominators of fractions are shrunk, and the limits of integrals and sums are placed beside the integral/sum sign, as shown in the following example.
Example
A formula in a separate paragraph:
The default setting for background (area fill) and borders for formula objects is set by the formula frame style. To change this default setting for formula frame style, refer to the chapters on styles in the Writer Guide. However, for individual formulas in a document, you can change the background and borders.
Note
The size of the frame that a formula is placed in when inserted into a document cannot be changed. The frame size for a formula object depends on the setting of the formula font size; see the Math Guide for more information.
1) In the document, select the formula where you wish to change the background.
2) Right-click on the formula and select Object from the context menu, or go to Format > Frame/Object on the menu bar to open the object dialog.
3) Click on the Area tab and select the type of fill you want to use for the formula from the Fill drop-down list (Figure 13).
4) Select the options you want to use for the formula background. The options change depending on the type of fill selected.
5) Click OK to save your changes and close the Object dialog.
1) In the document, select the formula where you want to change the borders.
2) Right-click on the formula and select Object from the context menu, or go to Format > Frame/Object on the menu bar to open the object dialog.
3) Click on the Borders tab and select the options you want to use for the formula borders (Figure 14).
4) Click OK to save your changes and close the Object dialog.
To quickly insert a formula into a Writer document without opening the Formula Editor, where you know the markup language for the formula:
1) Enter the formula markup language into the document at the position where you want the formula.
2) Select the markup language.
Note
If the Formula icon is not displayed on the Standard toolbar, then right-click in an empty area on the toolbar, select Visible Buttons from the context menu, then select Formula from the available options.
In Calc, Draw, and Impress, formulas are inserted as OLE objects without any background (area fill) or borders. See the Math Guide for more information.
Each formula object is inserted into a spreadsheet, drawing, or slide as follows:
•In Calc, formulas are inserted into a selected cell in a spreadsheet with no style assigned to the formula object.
•In Draw and Impress, formulas are inserted into a central position on a drawing or slide and, by default, are assigned the drawing object style Object with no fill and no line. For more information on how to modify or assign drawing object styles, see the Draw Guide or the Impress Guide.
A formula object can be anchored into a spreadsheet as To Page (default setting), or as To Cell. To change the anchoring type of formulas in a Calc spreadsheet:
1) Select the formula object in the spreadsheet.
2) Right-click on the formula and select Anchor > To Page or To Cell from the context menu
3) Alternatively, go to Format > Anchor on the menu bar and select To Page or To Cell.
When a formula is inserted into a drawing or slide, it is inserted as a floating OLE object and is not anchored to any particular position in a drawing or slide.
Formula objects in Calc, Draw, and Impress can be modified just like any other object that has been placed in a spreadsheet, drawing, or presentation, with the exception of formula object size and changing the format of any text within a formula. For more information on how to change object properties, see the Calc Guide, Draw Guide, and Impress Guide. For more information on formula object size and formatting formula text, see the Math Guide.
The following points will help you select which dialog to use if you want to change the properties of formula objects.
•For formula backgrounds, use the various options in the pages of the Area dialog.
•For formula borders, use the various options in the Line dialog. Note that formula borders are separate from cell borders in a Calc spreadsheet.
•To accurately re-position a formula object, use the various options in pages of the Position and Size dialog.
•In Draw and Impress, you can arrange, align, group, flip, convert, break, combine, and edit points of formula objects.
•You cannot change the text attributes of a formula object. The text used in a formula is set when you create the formula in the Formula Editor.
•Formula object size is set by the formula font size when the formula is created in the Formula Editor. The formula object size is protected in the Position and Size dialog, but this can be deselected if you so wish. However, this is not recommended, as resizing a formula object using the Position and Size dialog could lead to distortion of a formula making it difficult to read.
A chart in a Calc spreadsheet is itself an OLE object; therefore you cannot use the Formula Editor to create and insert a formula into a chart.
To insert a formula into a chart, create the formula first using the Formula Editor and copy the formula to the clipboard. You then create the chart in Calc and paste the formula into the chart. The formula is automatically converted into the correct format for insertion into a chart.
If you want to change the formula at a later date, then you must repeat the whole process of creating, copying, and pasting.
Impressum (Legal Info) | Privacy Policy | Statutes (non-binding English translation) - Satzung (binding German version) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License v2.0. “LibreOffice” and “The Document Foundation” are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy. LibreOffice was based on OpenOffice.org.