TeX Syntax for Mathematic Expressions
Originally from WikiBooks.
One of the greatest motivating forces for Donald Knuth when he began developing the original TeX system was to create something that allowed simple construction of mathematical formulas, whilst looking professional when printed. The fact that he succeeded was most probably why TeX (and later on, LaTeX) became so popular within the scientific community. Regardless of the history, typesetting mathematics is one of LaTeX's greatest strengths. It is also a large topic due to the existence of so much mathematical notation.
If you are writing a document that needs only a few simple mathematical formulas, then you can generally use plain LaTeX: it will give you most of the tools you need. However, if you are writing a scientific document that contains numerous complicated formulas, it is highly recommended that you use theamsmath
package, which introduces several new commands that are more powerful and flexible than the ones provided by plain LaTeX. To use this, include:
\usepackage{amsmath}
/code
|
Table of Contents
- 1 Mathematics environments
- 2 Symbols
- 3 Operators
- 4 Powers and indices
- 5 Fractions and Binomials
- 6 Roots
- 7 Sums and integrals
- 8 Brackets, braces and delimiters
- 9 Matrices and arrays
- 10 Adding text to equations
- 11 Formatting mathematics symbols
- 12 Plus and minus signs
- 13 Controlling horizontal spacing
- 14 Advanced Mathematics: AMS Math package
- 15 List of Mathematical Symbols
- 16 Notes
- 17 Further reading
- 18 External links
Mathematics environments
LaTeX needs to know beforehand that the subsequent text does in fact contain mathematical elements. This is because LaTeX typesets maths notation differently than normal text. Therefore, special environments have been declared for this purpose. They can be distinguished into two categories depending on how they are presented: * text - text formulas are displayed in-line, that is, within the body of text where it is declared. e.g., I can say that a + a = 2a within this sentence. * displayed - displayed formulas are separate from the main text. As maths require special environments, there are naturally the appropriate environment names you can use in the standard way. Unlike most other environments, however, there are some handy shorthands to declaring your formulas. The following table summarizes them:Type | Environment | LaTeX shorthand | TeX shorthand |
---|---|---|---|
Text | \begin{math}...\end{math} | \(...\) | $...$ |
Displayed | \begin{displaymath}...\end{displaymath} or \begin{equation*}...\end{equation*} <ref name="amsmath"/> | \[...\] | $$...$$ |
$$...$$
should be avoided, as it may cause problems, particularly with the AMS-LaTeX macros. Furthermore, should a problem occur, the error messages may not be helpful. Additionally, there is a second possible environment for the displayed type of formulas:
equation
. The difference between this and
displaymath
is that
equation
also adds sequential equation numbers by the side.
If you are typing text normally, you are said to be in text mode, while you are typing within one of those mathematical environments, you are said to be in math mode, that has some differences compared to the text mode:
- Most spaces and line breaks do not have any significance, as all spaces are either derived logically from the mathematical expressions, or have to be specified with special commands such as
\quad
- Empty lines are not allowed. Only one paragraph per formula.
- Each letter is considered to be the name of a variable and will be typeset as such. If you want to typeset normal text within a formula (normal upright font and normal spacing) then you have to enter the text using dedicated commands.
Symbols
Mathematics has lots and lots of symbols! If there is one aspect of maths that is difficult in LaTeX it is trying to remember how to produce them. There are of course a set of symbols that can be accessed directly from the keyboard:
+ - = ! / ( ) [ ] <code lang=latex>
\[
\forall x \in X, \quad \exists y \leq \epsilon
\] /code |style="padding-left:20px"|<math> \forall x \in X, \quad \exists y \leq \epsilon
\,</math>
|}
Greek letters
Greek letters are commonly used in mathematics, and they are very easy to type in math mode. You just have to type the name of the letter after a backslash: if the first letter is lowercase, you will get a lowercase Greek letter, if the first letter is uppercase (and only the first letter), then you will get an uppercase letter. Note that some uppercase Greek letters look like Latin ones, so they are not provided by LaTeX (e.g. uppercase Alpha and Beta are just "A" and "B" respectively). Theta and Phi are provided in two different versions:
<code lang="latex">
\[ \alpha, \beta, \gamma, \mu, \theta, \vartheta, \phi, \varphi, \omega, \Gamma, \Theta, \Phi, \Omega \] /code | <math>\alpha, \beta, \gamma, \mu, \theta,
\vartheta, \phi, \varphi, \omega, \Gamma, \Theta, \Phi, \Omega</math> |
Operators
An operator is a function that is written as a word: e.g. trigonometric functions (sin, cos, tan), logarithms and exponentials (log, exp). LaTeX has many of these defined as commands:
<code lang=latex>
\[ \cos (2\theta) = \cos^2 \theta - \sin^2 \theta \] /code | <math>\cos (2\theta) = \cos^2 \theta - \sin^2 \theta \,</math> |
For certain operators such as limits, the subscript is placed underneath the operator:
<code lang=latex>
\[ \lim_{x \to \infty} \exp(-x) = 0 \] /code | <math>\lim_{x \to \infty} \exp(-x) = 0</math> |
\bmod
and
\pmod
:
<code lang=latex>
\[ a \bmod b \] /code | <math>
a \, \bmod \, b \,</math> |
<code lang=latex>
\[ x \equiv a \pmod b \] /code | <math>
x \equiv a \pmod b \,</math> |
To use operators which are not pre-defined, such as argmax, see custom operators
Powers and indices
Powers and indices are equivalent to superscripts and subscripts in normal text mode. The caret (^
) character is used to raise something, and the underscore (
_
) is for lowering. If more than one expression is raised or lowered, they should be grouped using curly braces (
{
and
}
).
<code lang=latex>
\[ k_{n+1} = n^2 + k_n^2 - k_{n-1} \] /code | <math>
k_{n+1} = n^2 + k_n^2 - k_{n-1} \,</math> |
Fractions and Binomials
A fraction is created using the\frac{''numerator''}{''denominator''}
command. (For those who need their memories refreshed, that's the top and bottom respectively!). Likewise, the binomial coefficient (aka the Choose function) may be written using the
\binom
command
<code lang=latex>
\[ \frac{n!}{k!(n-k)!} = \binom{n}{k} \] /code | <math>
\frac{n!}{k!(n-k)!} = \binom{n}{k} \,</math> |
You can also embed fractions within fractions:
<code lang=latex>
\[ \frac{\frac{1}{x}+\frac{1}{y}}{y-z} \] /code | <math>
\frac{\frac{1}{x}+\frac{1}{y}}{y-z} \,</math> |
\tfrac
and
\dfrac
commands<ref name="amsmath"/> force the use of the respective styles (similarly the
\tbinom
and
\dbinom
commands do the same for the binomial coefficient).
For relatively simple fractions, it may be more aesthetically pleasing to use powers and indices:
<code lang=latex>
\[ ^3/_7 \] /code | <math>
^3/_7 \,</math> |
Roots
Thesqrt
command creates a square root surrounding an expression. It accepts an optional argument specified in square brackets (
[
and
]
) to change magnitude:
<code lang=latex>
\[ \sqrt{\frac{a}{b}} \] /code | <math>
\sqrt{\frac{a}{b}} \,</math> |
<code lang=latex>
\[ \sqrt[n]{1+x+x^2+x^3+\ldots} \] /code | <math>
\sqrt[n]{1+x+x^2+x^3+\ldots} \,</math> |
Some people prefer writing the square root "closing" it over its content. This method arguably makes it more clear just what is in the scope of the root sign. This habit is not normally used while writing with the computer because the text is supposed to be clear anyway, but if you want to change the output of the square root anyway, LaTeX gives you this possibility. Just add the following code in the preamble of your document:
<code lang="latex">
% New definition of square root: % it renames \sqrt as \oldsqrt \let\oldsqrt\sqrt % it defines the new \sqrt in terms of the old one \def\sqrt{\mathpalette\DHLhksqrt} \def\DHLhksqrt#1#2{% \setbox0=\hbox{$#1\oldsqrt{#2\,}$}\dimen0=\ht0 \advance\dimen0-0.2\ht0 \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}% {\box0\lower0.4pt\box2}} /code | thumb |
This TeX code first renames the \sqrt command as \oldsqrt, then redefines \sqrt in terms of the old one, adding something more. The new square root can be seen in the picture on the right, compared to the old one. Unfortunately this code won't work if you want to use multiple roots: if you try to write <math>\sqrt[b]{a}</math> as \sqrt[b]{a} after you used the code above, you'll just get a wrong output. In other words, you can redefine the square root this way only if you are not going to use multiple roots in the whole document.
Sums and integrals
The\sum
and
\int
commands insert the sum and integral symbols respectively, with limits specified using the caret (
^
) and underscore (
_
):
<code lang=latex>
\[ \sum_{i=1}^{10} t_i \] /code | <math>
\sum_{i=1}^{10} t_i \,</math> |
<code lang=latex>
\[ \int_0^\infty e^{-x} \, dx \] /code | <math>
\int_0^\infty e^{-x} \, dx \,</math> |
There are many other "big" commands which operate in a similar manner:
\sum | <math>\sum \,</math> | \prod | <math>\prod</math> | \coprod | <math>\coprod</math> | ||
\bigoplus | <math>\bigoplus</math> | \bigotimes | <math>\bigotimes</math> | \bigodot | <math>\bigodot</math> | ||
\bigcup | <math>\bigcup</math> | \bigcap | <math>\bigcap</math> | \biguplus | <math>\biguplus</math> | ||
\bigsqcup | <math>\bigsqcup</math> | \bigvee | <math>\bigvee</math> | \bigwedge | <math>\bigwedge</math> | ||
\int | <math>\int</math> | \oint | <math>\oint</math> | \iint <ref name="amsmath"/> | <math>\iint</math> | ||
\iiint <ref name="amsmath"/> | <math>\iiint</math> | \iiiint <ref name="amsmath"/> | <math>\iiiint</math> | \idotsint <ref name="amsmath"/> | <math>\int \! \cdots \! \int</math> |
\substack
command<ref name="amsmath"/> allows the use of
\\
to write the limits over multiple lines:
<code lang=latex>
\[ \sum_{\substack{ 0<math> \sum_{\overset{\scriptstyle 0</math> |
\limits
command:
<code lang=latex>
\[ \int\limits_a^b \] /code | <math>
\int\limits_a^b \,</math> |
intlimits
option when loading the
amsmath
package:
<code lang="latex">
\usepackage[intlimits]{amsmath} /code |
Brackets, braces and delimiters
The use of delimiters such as brackets soon becomes important when dealing with anything but the most trivial equations. Without them, formulas can become ambiguous. Also, special types of mathematical structures, such as matrices, typically rely on delimiters to enclose them.
There are a variety of delimiters available for use in LaTeX:
<code lang=latex>
\[ () \, [] \, \{\} \, || \, \|\| \, \langle\rangle \, \lfloor\rfloor \, \lceil\rceil \] /code | <math>
() \, [] \, \{\} \, || \, \|\| \, \langle\rangle \, \lfloor\rfloor \, \lceil\rceil \,</math> |
Automatic sizing
Very often mathematical features will differ in size, in which case the delimiters surrounding the expression should vary accordingly. This can be done automatically using theleft
and
right
commands. Any of the previous delimiters may be used in combination with these:
<code lang=latex>
\[ \left(\frac{x^2}{y^3}\right) \] /code | <math>
\left(\frac{x^2}{y^3}\right) \,</math> |
.
).
Manual sizing
In certain cases, the sizing produced by theleft
and
right
commands may not be desirable, or you may simply want finer control over the delimiter sizes. In this case, the
big
,
Big
,
bigg
and
Bigg
modifier commands may be used:
<code lang=latex>
\[ ( \big( \Big( \bigg( \Bigg( \] /code | <math>
( \big( \Big( \bigg( \Bigg( \,</math> |
Matrices and arrays
A basic matrix may be created using thematrix
environment<ref name="amsmath">requires the
amsmath
package</ref>: in common with other table-like structures, entries are specified by row, with columns separated using an ampersand (
&
) and a new rows separated with a double backslash (
\\
)
<code lang=latex>
\[ \begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix} \] /code | <math>
\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix} </math> |
\left
and
\right
commands, there are various other predefined environments which automatically include delimiters:
Environment name | Surrounding delimiter |
---|---|
pmatrix <ref name="amsmath"/> | <math>( \, ) </math> |
bmatrix <ref name="amsmath"/> | <math>[ \, ] </math> |
Bmatrix <ref name="amsmath"/> | <math>\{ \, \} </math> |
vmatrix <ref name="amsmath"/> | \, | </math> |
Vmatrix <ref name="amsmath"/> | \, \| </math> |
\cdots
,
\vdots
and
\ddots
respectively:
<code lang=latex>
\[ A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} \] /code | <math>
A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} </math> |
array
environment, which is essentially a math-mode version of the
tabular
environment, which requires that the columns be pre-specified:
<code lang=latex>
\[ \begin{array}{c|c} 1 & 2 \\ \hline 3 & 4 \end{array} \] /code | <math>
\begin{array}{c|c} 1 & 2 \\ \hline 3 & 4 \end{array} </math> |
Adding text to equations
The math environment differs from the text environment in the representation of text. Here is an example of trying to represent text within the math environment:
<code lang="latex">
\[ 50 apples \times 100 apples = lots of apples^2 \] /code | <math>
50 apples \times 100 apples = lots of apples^2 \,</math> |
There are two noticeable problems: there are no spaces between words or numbers, and the letters are italicized and more spaced out than normal. Both issues are simply artifacts of the maths mode, in that it treats it as a mathematical expression: spaces are ignored (LaTeX spaces mathematics according to its own rules), and each character is a separate element (so are not positioned as closely as normal text).
There are a number of ways that text can be added properly. The typical way is to wrap the text with the\text{...}
command <ref name="amsmath"/> (a similar command is
\mbox{...}
, though this causes problems with subscripts, and has a less descriptive name). Let's see what happens when the above equation code is adapted:
<code lang="latex">
\[ 50 \text{apples} \times 100 \text{apples} = \text{lots of apples}^2 \] /code | <math>
50 \text{apples} \times 100 \text{apples} = \text{lots of apples}^2 \,</math> |
\text
(s) itself (just before the text.)
<code lang="latex">
\[ 50 \text{ apples} \times 100 \text{ apples} = \text{lots of apples}^2 \] /code | <math>
50 \text{ apples} \times 100 \text{ apples} = \text{lots of apples}^2 \,</math> |
Formatted text
Using the\text
is fine and gets the basic result. Yet, there is an alternative that offers a little more flexibility. You may recall the introduction of font formatting commands, such as
\textrm
,
\textit
,
\textbf
, etc. These commands format the argument accordingly, e.g.,
\textbf{bold text}
gives bold text. These commands are equally valid within a maths environment to include text. The added benefit here is that you can have better control over the font formatting, rather than the standard text achieved with
\text
.
<code lang="latex">
\[ 50 \textrm{ apples} \times 100 \textbf{ apples} = \textit{lots of apples}^2 \] /code | <math>
50 \;\textrm{ apples} \times 100 \;\textbf{ apples} = \textit{lots of apples}^2 \,</math> |
Formatting mathematics symbols
So we can format text, what about formatting mathematics? There are a set of formatting commands very similar to the font formatting ones just used, except they are aimed specifically for text in maths mode:
LaTeX command | Sample | Description | Common use |
---|---|---|---|
\mathnormal{…} | <math>ABCDEF abcdef 123456\,</math> | the default math font | most mathematical notation |
\mathrm{…} | <math>\mathrm{ABCDEF abcdef 123456}\,</math> | this is the default or normal font, unitalicised | units of measurement, one word functions |
\mathit{…} | <math>\mathit{ABCDEF abcdef 123456}\,</math> | italicised font | |
\mathbf{…} | <math>\mathbf{ABCDEF abcdef 123456}\,</math> | bold font | vectors |
\mathsf{…} | <math>\mathsf{ABCDEF abcdef 123456}\,</math> | Sans-serif | |
\mathtt{…} | ABCDEFabcdef123456 | Monospace (fixed-width) font | |
\mathcal{…} | <math>\mathcal{ABCDEF abcdef 123456}\,</math> | Calligraphy (uppercase only) | often used for sheaves/schemes and categories |
\mathfrak{…} <ref name="amsfonts">requires amsfonts or amssymb packages</ref> | <math>\mathfrak{ABCDEF abcdef 123456}\,</math> | Fraktur | Almost canonical font for Lie algebras |
\mathbb{…} <ref name="amsfonts"/> | <math>\mathbb{ABCDEF abcdef 123456}\,</math> | Blackboard bold | Used to denote special sets (e.g. real numbers) |
\mathscr{…} <ref>require mathrsfs package</ref> | Script |
The maths formatting commands can be wrapped around the entire equation, and not just on the textual elements: they only format letters, numbers, and uppercase Greek, and the rest of the maths syntax is ignored.
To bold lowercase Greek or other symbols use the\boldsymbol
command<ref name="amsmath"/>; this will only work if there exists a bold version of the symbol in the current font. As a last resort there is the
\pmb
command<ref name="amsmath"/> (poor mans bold): this prints multiple versions of the character slightly offset against each other
<code lang="latex">
\[ \boldsymbol{\beta} = (\beta_1,\beta_2,\ldots,\beta_n) \] /code | <math>
\boldsymbol{\beta} = (\beta_1,\beta_2,\ldots,\beta_n) \,</math> |
To change the size of the fonts in math mode, see Changing font size.
Accents
So what to do when you run out of symbols and fonts? Well the next step is to use accents:
a' | <math>a'\,</math> | <nowiki>a''</nowiki> | <math>a\,</math> | <nowiki>a'''</nowiki> | <math>a\,</math> | <nowiki>a''''</nowiki> | <math>a'\,</math> | |||
\hat{a} | <math>\hat{a} \,</math> | \bar{a} | <math>\bar{a} \,</math> | \check{a} | <math>\check{a} \,</math> | \tilde{a} | <math>\tilde{a} \,</math> | |||
\grave{a} | <math>\grave{a} \,</math> | \acute{a} | <math>\acute{a} \,</math> | \breve{a} | <math>\breve{a} \,</math> | \vec{a} | <math>\vec{a} \,</math> | |||
\dot{a} | <math>\dot{a} \,</math> | \ddot{a} | <math>\ddot{a} \,</math> | \dddot{a} <ref name="amsmath"/> | \ddddot{a} <ref name="amsmath"/> | |||||
\not{a} | <math>\not{a} \,</math> | \mathring{a} | \widehat{AAA} | <math>\widehat{AAA} \,</math> | \widetilde{AAA} |
Plus and minus signs
Latex deals with the + and − signs in two possible ways. The most common is as a binary operator. When two maths elements appear either side of the sign, it is assumed to be a binary operator, and as such, allocates some space either side of the sign. The alternative way is a sign designation. This is when you state whether a mathematical quantity is either positive or negative. This is common for the latter, as in maths, such elements are assumed to be positive unless a - is prefixed to it. In this instance, you want the sign to appear close to the appropriate element to show their association. If you put a + or a - with nothing before it but you want it to be handled like a binary operator you can add an invisible character before the operator using{}
. This can be useful if you are writing multiple-line formulas, and a new line could start with a = or a +, for example, then you can fix some strange alignments adding the invisible character where necessary.
Controlling horizontal spacing
Latex is obviously pretty good at typesetting maths—it was one of the chief aims of the core Tex system that Latex extends. However, it can't always be relied upon to accurately interpret formulas in the way you did. It has to make certain assumptions when there are ambiguous expressions. The result tends to be slightly incorrect horizontal spacing. In these events, the output is still satisfactory, yet, any perfectionists will no doubt wish to fine-tune their formulas to ensure spacing is correct. These are generally very subtle adjustments.
There are other occasions where Latex has done its job correctly, but you just want to add some space, maybe to add a comment of some kind. For example, in the following equation, it is preferable to ensure there is a decent amount of space between the maths and the text.
<code lang="latex">
\[ f(n) = \left\{ \begin{array}{l l} n/2 & \quad \text{if $n$ is even}\\ -(n+1)/2 & \quad \text{if $n$ is odd}\\ \end{array} \right. \] /code |
<math> f(n) = \begin{cases} n/2 & \quad \text{if } n \text{ is even} \\ -(n+1)/2 & \quad \text{if } n \text{ is odd}\\ \end{cases} </math> |
\quad
and
\qquad
A
\quad
is a space equal to the current font size. So, if you are using an 11pt font, then the space provided by
\quad
will also be 11pt (horizontally, of course.) The
\qquad
gives twice that amount. As you can see from the code from the above example,
\quad
s were used to add some separation between the maths and the text.
OK, so back to the fine tuning as mentioned at the beginning of the document. A good example would be displaying the simple equation for the indefinite integral of y with respect to x:
<math>\int y\, \mathrm{d}x</math>
If you were to try this, you may write:
<code lang="latex">
\[ \int y \mathrm{d}x \] /code |
<math>\int y \mathrm{d}x</math> |
\quad
would clearly be overkill is this situation—what is needed are some small spaces to be utilized in this type of instance, and that's what Latex provides:
Command | Description | Size |
---|---|---|
\, | small space | 3/18 of a quad |
\: | medium space | 4/18 of a quad |
\; | large space | 5/18 of a quad |
\! | negative space | -3/18 of a quad |
NB you can use more than one command in a sequence to achieve a greater space if necessary.
So, to rectify the current problem:
\int y\, \mathrm{d}x |
<math>\int y\, \mathrm{d}x</math> |
\int y\: \mathrm{d}x |
<math>\int y\;\;\!\! \mathrm{d}x</math> |
\int y\; \mathrm{d}x |
<math>\int y\; \mathrm{d}x</math> |
The negative space may seem like an odd thing to use, however, it wouldn't be there if it didn't have some use! Take the following example:
<code lang="latex">
\[\left( \begin{array}{c} n \\ r \end{array} \right) = \frac{n!}{r!(n-r)!} \] /code |
<math>\left( \begin{matrix} n \\ r \end{matrix} \right) = \frac{n!}{r!(n-r)!}</math> |
The matrix-like expression for representing binomial coefficients is too padded. There is too much space between the brackets and the actual contents within. This can easily be corrected by adding a few negative spaces after the left bracket and before the right bracket.
<code lang="latex">
\[\left(\! \begin{array}{c} n \\ r \end{array} \!\right) = \frac{n!}{r!(n-r)!} \] /code |
<math>\left(\! \begin{matrix} n \\ r \end{matrix} \!\right) = \frac{n!}{r!(n-r)!}</math> |
\int x \; \mathrm{d} x
, you can define a command like this:
<code lang="latex"> \newcommand{\dd}{\; \mathrm{d}} /code
in the preamble of your document. We have chosen\dd
just because it reminds the "d" it replaces and it is fast to type. Doing so, the code for your integral becomes
\int x \dd x
. Now, whenever you write an integral, you just have to use the
\dd
instead of the "d", and all your integrals will have the same style. If you change your mind, you just have to change the definition in the preamble, and all your integrals will be changed accordingly.
Advanced Mathematics: AMS Math package
The AMS (American Mathematical Society) mathematics package is a powerful package that creates an higher layer of abstraction over mathematical LaTeX language; if you use it it will make your life easier. Some commands amsmath introduces will make other plain LaTeX commands obsolete: in order to keep consistency in the final output you'd better useamsmath
commands whenever possible. If you do so, you will get an elegant output without worrying about alignment and other details, keeping your source code readable. If you want to use it, you have to add this in the preamble:
<code lang="latex"> \usepackage{amsmath} /code
Introducing text and dots in formulas
Amsmath defines also the\dots
command, that is a generalization of the existing
\ldots
. You can use
\dots
in both text and math mode and LaTeX will replace it with three dots "…" but it will decide according to the context whether to put it on the bottom (like
\ldots
) or centered (like
\cdots
).
Dots
LaTeX gives you several commands to insert dots in your formulas. This can be particularly useful if you have to type big matrices omitting elements. First of all, here are the main dots-related commands LaTeX provides:
Code | Output | Comment |
---|---|---|
\dots | <math>\dots</math> | generic dots, to be used in text (outside formulas as well). It automatically manages whitespaces before and after itself according to the context, it's a higher level command. |
\ldots | <math>\ldots</math> | the output is similar to the previous one, but there is no automatic whitespace management; it works at a lower level. |
\cdots | <math>\cdots</math> | These dots are centered relative to the height of a letter. There is also the binary multiplication operator, \cdot, mentioned below. |
\vdots | <math>\vdots</math> | vertical dots |
\ddots | <math>\ddots</math> | diagonal dots |
\hdotsfor{n} | <math>\ldots \ldots</math> | to be used in matrices, it creates a row of dots spanning n columns. |
List of Mathematical Symbols
All the pre-defined mathematical symbols from the \TeX\ package are listed below. More symbols are available from extra packages.
Symbol | Script | Symbol | Script | Symbol | Script | Symbol | Script | Symbol | Script |
---|---|---|---|---|---|---|---|---|---|
<math>\leq</math> | \leq | <math>\geq</math> | \geq | <math>\equiv\,</math> | \equiv | <math>\models</math> | \models | <math>\prec</math> | \prec |
<math>\succ</math> | \succ | <math>\sim</math> | \sim | <math>\perp</math> | \perp | <math>\preceq</math> | \preceq | <math>\succeq</math> | \succeq |
<math>\simeq</math> | \simeq | <math>\mid</math> | \mid | <math>\ll</math> | \ll | <math>\gg</math> | \gg | <math>\asymp</math> | \asymp |
<math>\parallel</math> | \parallel | <math>\subset</math> | \subset | <math>\supset</math> | \supset | <math>\approx</math> | \approx | <math>\bowtie</math> | \bowtie |
<math>\subseteq</math> | \subseteq | <math>\supseteq</math> | \supseteq | <math>\cong</math> | \cong | <math>\sqsubset</math> | \sqsubset | <math>\sqsupset</math> | \sqsupset |
<math>\neq\,</math> | \neq | <math>\smile</math> | \smile | <math>\sqsubseteq</math> | \sqsubseteq | <math>\sqsupseteq</math> | \sqsupseteq | <math>\doteq</math> | \doteq |
<math>\frown</math> | \frown | <math>\in</math> | \in | <math>\ni</math> | \ni | <math>\propto</math> | \propto | <math>=\,</math> | = |
<math>\vdash</math> | \vdash | <math>\dashv</math> | \dashv | <math></math> | <math>>\,</math> | > |
Symbol | Script |
---|---|
<math>\Alpha\,</math> and <math>\alpha\,</math> | \Alpha and \alpha |
<math>\Beta\,</math> and <math>\beta\,</math> | \Beta and \beta |
<math>\Gamma\,</math> and <math>\gamma\,</math> | \Gamma and \gamma |
<math>\Delta\,</math> and <math>\delta\,</math> | \Delta and \delta |
<math>\Epsilon\,</math>, <math>\epsilon\,</math> and <math>\varepsilon</math> | \Epsilon, \epsilon and \varepsilon |
<math>\Zeta\,</math> and <math>\zeta\,</math> | \Zeta and \zeta |
<math>\Eta\,</math> and <math>\eta\,</math> | \Eta and \eta |
<math>\Theta\,</math>, <math>\theta\,</math> and <math>\vartheta</math> | \Theta, \theta and \vartheta |
<math>\Iota\,</math> and <math>\iota\,</math> | \Iota and \iota |
<math>\Kappa\,</math> and <math>\kappa\,</math> | \Kappa and \kappa |
<math>\Lambda\,</math> and <math>\lambda\,</math> | \Lambda and \lambda |
<math>\Mu\,</math> and <math>\mu\,</math> | \Mu and \mu |
<math>\Nu\,</math> and <math>\nu\,</math> | \Nu and \nu |
<math>\Xi\,</math> and <math>\xi\,</math> | \Xi and \xi |
<math>\Pi\,</math>, <math>\pi\,</math> and <math>\varpi</math> | \Pi, \pi and \varpi |
<math>\Rho\,</math>, <math>\rho\,</math> and <math>\varrho</math> | \Rho, \rho and \varrho |
<math>\Sigma\,</math>, <math>\sigma\,</math> and <math>\varsigma</math> | \Sigma, \sigma and \varsigma |
<math>\Tau\,</math> and <math>\tau\,</math> | \Tau and \tau |
<math>\Upsilon\,</math> and <math>\upsilon\,</math> | \Upsilon and \upsilon |
<math>\Phi\,</math>, <math>\phi\,</math>, and <math>\varphi</math> | \Phi, \phi and \varphi |
<math>\Chi\,</math> and <math>\chi\,</math> | \Chi and \chi |
<math>\Psi\,</math> and <math>\psi\,</math> | \Psi and \psi |
<math>\Omega\,</math> and <math>\omega\,</math> | \Omega and \omega |
Symbol | Script | Symbol | Script | Symbol | Script | Symbol | Script |
---|---|---|---|---|---|---|---|
<math>\pm\,</math> | \pm | <math>\cap\,</math> | \cap | <math>\diamond</math> | \diamond | <math>\oplus</math> | \oplus |
<math>\mp</math> | \mp | <math>\cup</math> | \cup | <math>\bigtriangleup</math> | \bigtriangleup | <math>\ominus</math> | \ominus |
<math>\times\,</math> | \times | <math>\uplus</math> | \uplus | <math>\bigtriangledown</math> | \bigtriangledown | <math>\otimes</math> | \otimes |
<math>\div</math> | \div | <math>\sqcap</math> | \sqcap | <math>\triangleleft</math> | \triangleleft | <math>\oslash</math> | \oslash |
<math>\ast</math> | \ast | <math>\sqcup</math> | \sqcup | <math>\triangleright</math> | \triangleright | <math>\odot</math> | \odot |
<math>\star</math> | \star | <math>\vee</math> | \vee | <math>\bigcirc</math> | \bigcirc | <math>\circ</math> | \circ |
<math>\wedge</math> | \wedge | <math>\dagger\,</math> | \dagger | <math>\bullet</math> | \bullet | <math>\setminus\,</math> | \setminus |
<math>\ddagger\,</math> | \ddagger | <math>\cdot</math> | \cdot | <math>\wr</math> | \wr | <math>\amalg</math> | \amalg |
Symbol | Script |
---|---|
<math>\exists\,</math> | \exists |
<math>\forall\,</math> | \forall |
<math>\neg\,</math> | \neg |
<math>\in\,</math> and <math>\notin\,</math> | \in and \notin |
<math>\ni\,</math> | \ni |
<math>\land\,</math> | \land |
<math>\lor\,</math> | \lor |
<math>\implies\,</math> | \implies |
<math>\iff\,</math> | \iff |
<math>\emptyset\,</math> | \emptyset |
{{clear}}
Summary
As you can begin to see, typesetting maths can be tricky at times. However, because Latex provides so much control, you can get professional quality mathematics typesetting for relatively little effort (once you've had a bit of practice, of course!). It would be possible to keep going and going with maths topics because it seems potentially limitless. However, with this tutorial, you should be able to get along sufficiently.
{{TODO|
- introduce symbols from http://www.andy-roberts.net/misc/late.../symbols.pdf
- add example for alignat ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf
- Consider, instead of using the symbols from the above mentioned, using what has already been introduced in http://en.wikipedia.org/wiki/Math_markup instead of retyping the tables
- How to box an equation within an align environment
- Color in equations
}}
Notes
<references/>
Further reading
- Help:Displaying a formula: Wikimedia uses a subset of LaTeX commands.
External links
<noinclude> {{LaTeX/Bottom|Page Layout|Advanced Mathematics}} </noinclude>