![Help](https://cdn.statically.io/img/static.wikia.nocookie.net/memoryalpha/images/7/79/Help_icon.png/revision/latest/scale-to-width-down/25?cb=20080407155933&path-prefix=en)
MediaWiki uses LaTeX markup to render mathematical formulas as SVG images. LaTeX markup goes inside <math> ... </math> tags. Line breaks within these tags are fine, and aren't rendered. They're a good idea to keep the raw markup clear (for instance, a line break after each term or row of a matrix).
This page contains selected examples of math markup that can be used in Memory Alpha articles. For more detailed information, see Help:Displaying a formula at Wikipedia.
Special characters[]
Feature | Syntax | How it looks rendered |
---|---|---|
std. functions (good) | \sin x + \ln y + \sgn z | |
std. functions (wrong) | sin x + ln y + sgn z | |
Modular arithmetic | s_k \equiv 0 \pmod{m} | |
Derivatives | \nabla \partial x dx \dot x \ddot y | |
Sets | \forall \exists \empty \emptyset \varnothing | |
\in \ni \not \in \notin \subset \subseteq \supset \supseteq | ||
\cap \bigcap \cup \bigcup \biguplus \setminus \smallsetminus | ||
Logic | p \land \bar{q} \to p\lor \lnot q | |
Roots | \sqrt{2}\approx 1.4 | |
\sqrt[n]{x} | ||
Relations | \sim \simeq \cong \le \ge \equiv \not\equiv \approx \ne | |
Geometric | \Diamond \Box \triangle \angle \perp \mid \nmid \| 45^\circ | |
Arrows |
\leftarrow \rightarrow \leftrightarrow |
|
\Leftarrow \Rightarrow \Leftrightarrow |
| |
Special |
\oplus \otimes \pm \mp \hbar \dagger \ddagger \star \circ \cdot \times \bullet \infty |
|
Subscripts and superscripts[]
Feature | Syntax | How it looks rendered |
---|---|---|
Superscript | a^2 | |
Subscript | a_2 | |
Grouping | a^{2+2} | |
a_{i,j} | ||
Combining sub & super | x_2^3 | |
Derivative (good) | x' | |
Underlines and overlines | \hat a \bar b \vec c \widehat {d e f} \overline {g h i} \underline {j k l} | |
Arrows | A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C | |
Overbraces | \overbrace{ 1+2+\cdots+100 }^{5050} | |
Underbraces | \underbrace{ a+b+\cdots+z }_{26} | |
Sum | \sum_{k=1}^N k^2 | |
Product | \prod_{i=1}^N x_i | |
Limit | \lim_{n \to \infty}x_n | |
Integral | \int_{-N}^{N} e^x\, dx | |
Line Integral | \oint_{C} x^3\, dx + 4y^2\, dy |
Fractions, matrices, and multilines[]
Feature | Syntax | How it looks rendered |
---|---|---|
Fractions | \frac{2}{4} or {2 \over 4} | |
Binomial coefficients | {n \choose k} | |
Matrices | \begin{pmatrix} x & y \\ z & v \end{pmatrix} | |
\begin{bmatrix} 0 & \cdots & 0 \\ \vdots &
\ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} |
||
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix} | ||
\begin{vmatrix} x & y \\ z & v \end{vmatrix} | ||
\begin{Vmatrix} x & y \\ z & v \end{Vmatrix} | ||
\begin{matrix} x & y \\ z & v \end{matrix} | ||
Case distinctions | f(n) = \left \{ \begin{matrix} n/2, & \mbox{if }n\mbox{ is
even} \\ 3n+1, & \mbox{if }n\mbox{ is odd} \end{matrix} \right. |
|
Multiline equations | \begin{matrix}f(n+1) & = & (n+1)^2 \\ \ &
= & n^2 + 2n + 1 \end{matrix} |
Fonts[]
Feature | Syntax | How it looks rendered |
---|---|---|
Greek letters | \alpha \beta \gamma \Gamma \phi \Phi \Psi\ \tau \Omega | |
Blackboard bold | x\in\mathbb{R}\sub\mathbb{C} | |
Boldface (vectors) | \mathbf{x}\cdot\mathbf{y} = 0 | |
Boldface (Greek) | \boldsymbol{\alpha} + \boldsymbol{\beta} + \boldsymbol{\gamma} | |
Fraktur typeface | \mathfrak{a} \mathfrak{B} | |
Script | \mathcal{ABC} | |
Hebrew | \aleph \beth \gimel \daleth | |
Non-italicized characters | \mbox{abc} | |
Mixed italics (bad) | \mbox{if} n \mbox{is even} | |
Mixed italics (good) | \mbox{if }n\mbox{ is even} |
Parenthesizing big expressions[]
Feature | Syntax | How it looks rendered |
---|---|---|
Not good | ( \frac{1}{2} ) | |
Better | \left ( \frac{1}{2} \right ) |
You can use various delimiters with \left and \right:
Feature | Syntax | How it looks rendered |
---|---|---|
Parentheses | \left ( A \right ) | |
Brackets | \left [ A \right ] | |
Braces | \left \{ A \right \} | |
Angle brackets | \left \langle A \right \rangle | |
Bars and double bars | \left | A \right | and \left \| B \right \| | |
Delimiters can be mixed, as |
\left [ 0,1 \right ) |
|
Use \left. and \right. if you don't want a delimiter to appear |
\left . \frac{A}{B} \right \} \to X |
Spacing[]
Note that TeX handles most spacing automatically, but you may sometimes want manual control.
Feature | Syntax | How it looks rendered |
---|---|---|
double quad space | a \qquad b | |
quad space | a \quad b | |
text space | a\ b | |
large space | a\;b | |
medium space | a\>b | [not supported] |
small space | a\,b | |
no space | ab | |
negative space | a\!b |
External links[]
- LaTeX at Wikipedia
- A Gentle Introduction to TeX at The CTAN archive – a PDF document introducing TeX; see page 39 onward for a good introduction to the math side of things
- The Comprehensive LaTeX Symbol List at The CTAN archive – a complete list of symbols available in LaTeX
Help |
---|