LaTeX math markup: Difference between revisions

From SklogWiki
Jump to navigation Jump to search
No edit summary
m (Undo revision 12055 by 70.135.124.111 (talk))
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Note: this page is a subsection of the Wikipedia page [http://en.wikipedia.org/wiki/Help:Formula Help:Displaying a formula].
== Subscripts, superscripts, integrals ==  
== Subscripts, superscripts, integrals ==  
{| border="2" cellpadding="4" cellspacing="0" style="margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;"
{| border="2" cellpadding="4" cellspacing="0" style="margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;"
Line 10: Line 11:
|Subscript||<code>a_2</code>||<math>a_2</math>||<math>a_2 \,\!</math>
|Subscript||<code>a_2</code>||<math>a_2</math>||<math>a_2 \,\!</math>
|-
|-
|rowspan=2|Grouping||<code>a^{2 2}</code>||<math>a^{2 2}</math>||<math>a^{2 2}\,\!</math>
|rowspan=2|Grouping||<code>a^{2+2}</code>||<math>a^{2+2}</math>||<math>a^{2+2}\,\!</math>
|-
|-
|<code>a_{i,j}</code>||<math>a_{i,j}</math>||<math>a_{i,j}\,\!</math>
|<code>a_{i,j}</code>||<math>a_{i,j}</math>||<math>a_{i,j}\,\!</math>
|-
|-
|Combining sub
|Combining sub & super||<code>x_2^3</code>||colspan=2|<math>x_2^3</math>
|-
|rowspan="2"|Preceding and/or Additional sub & super||<code>\sideset{_1^2}{_3^4}\prod_a^b</code>||colspan=2|<math>\sideset{_1^2}{_3^4}\prod_a^b</math>
|-
|<code>{}_1^2\!\Omega_3^4</code>||colspan=2|<math>{}_1^2\!\Omega_3^4</math>
|-
|rowspan="4"|Stacking
|<code>\overset{\alpha}{\omega}</code>||colspan="2"|<math>\overset{\alpha}{\omega}</math>
|-
|<code>\underset{\alpha}{\omega}</code>||colspan="2"|<math>\underset{\alpha}{\omega}</math>
|-
|<code>\overset{\alpha}{\underset{\gamma}{\omega}}</code>||colspan="2"|<math>\overset{\alpha}{\underset{\gamma}{\omega}}</math>
|-
|<code>\stackrel{\alpha}{\omega}</code>||colspan="2"|<math>\stackrel{\alpha}{\omega}</math>
|-
|Derivative (forced PNG)||<code>x', y'', f', f''\!</code>||&nbsp;||<math>x', y'', f', f''\!</math>
|-
|Derivative (f in italics may overlap primes in HTML)||<code>x', y'', f', f''</code>||<math>x', y'', f', f''</math>||<math>x', y'', f', f''\!</math>
|-
|Derivative (wrong in HTML)||<code>x^\prime, y^{\prime\prime}</code>||<math>x^\prime, y^{\prime\prime}</math>||<math>x^\prime, y^{\prime\prime}\,\!</math>
|-
|Derivative (wrong in PNG)||<code>x\prime, y\prime\prime</code>||<math>x\prime, y\prime\prime</math>||<math>x\prime, y\prime\prime\,\!</math>
|-
|Derivative dots||<code>\dot{x}, \ddot{x}</code>||colspan=2|<math>\dot{x}, \ddot{x}</math>
|-
|rowspan="3"|Underlines, overlines, vectors||<code>\hat a \ \bar b \ \vec c</code>||colspan=2|<math>\hat a \ \bar b \ \vec c</math>
|-
|<code>\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f}</code>||colspan=2|<math>\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f}</math>
|-
|<code>\overline{g h i} \ \underline{j k l}</code>||colspan=2|<math>\overline{g h i} \ \underline{j k l}</math>
|-
|Arrows||<code> A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C</code>||colspan=2|<math> A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C</math>
|-
|Overbraces||<code>\overbrace{ 1+2+\cdots+100 }^{5050}</code>||colspan=2|<math>\overbrace{ 1+2+\cdots+100 }^{5050}</math>
|-
|Underbraces||<code>\underbrace{ a+b+\cdots+z }_{26}</code>||colspan=2|<math>\underbrace{ a+b+\cdots+z }_{26}</math>
|-
|Sum||<code>\sum_{k=1}^N k^2</code>||colspan=2|<math>\sum_{k=1}^N k^2</math>
|-
|Sum (force&nbsp;<code>\textstyle</code>)||<code>\textstyle \sum_{k=1}^N k^2 </code>||colspan=2|<math>\textstyle \sum_{k=1}^N k^2</math>
|-
|Product||<code>\prod_{i=1}^N x_i</code>||colspan=2|<math>\prod_{i=1}^N x_i</math>
|-
|Product (force&nbsp;<code>\textstyle</code>)||<code>\textstyle \prod_{i=1}^N x_i</code>||colspan=2|<math>\textstyle \prod_{i=1}^N x_i</math>
|-
|Coproduct||<code>\coprod_{i=1}^N x_i</code>||colspan=2|<math>\coprod_{i=1}^N x_i</math>
|-
|Coproduct (force&nbsp;<code>\textstyle</code>)||<code>\textstyle \coprod_{i=1}^N x_i</code>||colspan=2|<math>\textstyle \coprod_{i=1}^N x_i</math>
|-
|Limit||<code>\lim_{n \to \infty}x_n</code>||colspan=2|<math>\lim_{n \to \infty}x_n</math>
|-
|Limit (force&nbsp;<code>\textstyle</code>)||<code>\textstyle \lim_{n \to \infty}x_n</code>||colspan=2|<math>\textstyle \lim_{n \to \infty}x_n</math>
|-
|Integral||<code>\int\limits_{-N}^{N} e^x\, dx</code>||colspan=2|<math>\int\limits_{-N}^{N} e^x\, dx</math>
|-
|Integral (force&nbsp;<code>\textstyle</code>)||<code>\textstyle \int\limits_{-N}^{N} e^x\, dx</code>||colspan=2|<math>\textstyle \int\limits_{-N}^{N} e^x\, dx</math>
|-
|Double integral||<code>\iint\limits_{D} \, dx\,dy</code>||colspan=2|<math>\iint\limits_{D} \, dx\,dy</math>
|-
|Triple integral||<code>\iiint\limits_{E} \, dx\,dy\,dz</code>||colspan=2|<math>\iiint\limits_{E} \, dx\,dy\,dz</math>
|-
|Quadruple integral||<code>\iiiint\limits_{F} \, dx\,dy\,dz\,dt</code>||colspan=2|<math>\iiiint\limits_{F} \, dx\,dy\,dz\,dt</math>
|-
|Path integral||<code>\oint\limits_{C} x^3\, dx + 4y^2\, dy</code>||colspan=2|<math>\oint\limits_{C} x^3\, dx + 4y^2\, dy</math>
|-
|Intersections||<code>\bigcap_1^{n} p</code>||colspan=2|<math>\bigcap_1^{n} p</math>
|-
|Unions||<code>\bigcup_1^{k} p</code>||colspan=2|<math>\bigcup_1^{k} p</math>
|}
== Fractions, matrices, multilines ==
<table class="wikitable">
 
<tr>
<th>Feature</th>
<th>Syntax</th>
<th>How it looks rendered</th>
</tr>
 
<tr>
<td>Fractions</td>
<td><code>\frac{2}{4}=0.5</code></td>
<td><math>\frac{2}{4}=0.5</math></td>
</tr>
 
<tr>
<td>Small Fractions</td>
<td><code>\tfrac{2}{4} = 0.5</code></td>
<td><math>\tfrac{2}{4} = 0.5</math></td>
</tr>
 
<tr>
<td>Large (normal) Fractions</td>
<td><code>\dfrac{2}{4} = 0.5</code></td>
<td><math>\dfrac{2}{4} = 0.5</math></td>
</tr>
 
<tr>
<td>Large (nested) Fractions</td>
<td><code>\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a</code></td>
<td><math>\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a</math></td>
</tr>
 
<tr>
<td>Binomial coefficients</td>
<td><code>\binom{n}{k}</code></td>
<td><math>\binom{n}{k}</math></td>
</tr>
 
 
<tr>
<td>Small Binomial coefficients</td>
<td><code>\tbinom{n}{k}</code></td>
<td><math>\tbinom{n}{k}</math></td>
</tr>
 
 
<tr>
<td>Large (normal) Binomial coefficients</td>
<td><code>\dbinom{n}{k}</code></td>
<td><math>\dbinom{n}{k}</math></td>
</tr>
 
<tr>
<td rowspan="7">Matrices</td>
<td><pre>\begin{matrix}
  x & y \\
  z & v
\end{matrix}</pre></td>
<td><math>\begin{matrix} x & y \\ z & v
\end{matrix}</math></td>
</tr>
 
<tr>
<td><pre>\begin{vmatrix}
  x & y \\
  z & v
\end{vmatrix}</pre></td>
<td><math>\begin{vmatrix} x & y \\ z & v
\end{vmatrix}</math></td>
</tr>
 
<tr>
<td><pre>\begin{Vmatrix}
  x & y \\
  z & v
\end{Vmatrix}</pre></td>
<td><math>\begin{Vmatrix} x & y \\ z & v
\end{Vmatrix}</math></td>
</tr>
 
<tr>
<td><pre>\begin{bmatrix}
  0      & \cdots & 0      \\
  \vdots & \ddots & \vdots \\
  0      & \cdots & 0
\end{bmatrix}</pre></td>
<td><math>\begin{bmatrix} 0 & \cdots & 0 \\ \vdots
& \ddots & \vdots \\ 0 & \cdots &
0\end{bmatrix} </math></td>
</tr>
 
<tr>
<td><pre>\begin{Bmatrix}
  x & y \\
  z & v
\end{Bmatrix}</pre></td>
<td><math>\begin{Bmatrix} x & y \\ z & v
\end{Bmatrix}</math></td>
</tr>
 
<tr>
<td><pre>\begin{pmatrix}
  x & y \\
  z & v
\end{pmatrix}</pre></td>
<td><math>\begin{pmatrix} x & y \\ z & v
\end{pmatrix}</math></td>
</tr>
 
<tr>
<td><pre>
\bigl( \begin{smallmatrix}
  a&b\\ c&d
\end{smallmatrix} \bigr)
</pre></td>
<td><math>
\bigl( \begin{smallmatrix}
  a&b\\ c&d
\end{smallmatrix} \bigr)
</math></td>
</tr>
 
 
 
<tr>
<td>Case distinctions</td>
<td><pre>
f(n) =
\begin{cases}
  n/2,  & \mbox{if }n\mbox{ is even} \\
  3n+1, & \mbox{if }n\mbox{ is odd}
\end{cases}</pre></td>
<td><math>f(n) =
\begin{cases}
  n/2,  & \mbox{if }n\mbox{ is even} \\
  3n+1, & \mbox{if }n\mbox{ is odd}
\end{cases} </math></td>
</tr>
 
<tr>
<td rowspan="2">Multiline equations</td>
<td><pre>
\begin{align}
f(x) & = (a+b)^2 \\
      & = a^2+2ab+b^2 \\
\end{align}
</pre></td>
<td><math>
\begin{align}
f(x) & = (a+b)^2 \\
      & = a^2+2ab+b^2 \\
\end{align}
</math></td>
</tr>
 
<tr>
<td><pre>
\begin{alignat}{2}
f(x) & = (a-b)^2 \\
      & = a^2-2ab+b^2 \\
\end{alignat}
</pre></td>
<td><math>
\begin{alignat}{2}
f(x) & = (a-b)^2 \\
      & = a^2-2ab+b^2 \\
\end{alignat}
</math></td>
</tr>
<tr>
<td>Multiline equations <small>(must define number of colums used ({lcr}) <small>(should not be used unless needed)</small></small></td>
<td><pre>
\begin{array}{lcl}
  z        & = & a \\
  f(x,y,z) & = & x + y + z 
\end{array}</pre></td>
<td><math>\begin{array}{lcl}
  z        & = & a \\
  f(x,y,z) & = & x + y + z 
\end{array}</math></td>
</tr>
 
<tr>
<td>Multiline equations (more)</td>
<td><pre>
\begin{array}{lcr}
  z        & = & a \\
  f(x,y,z) & = & x + y + z   
\end{array}</pre></td>
<td><math>\begin{array}{lcr}
  z        & = & a \\
  f(x,y,z) & = & x + y + z   
\end{array}</math></td>
</tr>
 
<tr>
<td>Breaking up a long expression so that it wraps when necessary</td>
<td><pre>
<nowiki>
<math>f(x) \,\!</math>
<math>= \sum_{n=0}^\infty a_n x^n </math>
<math>= a_0+a_1x+a_2x^2+\cdots</math>
</nowiki>
</pre>
</td>
<td>
<math>f(x) \,\!</math><math>= \sum_{n=0}^\infty a_n x^n </math><math>= a_0 +a_1x+a_2x^2+\cdots</math>
</td>
</tr>
 
<tr>
<td>Simultaneous equations</td>
<td><pre>\begin{cases}
    3x + 5y +  z \\
    7x - 2y + 4z \\
  -6x + 3y + 2z
\end{cases}</pre></td>
<td><math>\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}</math></td>
</tr>
 
</table>
[[category: help]]

Latest revision as of 13:28, 29 December 2011

Note: this page is a subsection of the Wikipedia page Help:Displaying a formula.

Subscripts, superscripts, integrals[edit]

Feature Syntax How it looks rendered
HTML PNG
Superscript a^2
Subscript a_2
Grouping a^{2+2}
a_{i,j}
Combining sub & super x_2^3
Preceding and/or Additional sub & super \sideset{_1^2}{_3^4}\prod_a^b
{}_1^2\!\Omega_3^4
Stacking \overset{\alpha}{\omega}
\underset{\alpha}{\omega}
\overset{\alpha}{\underset{\gamma}{\omega}}
\stackrel{\alpha}{\omega}
Derivative (forced PNG) x', y, f', f\!  
Derivative (f in italics may overlap primes in HTML) x', y, f', f
Derivative (wrong in HTML) x^\prime, y^{\prime\prime}
Derivative (wrong in PNG) x\prime, y\prime\prime
Derivative dots \dot{x}, \ddot{x}
Underlines, overlines, vectors \hat a \ \bar b \ \vec c
\overrightarrow{a b} \ \overleftarrow{c d} \ \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
Sum (force \textstyle) \textstyle \sum_{k=1}^N k^2
Product \prod_{i=1}^N x_i
Product (force \textstyle) \textstyle \prod_{i=1}^N x_i
Coproduct \coprod_{i=1}^N x_i
Coproduct (force \textstyle) \textstyle \coprod_{i=1}^N x_i
Limit \lim_{n \to \infty}x_n
Limit (force \textstyle) \textstyle \lim_{n \to \infty}x_n
Integral \int\limits_{-N}^{N} e^x\, dx
Integral (force \textstyle) \textstyle \int\limits_{-N}^{N} e^x\, dx
Double integral \iint\limits_{D} \, dx\,dy
Triple integral \iiint\limits_{E} \, dx\,dy\,dz
Quadruple integral \iiiint\limits_{F} \, dx\,dy\,dz\,dt
Path integral \oint\limits_{C} x^3\, dx + 4y^2\, dy
Intersections \bigcap_1^{n} p
Unions \bigcup_1^{k} p

Fractions, matrices, multilines[edit]

Feature Syntax How it looks rendered
Fractions \frac{2}{4}=0.5
Small Fractions \tfrac{2}{4} = 0.5
Large (normal) Fractions \dfrac{2}{4} = 0.5
Large (nested) Fractions \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a
Binomial coefficients \binom{n}{k}
Small Binomial coefficients \tbinom{n}{k}
Large (normal) Binomial coefficients \dbinom{n}{k}
Matrices
\begin{matrix}
  x & y \\
  z & v 
\end{matrix}
\begin{vmatrix}
  x & y \\
  z & v 
\end{vmatrix}
\begin{Vmatrix}
  x & y \\
  z & v
\end{Vmatrix}
\begin{bmatrix}
  0      & \cdots & 0      \\
  \vdots & \ddots & \vdots \\ 
  0      & \cdots & 0
\end{bmatrix}
\begin{Bmatrix}
  x & y \\
  z & v
\end{Bmatrix}
\begin{pmatrix}
  x & y \\
  z & v 
\end{pmatrix}
\bigl( \begin{smallmatrix}
  a&b\\ c&d
\end{smallmatrix} \bigr)
Case distinctions
f(n) = 
\begin{cases} 
  n/2,  & \mbox{if }n\mbox{ is even} \\
  3n+1, & \mbox{if }n\mbox{ is odd} 
\end{cases}
Multiline equations
\begin{align}
 f(x) & = (a+b)^2 \\
      & = a^2+2ab+b^2 \\
\end{align}
\begin{alignat}{2}
 f(x) & = (a-b)^2 \\
      & = a^2-2ab+b^2 \\
\end{alignat}
Multiline equations (must define number of colums used ({lcr}) (should not be used unless needed)
\begin{array}{lcl}
  z        & = & a \\
  f(x,y,z) & = & x + y + z  
\end{array}
Multiline equations (more)
\begin{array}{lcr}
  z        & = & a \\
  f(x,y,z) & = & x + y + z     
\end{array}
Breaking up a long expression so that it wraps when necessary

<math>f(x) \,\!</math>
<math>= \sum_{n=0}^\infty a_n x^n </math>
<math>= a_0+a_1x+a_2x^2+\cdots</math>

Simultaneous equations
\begin{cases}
    3x + 5y +  z \\
    7x - 2y + 4z \\
   -6x + 3y + 2z 
\end{cases}