Help:Displaying a formula

MediaWiki uses a subset of AMS-LaTeX markup, a superset of LaTeX markup which is in turn a superset of TeX markup, for mathematical formulae. It generates either PNG images or simple HTML markup, depending on user preferences and the complexity of the expression. In the future, as more browsers become smarter, it will be able to generate enhanced HTML or even MathML in many cases. (See blahtex for information about current work on adding MathML support.) Although, in all cases mentioned, is generated by compilation, and not by an interpreter program, there is one essential difference between, e.g., Donald Knuth's TeX or Leslie Lamport's LaTeX and the present implementation: whereas in the first two cases the compiler typically generates an all-in-one printable output, which has the quality of a whole book with all chapters, sections and subsections, and where no line is "special", in the present case one has, typically, a mixture of  images (more precisely: PNG images) for the equations, embedded into usual text, and with short  elements usually replaced by html parts. As a consequence, in many cases TeX-elements, e.g. vector symbols, "stick out" below (or above) the text line. This "sticking out" is not the case in the above-mentioned original products, and the HTML-substitutes for small  additions to the text are often insufficient in quality for many readers. In spite of these shortcomings, the present product characterized by "many embedded PNG-images" should be preferred for small texts, where the equations do not dominate.

More precisely, MediaWiki filters the markup through Texvc, which in turn passes the commands to for the actual rendering. Thus, only a limited part of the full language is supported; see below for details.

Basics
Math markup goes inside.

The code has to be put literally: MediaWiki templates, predefined templates, and parameters cannot be used within math tags: pairs of double braces are ignored and "#" gives an error message. However, math tags work in the then and else part of #if, etc. See for more information.

LaTeX commands
LaTeX commands are case-sensitive, and take one of the following two formats:


 * They start with a backslash \ and then have a name consisting of letters only. Command names are terminated by a space, a number or any other "non-letter".
 * They consist of a backslash \ and exactly one non-letter.

Some commands need an argument, which has to be given between curly braces { } after the command name. Some commands support optional parameters, which are added after the command name in square brackets []. The general syntax is:

\commandname[option1,option2,...]{argument1}{argument2}...

Special characters
The following symbols are reserved characters that either have a special meaning under LaTeX or are unavailable in all the fonts. If you enter them directly in your text, they will normally not render, but rather do things you did not intend.


 * 1) $ % ^ & _ { } ~ \

These characters can be entered by adding a prefix backslash:

\# \$ \% \textasciicircum{} \& \_ \{ \} \~{} \textbackslash{}

The other symbols and many more can be rendered with special commands in mathematical formulae or as accents.

The backslash character \ can not be entered by adding another backslash in front of it (\\); this sequence is used for line breaking. For introducing a backslash in math mode, you can use \backslash instead.

The command \~ produces a tilde which is placed over the next letter. For example \~n gives ñ. To produce just the character ~, use \~{} which places a ~ over an empty box. Alternatively \sim produces a large centred ~ which may be more appropriate in some situations, but may not render properly in simple expressions which are converted to html.

Similarly, the command \^ produces a hat over the next character, for example \^{o} produces ô. If you need in text to display the ^ symbol you have to use \textasciicircum.

Spaces
"Whitespace" characters, such as blank or tab, are treated uniformly as "space" by LaTeX. Several consecutive whitespace characters are treated as one "space". See below for commands that produces spaces of different size.

LaTeX environments
Environments in LaTeX have a role that is quite similar to commands, but they usually have effect on a wider part of formula. Their syntax is:

\begin{environmentname} text to be influenced \end{environmentname}

Environments supported by WikiQueer include matrix, align, etc. See below.

Rendering
By default, the PNG images are rendered black on white, with a transparent background. On darker backgrounds, the characters may show white edges. To remove these, match the PNG background color with the background color of the page using \pagecolor.

The colors, as well as font sizes and types, are independent of browser settings or CSS. Font sizes and types will often deviate from what HTML renders. Vertical alignment with the surrounding text can also be a problem (see bug 32694). The css selector of the images is.

The alt text of the PNG images, which is displayed to visually impaired and other readers who cannot see the images, and is also used when the text is selected and copied, defaults to the wikitext that produced the image, excluding the  and. You can override this by explicitly specifying an  attribute for the   element. For example,  generates an image \sqrt{\pi} whose alt text is "Square root of pi".

Apart from function and operator names, as is customary in mathematics, variables and letters are in italics; digits are not. For other text, (like variable labels) to avoid being rendered in italics like variables, use,  , or. You can also define new function names using. For example,  gives $$\text{abc}$$. This does not work for special characters, they are ignored unless the whole $$ expression is rendered in HTML:



gives:



See bug 798 for details.

Nevertheless, using  instead of , more characters are allowed

For example,

gives:

But  and   will give an error:
 * \mbox {ð}
 * \mbox {þ}

vs HTML
Before introducing markup for producing special characters, it should be noted that, as this comparison table shows, sometimes similar results can be achieved in HTML (see Help:Special characters).

The codes on the left produce the symbols on the right, but the latter can also be put directly in the wikitext, except for ‘=’.

The project has settled on both HTML and because each has advantages in some situations.

Pros of HTML

 * 1) Formulas in HTML behave more like regular text. In-line HTML formulae always align properly with the rest of the HTML text and, to some degree, can be cut-and-pasted (this is not a problem if  is rendered using MathJax, and the alignment should not be a problem for PNG rendering once bug 32694 is fixed).
 * 2) The formula’s background and font size match the rest of HTML contents (this can be fixed on  formulas by using the commands   and  ) and the appearance respects CSS and browser settings while the typeface is conveniently altered to help you identify formulae.
 * 3) Pages using HTML code for formulae will load faster and they will create less clutter on your hard disk.
 * 4) Formulae typeset with HTML code will be accessible to client-side script links (a.k.a. scriptlets).
 * 5) The display of a formula entered using mathematical templates can be conveniently altered by modifying the templates involved; this modification will affect all relevant formulae without any manual intervention.
 * 6) The HTML code, if entered diligently, will contain all semantic information to transform the equation back to  or any other code as needed. It can even contain differences  does not normally catch, e.g.   for the imaginary unit and   for an arbitrary index variable.

Pros of

 * 1)  is semantically more precise than HTML.
 * 2) In, " " means "mathematical variable x", whereas in HTML " " is generic and somewhat ambiguous.
 * 3) On the other hand, if you encode the same formula as " ", you get the same visual result $&amp;alpha;$ and no information is lost.  This requires diligence and more typing that could make the formula harder to understand as you type it. However, since there are far more readers than editors, this effort is worth considering if no other rendering options are available (such as MathJax, which was requested on bug 31406 for use on Wikimedia wikis and is being implemented on Extension:Math as a new rendering option).
 * 4) One consequence of point 1 is that  code can be transformed into HTML, but not vice-versa.  This means that on the server side we can always transform a formula, based on its complexity and location within the text, user preferences, type of browser, etc.  Therefore, where possible, all the benefits of HTML can be retained, together with the benefits of .  It is true that the current situation is not ideal, but that is not a good reason to drop information/contents.  It is more a reason to help improve the situation.
 * 5) Another consequence of point 1 is that  can be converted to MathML (e.g. by MathJax) for browsers which support it, thus keeping its semantics and allowing the rendering to be better suited for the reader’s graphic device.
 * 6)  is the preferred text formatting language of most professional mathematicians, scientists, and engineers. It is easier to persuade them to contribute if they can write in.
 * 7)  has been specifically designed for typesetting formulae, so input is easier and more natural if you are accustomed to it, and output is more aesthetically pleasing if you focus on a single formula rather than on the whole containing page.
 * 8) Once a formula is done correctly in, it will render reliably, whereas the success of HTML formulae is somewhat dependent on browsers or versions of browsers. Another aspect of this dependency is fonts: the serif font used for rendering formulae is browser-dependent and it may be missing some important glyphs.  While the browser generally capable to substitute a matching glyph from a different font family, it need not be the case for combined glyphs (compare ‘  ’ and ‘ a̅ ’).
 * 9) When writing in, editors need not worry about whether this or that version of this or that browser supports this or that HTML entity. The burden of these decisions is put on the software. This does not hold for HTML formulae, which can easily end up being rendered wrongly or differently from the editor’s intentions on a different browser.
 * 10)  formulae, by default, render larger and are usually more readable than HTML formulae and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
 * 11) While  does not assist you in finding HTML codes or Unicode values (which you can obtain by viewing the HTML source in your browser), cutting and pasting from a  PNG in WikiQueer into simple text will return the LaTeX source.


 * unless your wikitext follows the style of point 1.2
 * The entity support problem is not limited to mathematical formulae though; it can be easily solved by using the corresponding characters instead of entities, as the character repertoire links do, except for cases where the corresponding glyphs are visually indiscernible (e.g. &amp;ndash; for &lsquo;–&rsquo; and &amp;minus; for &lsquo;&minus;&rsquo;).

In some cases it may be the best choice to use neither nor the html-substitutes, but instead the simple ASCII symbols of a standard keyboard (see below, for an example).

Functions, symbols, special characters
{|class="wikitable" !colspan="2"|

Accents/diacritics
!colspan="2"|

Standard functions
!colspan="2"|

Bounds
!colspan="2"|

Projections
!colspan="2"|

Differentials and derivatives
!colspan="2"|

Letter-like symbols or constants
!colspan="2"|

Modular arithmetic
!colspan="2"|

Radicals
!colspan="2"|

Operators
!colspan="2"|

Sets
!colspan="2"|

Relations
!colspan="2"|

Geometric
!colspan="2"|

Logic
!colspan="2"|

Arrows
!colspan="2"|

Special
!colspan="2"|

Unsorted (new stuff)

 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }
 * }

For a little more semantics on these symbols, see the brief TeX Cookbook.

Fractions, matrices, multilines
or

Small fractions

Large (normal) fractions

Large (nested) fractions

Binomial coefficients

Small binomial coefficients

Large (normal) binomial coefficients

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, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ 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 columns 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, at the expense of destroying correct spacing f(x) \,\!

f(x) \,\!

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

Arrays \begin{array}{|c|c||c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}

Parenthesizing big expressions, brackets, bars
You can use various delimiters with \left and \right:

Equation numbering
The templates NumBlk and EquationRef can be used to number equations. The template EquationNote can be used to refer to a numbered equation from surrounding text. For example, the following syntax:



produces the following result (note the equation number in the right margin):

Later on, the text can refer to this equation by its number using syntax like this:



The result looks like this:


 * As seen in equation ($$), blah blah blah...

Note that the equation number produced by EquationNote is a link that the user can click to go immediately to the cited equation.

Alphabets and typefaces
Texvc cannot render arbitrary Unicode characters. Those it can handle can be entered by the expressions below. For others, such as Cyrillic, they can be entered as Unicode or HTML entities in running text, but cannot be used in displayed formulas.

Color
Equations can use color:





It is also possible to change the background color (since r59550), as in the following example:

Note that color should not be used as the only way to identify something, because it will become meaningless on black-and-white media or for color-blind people. See WikiQueer:Manual of Style (accessibility).

Spacing
Note that handles most spacing automatically, but you may sometimes want manual control.

Automatic spacing may be broken in very long expressions (because they produce an overfull hbox in ):
 * $$0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots$$
 * $$0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots$$

This can be remedied by putting a pair of braces { } around the whole expression:
 * $${0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}$$
 * $${0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}$$

Alignment with normal text flow
Due to the default CSS

an inline expression like $$\int_{-N}^{N} e^x\, dx$$ should look good.

If you need to align it otherwise, use  and play with the   argument until you get it right; however, how it looks may depend on the browser and the browser settings.

Also note that if you rely on this workaround, if/when the rendering on the server gets fixed in future releases, as a result of this extra manual offset your formulae will suddenly be aligned incorrectly. So use it sparingly, if at all.

Forced PNG rendering
To force the formula to render as PNG, add  (small space) at the end of the formula (where it is not rendered). This will force PNG if the user is in "" mode, but not for "" mode (math rendering settings in preferences). Notice that since MediaWiki 1.19, the only available options will be "" and "".

You can also use  (small space and negative space, which cancel out) anywhere inside the math tags. This does force PNG even in "HTML if possible" mode, unlike.

This could be useful to keep the rendering of formulae in a proof consistent for users who have not selected "" (e.g., all anonymous users on wikis where  is not set to 0), for example, or to fix formulae that render incorrectly in HTML (at one time, a^{2+2} rendered with an extra underscore), or to demonstrate how something is rendered when it would normally show up as HTML (as in the examples above).

For instance:

This has been tested with most of the formulae on this page, and seems to work perfectly.

You might want to include a comment in the HTML so people don't "correct" the formula by removing it:



Alternatively, you could create a template called "Don't remove the \,\!" to be able to use a category or Special:WhatLinksHere to track the usage of this hack.

Commutative diagrams
To make a commutative diagram, there are three steps:
 * 1) write the diagram in TeX
 * 2) convert to SVG
 * 3) upload the file to Wikimedia Commons

Diagrams in
Xy-pic (online manual) is the most powerful and general-purpose diagram package in TeX.

Simpler packages include:
 * American Mathematical Society's amscd
 * Paul Taylor's diagrams
 * François Borceux Diagrams

The following is a template for Xy-pic, together with a hack to increase the margins]in dvips, so that the diagram is not truncated by over-eager cropping (suggested in TUGboat: TUGboat, Volume 17 1996, No. 3): \documentclass{amsart} \usepackage[all, ps, dvips]{xy} % Loading the XY-Pic package % Using postscript driver for smoother curves \usepackage{color} % For invisible frame \begin{document} \thispagestyle{empty} % No page numbers \SelectTips{eu}{} % Euler arrowheads (tips) \setlength{\fboxsep}{0pt} % Frame box margin {\color{white}\framebox} % end math, end frame \end{document}

Convert to SVG
Once you have produced your diagram in LaTeX (or TeX), you can convert it to an SVG file using the following sequence of commands:

pdflatex file.tex pdfcrop --clip file.pdf tmp.pdf pdf2svg tmp.pdf file.svg (rm tmp.pdf at the end)

If you do not have pdflatex (which is unlikely) you can also use the commands

latex file.tex dvipdfm file.dvi

to get a PDF version of your diagram. The pdfcrop and pdf2svg utilities are needed for this procedure.

In general, you will not be able to get anywhere with diagrams without and Ghostscript, and the   program is a useful tool for creating or modifying your diagrams by hand.

These programs are:
 * a working distribution, such as TeX Live
 * Ghostscript
 * pstoedit
 * Inkscape

Upload the file
As the diagram is your own work, upload it to Wikimedia Commons, so that all projects (notably, all languages) can use it without having to copy it to their language's Wiki. (If you've previously uploaded a file to somewhere other than Commons, to Commons.)

Now go to the image page and add a description, including the source code, using this template:
 * Check size: Before uploading, check that the default size of the image is neither too large nor too small by opening in an SVG application and viewing at default size (100% scaling), otherwise adjust the -y option to dvips.
 * Name: Make sure the file has a meaningful name.
 * Upload: Login to Wikimedia Commons, then upload the file ; for the Summary, give a brief description.

Category:Commutative diagrams


 * Source code:
 * Include the source code in the image page, in the Source section of the Information template, so that the diagram can be edited in future.
 * Include the complete .tex file, not just the fragment, so future editors do not need to reconstruct a compilable file.
 * (Don't include it in the Summary section, which is just supposed to be a summary.)
 * License: The most common license for commutative diagrams is PD-self; some use PD-ineligible</tt>, especially for simple diagrams, or other licenses. Please do not use the GFDL, as it requires the entire text of the GFDL to be attached to any document that uses the diagram.
 * Description: If possible, link to a WikiQueer page relevant to the diagram.
 * Category: Include  </tt>, so that it appears in commons:Category:Commutative diagrams. There are also subcategories, which you may choose to use.
 * Include image: Now include the image on the original page via  [[Image:Diagram.svg]] </tt>

Examples
A sample conforming diagram is.

\oiint and \oiiint
To the unimplemented elements, or better: not-yet implemented ones, belongs \oiint (see below), i.e. a two-fold integral \iint ($$\iint$$), additionally with some kind of circular surface covering the centre of the two integrals. This element would appear in many contexts (requiring integration over a curved surface within a space of larger dimension), and would be a strong candidate for the next version, e.g. it would appear in Maxwell's equations. Thus, in the present version, there are a lot of workarounds, for example
 * $$\iint_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\subset\!\supset \mathbf D\;\cdot\mathrm{d}\mathbf A$$ which uses \iint along with \subset and \supset (overdrawn after backspacing), or
 * $$\int\!\!\!\!\int_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\bigcirc\,\,\mathbf D\;\cdot\mathrm{d}\mathbf A$$ which uses \int twice (with some backward kerning) along with \bigcirc (also overdrawn after backpacing) which produces a more consistent circle.

Three-fold curved integral symbol \oiiint (a variation of \iiint with an additional centred circle covering the three integrals, that should also be preferably more tightly kerned) are also commonly found in mathematics, physics and technical literature (for integration over a curved volume within a space of larger dimension), it looks more or less like
 * $$\int\!\!\!\!\!\int\!\!\!\!\!\int_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\bigcirc\,\,\mathbf D\;\cdot\mathrm{d}\mathbf A$$ which uses three \int symbols (with more backward kerning) along with \bigcirc (also overdrawn after backspacing).

However, since no standardisation exists as yet, any workaround like this (which uses many \! symbols for backspacing) should be avoided, if possible. See below for a possibility using PNG image enforcement.

In contrast, \oint ($$\oint$$) exists for the single dimension (integration over a curved line within a plane or any space with higher dimension).

Note that \iint (the double integral) and \iiint (the triple integral) are still not kerned as they should preferably be, and are currently rendered as if they were successive \int symbols ; this is not a major problem for reading the formulas, even if the integral symbols before the last one do not have bounds, so it's best to avoid backspacing "hacks" as they may be inconsistent with a possible future better implementation of integrals symbols (with more precisely computed kerning positions).

\oiint and \oiiint as PNG images
These symbols are available as PNG images which are also integrated into two templates, oiint and oiiint, which take care of the formatting around the symbols.

The templates have three parameters:
 * preintegral the text or formula immediately before the integral
 * intsubscpt the subscript below the integral
 * integrand the text or formula immediately after the formula


 * Examples:


 * Stoke's theorem:
 * Ampere's law + correction:
 * Ampere's law + correction:


 * Continuity of 4-momentum flux (in General relativity):

\overarc
\overarc is not yet implemented to display the arc notation. However, there exists a workaround: use \overset{\frown}{AB} which gives

$$\overset{\frown}{AB}$$

Enforcing PNG images?
Moreover, although for other symbols the html substitute does not show a similar bug, the corresponding text should be looked upon very critically, since the HTML-symbols, although not obviously wrong, may look rather ugly to some, so that an enforced PNG-image is often preferable.

However, generally image-enforcing should be avoided. Often the best choice is to use neither symbols nor the HTML substitutes, but instead the simple ASCII symbols offered by a standard keyboard: a good example is the quantity velocity, which might be given in  (if necessary with an enforcement) by $$v\!$$, with the HTML substitute $$v$$ (which, by the way, should not be mixed up with the Greek letter "\nu" $$\nu\!$$), and the ASCII letters v or V (i.e., one puts, at first, two primes for italic style, followed by the simple ASCII letter v or V, finally again two primes).

For vector or tensor quantities, one can use again ASCII letters plus three primes for bold printing.

Note also that the default HTML rendering of mathematic expressions (when they are possible) uses the default text font, weight, style and size for variable names. Some mathematical expressions need differences between these styles; for consistency with the more complex formulas using the same variables that can be rendered only as PNG, it may be necessary to enforce the PNG rendering also for isolated variables found in the article text (using one of the special spaces that remain invisible on the left or right of the expression and that force the PNG rendering wherever they occur in the expression, notably the  backspace "\!").

Quadratic polynomial
$$ax^2 + bx + c = 0$$ $$ax^2 + bx + c = 0$$

Quadratic polynomial (force PNG rendering)
$$ax^2 + bx + c = 0\,\!$$ $$ax^2 + bx + c = 0\,\!$$

Quadratic formula
$$x={-b\pm\sqrt{b^2-4ac} \over 2a}$$ $$x={-b\pm\sqrt{b^2-4ac} \over 2a}$$

Tall parentheses and fractions
$$2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)$$ $$2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)$$

$$S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}$$ $$S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}$$

Integrals
$$\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy$$ $$\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy$$

Summation
$$\sum_{i=0}^{n-1} i$$ $$\sum_{i=0}^{n-1} i$$

$$\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)}$$ $$\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n} {3^m\left(m\,3^n+n\,3^m\right)}$$

Differential equation
$$u'' + p(x)u' + q(x)u=f(x),\quad x>a$$ $$u'' + p(x)u' + q(x)u=f(x),\quad x>a$$

Complex numbers
$$|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)$$ $$|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)$$

Limits
$$\lim_{z\rightarrow z_0} f(z)=f(z_0)$$ $$\lim_{z\rightarrow z_0} f(z)=f(z_0)$$

Integral equation
$$\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R} \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR$$ $$\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R} \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR$$

Example
$$\phi_n(\kappa) = 0.033C_n^2\kappa^{-11/3},\quad \frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}$$ $$\phi_n(\kappa) = 0.033C_n^2\kappa^{-11/3},\quad \frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}$$

Continuation and cases
$$f(x) = \begin{cases}1 & -1 \le x < 0 \\ \frac{1}{2} & x = 0 \\ 1 - x^2 & \text{otherwise}\end{cases}$$ $$ f(x) = \begin{cases} 1 & -1 \le x < 0 \\ \frac{1}{2} & x = 0 \\ 1 - x^2 & \text{otherwise} \end{cases} $$

Prefixed subscript
$${}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z) = \sum_{n=0}^\infty \frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}\frac{z^n}{n!}$$ $${}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z) = \sum_{n=0}^\infty \frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n} \frac{z^n}{n!}$$

Fraction and small fraction
$$\frac{a}{b}\ \tfrac{a}{b}$$ $$\frac{a}{b}\ \tfrac{a}{b}$$

Area of a quadrilateral
$$S=dD\,\sin\alpha\!$$ $$S=dD\,\sin\alpha\!$$

Volume of a sphere-stand
$$V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]$$ $$V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]$$

Multiple equations
$$\begin{align} u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v)\\ v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v) \end{align}$$ $$\begin{align} u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v) \\ v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v) \end{align}$$