LibreOffice math reference
This page contains a copy of the commands for the LibreOffice/OpenOffice formula editor, aka math editor. It's helpful to have all this stuff on one page, but LibreOffice's wiki is not editable, and the maintainers are not responsive. Hence a copy here...
Unary / binary operators
| Operation | Command | Display |
|---|---|---|
| Positive (plus) | +1 | +1 |
| Negative (minus) | -1 | −1 |
| Plus/minus | +-1 | <math>\pm 1</math> |
| Minus/plus | -+1 | <math>\mp 1</math> |
| Boolean 'not' | neg a | ¬a |
| Addition | a + b | a+b |
| Dot product | a cdot b | a·b |
| Cross product | a times b | a×b |
| Multiplication (asterisk) | a * b | a * b |
| Boolean 'and' | a and b | a∧b |
| Subtraction | a - b | a−b |
| Division (as a fraction) | a over b | <math>\frac{a}{b}</math> |
| Division (as an operator) | a div b | a÷b |
| Division (with a slash) | a / b | a/b |
| Boolean 'or' | a or b | <math>a \or b</math> |
| Concatenation | a circ b | <math> a \circ b </math> |
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 | <math>a \mid b</math> |
| Does not divide | a ndivides b | <math>a \! \nmid \! b</math> |
| Less than | a < 2 | a<2 |
| Greater than | a > 2 | a>2 |
| Similar to or equal | a simeq b | <math>a\! \simeq\! b</math> |
| Parallel | a parallel b | <math>a \!\parallel\! b</math> |
| Orthogonal to | a ortho b | <math>a \!\perp\! b</math> |
| Less than or equal to | a leslant b | <math>a \!\leqslant\! b</math> |
| Greater than or equal to | a geslant b | <math>a \!\geqslant\! b</math> |
| Similar to | a sim b | <math>a\!\sim\! b\,\!</math> |
| 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 | <math>a\! \propto\! b</math> |
| 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 | a∈B |
| Is not in | a notin B | a∉B |
| Owns | A owns b | <math>A\!\ni\! b</math> |
| Empty set | emptyset | <math>\emptyset</math> |
| Intersection | A intersection B | A∩B |
| Union | A union B | A∪B |
| Difference | A setminus B | <math>A\!\setminus\! B</math> |
| Quotient | A slash B | <math>A\!/\! B</math> |
| Aleph | aleph | ℵ |
| Subset | A subset B | A⊂B |
| Subset or equal to | A subseteq B | A⊆B |
| Superset | A supset B | A⊃B |
| Superset or equal to | A supseteq B | A⊇B |
| Not subset | A nsubset B | A⊂ / B |
| Not subset or equal | A nsubseteq B | A⊆ / B |
| Not superset | A nsupset B | A⊃ / B |
| Not superset or equal | A nsupseteq B | A⊇ / B |
| Set of natural numbers | setN | <math>\mathbb{N}</math> |
| Set of integers | setZ | <math>\mathbb{Z}</math> |
| Set of rational numbers | setQ | <math>\mathbb{Q}</math> |
| Set of real numbers | setR | <math>\mathbb{R}</math> |
| Set of complex numbers | setC | <math>\mathbb{C}</math> |
Functions
| Operation | Command | Display |
|---|---|---|
| Exponential | func e^{a} | <math>\operatorname{e}^a</math> |
| Natural logarithm | ln(a) | <math>\ln(a)</math> |
| Exponential function | exp(a) | <math>\exp(a)</math> |
| Logarithm | log(a) | <math>\log(a)</math> |
| Power | a^{b} | <math>a^b\,\!</math> |
| Sine | sin(a) | <math>\sin(a)</math> |
| Cosine | cos(a) | <math>\cos(a)</math> |
| Tangent | tan(a) | <math>\tan(a)</math> |
| Cotangent | cot(a) | <math>\cot(a)</math> |
| Square root | sqrt{a} | <math>\sqrt{a}</math> |
| Arcsine | arcsin(a) | <math>\arcsin(a)</math> |
| Arccosine | arccos(a) | <math>\arccos(a)</math> |
| Arctangent | arctan(a) | <math>\arctan(a)</math> |
| Arc cotangent | arccot(a) | <math>\arccot(a)</math> |
| nth root | nroot{a}{b} | <math>\sqrt[a]{b}</math> |
| Hyperbolic sine | sinh(a) | <math>\sinh(a)</math> |
| Hyperbolic cosine | cosh(a) | <math>\cosh(a)</math> |
| Hyperbolic tangent | tanh(a) | <math>\tanh(a)</math> |
| Hyperbolic cotangent | coth(a) | <math>\coth(a)</math> |
| Absolute value | abs{a} | \,a\,|</math> |
| Arc hyperbolic sine | arsinh(a) | <math>\operatorname{arsinh}(a)</math> |
| Arc hyperbolic cosine | arcosh(a) | <math>\operatorname{arcosh}(a)</math> |
| Arc hyperbolic tangent | artanh(a) | <math>\operatorname{artanh}(a)</math> |
| Arc hyperbolic cotangent | arcoth(a) | <math>\operatorname{arcoth}(a)</math> |
| Factorial | fact{a} | <math>a!\!\,</math> |
Operators
All operators can be used with the limit functions (“from" and “to").
| Operation | Command | Display |
|---|---|---|
| Limit | lim{a} | <math>\lim{a}</math> |
| Sum | sum{a} | <math>\sum{a}</math> |
| Product | prod{a} | <math>\prod{a}</math> |
| Coproduct | coprod{a} | <math>\coprod{a}</math> |
| Upper and lower bounds shown with integral | int from {r_0} to {r_t} a | <math>\int\limits_{r_0}^{r_t}{a}</math> |
| Integral | int{a} | <math>\int{a}</math> |
| Double integral | iint{a} | <math>\iint{a}</math> |
| Triple integral | iiint{a} | <math>\iiint{a}</math> |
| Lower bound shown with summation symbol | sum from{3}b | <math>\sum_3{b}\,\!</math> |
| Contour integral | lint a | <math>\oint{a}</math> |
| Double curved integral | llint a | File:Math l2inta.png |
| Triple curved integral | lllint a | File:Math l3inta.png |
| Product with range | prod from {i=1} to {n} {(i+1)} | <math>\prod_{i=1}^{n}{(i+1)}</math> |
Attributes
| Operation | Command | Display |
|---|---|---|
| Acute accent | acute a | á |
| Grave accent | grave a | à |
| Reverse circumflex | check a | <math>\check{a}</math> |
| Breve | breve a | <math>\breve{a}</math> |
| Circle | circle a | å |
| Vector arrow | vec a | <math>\vec{a}</math> |
| Tilde | tilde a | ã |
| Circumflex | hat a | â |
| Line above | bar a | <math>\bar{a}</math> |
| Dot | dot a | <math>\dot{a}</math> |
| Wide vector arrow | widevec abc | <math>\overrightarrow{a b c}</math> |
| Wide tilde | widetilde abc | File:Math Widetilde.png |
| Wide circumflex | widehat abc | <math>\widehat{abc}</math> |
| Double dot | ddot a | <math>\ddot{a}</math> |
| Line over | overline abc | <math>\overline{abc}</math> |
| Line under | underline abc | <math>\underline{abc}</math> |
| Line through | overstrike abc | |
| Triple dot | dddot a | File:Math 3dota.png |
| Transparent (useful to get a placeholder of a given size) | phantom a | |
| Bold font | bold a | <math>\bold{a}</math> |
| Italic font (see Note 1) | ital a | <math>\mathit{a}</math> |
| Roman (non-italic) font | nitalic a OR "a" | <math>\mathrm{a}</math> |
| Resize font | size 16 qv | qv |
| Following item in sans serif font (see Note 2) | font sans qv | qv |
| Following item in serif font | font serif qv | <math>\mathrm{q}\mathrm{v}</math> |
| Following item in fixed font | font fixed qv | qv |
| Make color of following text cyan (see Note 3) | color cyan qv | <math>\color{Cyan}qv</math> |
| Make color of following text yellow | color yellow qv | <math>\color{Yellow}qv</math> |
| Make color of following text white | color white qv | <math>\color{White}qv</math> |
| Make color of following text green | color green qv | <math>\color{Green}qv</math> |
| Make color of following text blue | color blue qv | <math>\color{Blue}qv</math> |
| Make color of following text red | color red qv | <math>\color{Red}qv</math> |
| Make color green returns to default color black | color green X qv | <math>{\color{Green}{X}} \ qv</math> |
| Brace items to change color of more than one item | color green {X qv} | <math>\color{Green}{X\ qv}</math> |
Note 1: Unquoted text that is not a command is considered to be a variable. Variables are, by default, italicized.
Note 2: There are three custom fonts: serif (with serifs), sans (sans serif, meaning without serifs), and fixed (monospaced). To change the actual fonts used for custom fonts and the fonts used for variables (unquoted text), numbers and functions, use Format > Fonts.
Note 3: 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.
Miscellaneous
| Operation | Command | Display |
|---|---|---|
| Infinity | infinity | <math>\infin</math> |
| Partial | partial | <math>\partial</math> |
| Nabla | nabla | <math>\nabla</math> |
| There exists | exists | <math>\exists</math> |
| For all | forall | <math>\forall</math> |
| H bar | hbar | <math>\hbar</math> |
| Lambda bar | lambdabar | File:Math lambdabar.png |
| Real part | re | <math>\Re</math> |
| Imaginary part | im | <math>\Im</math> |
| Weierstrass p | wp | <math>\wp</math> |
| Left arrow | leftarrow | <math>\leftarrow</math> |
| Right arrow | rightarrow | <math>\rightarrow</math> |
| Up arrow | uparrow | <math>\uparrow</math> |
| Down arrow | downarrow | <math>\downarrow</math> |
| Dots at bottom | dotslow | <math>\ldots</math> |
| Dots at middle | dotsaxis | <math>\cdots</math> |
| Dots vertical | dotsvert | <math>\vdots</math> |
| Dots diagonal upward | dotsup | File:Math dotsup.png |
| Dots diagonal downward | dotsdown | <math>\ddots</math> |
Brackets
| Operation | Command | Display |
|---|---|---|
| Round Brackets | (a) | <math>(a)</math> |
| Square Brackets | [b] | <math>[b]</math> |
| Double Square Brackets | ldbracket c rdbracket | <math>[\![ c ]\!]</math> |
| Single line | lline a rline OR abs a | <math>\vert a \vert</math> |
| Double line | ldline a rdline | <math>\Vert a \Vert</math> |
| Braces | lbrace w rbrace | <math>\{w\}</math> |
| Braces | left lbrace stack{0, n <> 0 # 1, n = 1} right none | File:Lbrace.png |
| Angle Brackets | langle d rangle | <math>\langle d \rangle</math> |
| Operator Brackets | langle a mline b rangle | b \rangle</math> |
| Group brackets (used for program control) | {a} | <math>a</math> |
| Scalable round brackets (add the word "left" before a left bracket and "right" before a right bracket) | left ( stack{a # b # z} right ) | <math>\begin{pmatrix} a \\ b \\ z \end{pmatrix}</math> |
| Square brackets scalable (as above) |
left [ stack{ x # y} right ] | <math>\begin{bmatrix} x \\ y \end{bmatrix}</math> |
| Double square brackets scalable | left ldbracket c right rdbracket | <math>[ \! [ c ] \! ]</math> |
| Line scalable | left lline a right rline | <math>\vert a \vert</math> |
| Double line scalable | left ldline d right rdline | <math>\Vert a \Vert</math> |
| Brace scalable | left lbrace e right rbrace | <math>\{ a \}</math> |
| Angle bracket scalable | left langle f right rangle | <math>\langle f \rangle</math> |
| Operator brackets scalable | left langle g mline h right rangle | h \rangle</math> |
| Over brace scalable | {The brace is above} overbrace a | <math>\overbrace{}^{a}</math> |
| Under brace scalable | {the brace is below}underbrace {f} | <math>\underbrace{}_{f}</math> |
| Floor Brackets | lfloor a rfloor | <math>\lfloor a \rfloor</math> |
| Ceil Brackets | lceil a rceil | <math>\lceil a \rceil</math> |
Formats
| Operation | Command | Display | |
|---|---|---|---|
| Left superscript | a lsup{b} | <math>{}^b\!a</math> | |
| Center superscript | a csup{b} | <math>\overset{b}{a}</math> | |
| Right superscript | a^{b} | <math>a^b\,\!</math> | |
| Left subscript | a lsub{b} | <math>{}_b a \,\!</math> | |
| Center subscript | a csub{b} | <math>\underset{b}{a}</math> | |
| Right subscript | a_{b} | <math>a_b\,\!</math> | |
| Align character to left (text is aligned center by default) | stack { Hello world # alignl (a) } |
| |
| Align character to center | stack{Hello world # alignc(a)} |
| |
| Align character to right | stack { Hello world # alignr(a)} |
| |
| Vertical stack of 2 | binom{a}{b} | <math>\begin{matrix} a \\ b \end{matrix}</math> | |
| Vertical stack, more than 2 | stack{a # b # z} | <math>\begin{matrix}a \\ b \\ z \end{matrix}</math> | |
| Matrix | matrix{ a # b ## c # d } |
<math>\begin{matrix}a & b \\ c & d \end{matrix}</math> | |
| Equations aligned at '=' (using 'matrix') | matrix{ a # "=" # alignl{b} ## {} # "=" # alignl{c+1} } |
<math>\begin{align}a & = b \\ {} & = c+1 \end{align}</math> | |
| Equations aligned at '=' (using 'phantom') | stack{ alignl{a} = b # alignl{phantom{a} = c+1} } |
<math>\begin{align}a & = b \\ {} & = c+1 \end{align}</math> | |
| New line | asldkfjo newline sadkfj | asldkfjo sadkfj | |
| Small gap (grave) | stuff `stuff | <math>{stu\!f\!\!f} ~ {stu\!f\!\!f}</math> | |
| Large gap (tilde) | stuff~stuff | <math>{stu\!f\!\!f} \quad {stu\!f\!\!f}</math> |
Characters – Greek
Warning: according to the OpenOffice documentation, these names for the greek letters are localised depending on your user interface language. So you can consult the symbol 'catalog' in the formula editor, in order to see what the names are on your system. Also note that around 2010, LibreOffice changed the greek letters to their non-italic, and we now need to use '%irho', '%itheta' etc to access the italicised Greek letters on most systems. This can be modified by changing the symbol catalog, but that's tedious.
Warning: the default symbol font on Ubuntu 12.04 and 14.04 is bad. You should modified the symbol font to Liberation Serif, if you want greek letters to appear properly.
| Code | Display | Code | Display | Code | Display | Code | Display | Code | Display |
|---|---|---|---|---|---|---|---|---|---|
| %ALPHA | Α | %BETA | Β | %GAMMA | Γ | %DELTA | Δ | %EPSILON | Ε |
| %ZETA | Ζ | %ETA | Η | %THETA | Θ | %IOTA | Ι | %KAPPA | Κ |
| %LAMBDA | Λ | %MU | Μ | %NU | Ν | %XI | Ξ | %OMICRON | Ο |
| %PI | Π | %RHO | Ρ | %SIGMA | Σ | %TAU | Τ | %UPSILON | Υ |
| %PHI | Φ | %CHI | Χ | %PSI | Ψ | %OMEGA | Ω | ||
| %alpha | α | %beta | β | %gamma | γ | %delta | δ | %epsilon | ε |
| %varepsilon | <math>\varepsilon</math> | %zeta | ζ | %eta | η | %theta | θ | %vartheta | <math>\vartheta</math> |
| %iota | ι | %kappa | κ | %lambda | λ | %mu | μ | %nu | ν |
| %xi | ξ | %omicron | ο | %pi | π | %varpi | <math>\varpi</math> | %rho | ρ |
| %varrho | <math>\varrho</math> | %sigma | σ | %varsigma | <math>\varsigma</math> | %tau | τ | %upsilon | υ |
| %phi | φ | %varphi | <math>\varphi</math> | %chi | χ | %psi | ψ | %omega | ω |
Characters – Special
| %and <math>\and</math> | %angle <math>\angle</math> | %element <math>\in</math> | %identical <math>\equiv\,\!</math> |
| %infinite <math>\infin\,\!</math> | %noelement <math>\notin</math> | %notequal <math>\ne\,\!</math> | %or <math>\or</math> |
| %perthousand ‰ | %strictlygreaterthan <math>\gg</math> | %strictlylessthan <math>\ll</math> | %tendto <math>\to\,\!</math> |
Other tricks
Some of the following require custom symbols to be defined in the Symbol Catalog
| Operation | Command | Display |
|---|---|---|
| double quote | "\"" | " |
| prime (define character u+2032 in font MathJax_Main as prime) | x_1^%prime | <math>x'_1</math> |
| prime (hacky way) | x^{ font fixed size*1.2{,}}_1 | <math>x'_1</math> (approximately) |
| double prime (define character u+2033 in font STIX Variants as dprime) | x^%dprime | <math>x</math> |
| long arrow (define character u+27F6 as longrightarrow) | x %longrightarrow y | <math>x \longrightarrow y</math> |
| equilibrium (define character u+21CC as equi) | A + B equi AB | A + B ⇌ AB |