Formula layout
This chapter has been replaced by the Math Guide.
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 order of operations explicitly. Consider the following example:
| Markup | Result |
|---|---|
| 2 over x + 1 | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle {2 \over x} + 1} |
| 2 over {x + 1} | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 2 \over {x + 1}} |
Equations over more than one line
Suppose you want to type an equation covering more than one line. For example:
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = 3\,\!}
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle y = 1\,\!}
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 |
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = 3 \ y = 1} |
| x = 3 newline y = 1 |
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x = 3\,\!}
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle y = 1\,\!} |
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 |
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \sum_{k=1}^n a_k} |
| int from 0 to x f(t) dt or int_0^x f(t) dt |
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \int\limits_0^x f(t) dt} or Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \int_0^x f(t) dt} |
| int from Re f | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \int\limits_\Re f} |
| sum to infinity 2^{-n} | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \sum_{ }^{\infin} 2^{-n}} |
| For more details on integrals and sums, see Math commands- Reference in the Writer Guide. |
Brackets with matrices look ugly!
For background, we start with an overview of the matrix command:
| Markup | Result |
|---|---|
| matrix { a # b ## c # d } | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{matrix} a&b \\ c&d \end{matrix}} |
The first problem people have with matrices is that brackets do not scale with the matrix:
| Markup | Result |
|---|---|
| ( matrix { a # b ## c # d } ) | (Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{matrix} a&b \\ c&d \end{matrix}} ) |
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) | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \left( \begin{matrix} a&b \\ c&d \end{matrix} \right)} |
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} | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \frac{df}{dx}} |
| {partial f} over {partial y} | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \frac{\partial f}{\partial y}} |
| {partial^2 f} over {partial t^2} | Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \frac{\partial^2 f}{\partial t^2}} |
How do I align my equations at the equals sign?
OOo Math does not have a command for aligning equations on a particular character, but you can use a matrix to do this, as shown below.
| Markup | Result |
|---|---|
| matrix{ alignr x+y # {}={} # alignl 2 ## alignr x # {}={} # alignl 2-y } |
The empty braces around = are necessary because = is a binary operator and thus needs an expression on each side.
You can reduce the spacing around = if you change the inter-column spacing of the matrix:
- With the equation editor open, choose Format > Spacing from the menu bar.
- In the Spacing dialog, click the Category button and select Matrices in the drop-down menu.
- Enter 0% for Column spacing and click OK.
See Also
| Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY). |