Namespaces
Variants
Actions

Difference between revisions of "Help:Displaying a formula"

From Encyclopedia of Mathematics
Jump to: navigation, search
 
Line 1: Line 1:
{{shortcut|WP:MATH|Help:Math}}
 
{{redirect6|WP:MATH|the WikiProject on mathematics|Wikipedia:WikiProject Mathematics|Wikipedia's mathematics style manual|Wikipedia:Manual of Style (mathematics)|the mathematics reference desk|Wikipedia:Reference desk/Mathematics}}
 
 
 
[[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 [[Portable Network Graphics|PNG]] images or simple [[HTML]] markup, depending on [[Help:Preferences#Rendering math|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 [[mw:blahtex|blahtex]] for information about current work on adding MathML support.)
 
[[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 [[Portable Network Graphics|PNG]] images or simple [[HTML]] markup, depending on [[Help:Preferences#Rendering math|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 [[mw:blahtex|blahtex]] for information about current work on adding MathML support.)
 
   
 
   
 
Although, in all cases mentioned, TeX is generated by [[Compiler|compilation]], and not by an Interpreter program, there is one essential difference between, e.g., [[Donald Knuth|Knuth]]'s [[TeX]] or [[Leslie Lamport|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 TeX images (more precisely: PNG images) for the equations, embedded into usual text, and with short TeX 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 TeX 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.
 
Although, in all cases mentioned, TeX is generated by [[Compiler|compilation]], and not by an Interpreter program, there is one essential difference between, e.g., [[Donald Knuth|Knuth]]'s [[TeX]] or [[Leslie Lamport|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 TeX images (more precisely: PNG images) for the equations, embedded into usual text, and with short TeX 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 TeX 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 [[Wikipedia:Texvc|Texvc]], which in turn passes the commands to TeX for the actual [[Rendering (computer graphics)|render]]ing. Thus, only a limited part of the full TeX language is supported; see below for details.
+
More precisely, MediaWiki filters the markup through, which in turn passes the commands to TeX for the actual [[Rendering (computer graphics)|render]]ing. Thus, only a limited part of the full TeX language is supported; see below for details.
  
 
To have math rendered in a particular MediaWiki installation, one has to set <code>$wgUseTeX = true;</code> in [[mw:Manual:LocalSettings.php|LocalSettings.php]].
 
To have math rendered in a particular MediaWiki installation, one has to set <code>$wgUseTeX = true;</code> in [[mw:Manual:LocalSettings.php|LocalSettings.php]].
Line 58: Line 55:
 
  \end{environmentname}
 
  \end{environmentname}
  
Environments supported by Wikipedia includes ''matrix'', ''align'', etc. See [[#Fractions, matrices, multilines|below]].
+
Environments supported include ''matrix'', ''align'', etc. See [[#Fractions, matrices, multilines|below]].
  
 
===Rendering===
 
===Rendering===
Line 164: Line 161:
 
# TeX 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 TeX. TeX 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. Once a formula is done correctly in TeX, 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 browsers are generally able to substitute a matching glyph from a different font family, this may not work for combined glyphs (compare&nbsp;&lsquo;&nbsp;<var>{{IPA|a&#773;}}</var>&nbsp;&rsquo; and&nbsp;&lsquo;&nbsp;<var style="font-family: serif">a&#773;</var>&nbsp;&rsquo;).{{ref|browsupp}}
 
# TeX 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 TeX. TeX 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. Once a formula is done correctly in TeX, 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 browsers are generally able to substitute a matching glyph from a different font family, this may not work for combined glyphs (compare&nbsp;&lsquo;&nbsp;<var>{{IPA|a&#773;}}</var>&nbsp;&rsquo; and&nbsp;&lsquo;&nbsp;<var style="font-family: serif">a&#773;</var>&nbsp;&rsquo;).{{ref|browsupp}}
 
# TeX formulae, by default, render larger and are usually more readable than HTML formula and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
 
# TeX formulae, by default, render larger and are usually more readable than HTML formula and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
# While TeX 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 TeX PNG in Wikipedia into simple text will return the LaTeX source.
+
# While TeX 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 TeX PNG into simple text will return the LaTeX source.
  
 
:<small>{{note|dilHTML}} unless your wikitext follows the style of point&nbsp;1.2</small>
 
:<small>{{note|dilHTML}} unless your wikitext follows the style of point&nbsp;1.2</small>
Line 1,323: Line 1,320:
 
|}
 
|}
  
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 [[Wikipedia:Manual of Style (accessibility)#Color]].
+
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.
  
 
== Formatting issues ==
 
== Formatting issues ==
Line 1,532: Line 1,529:
  
 
;Check size: Before uploading, check that the default size of the image is neither too large nor too small by opening in an [[SVG#Support in applications|SVG application]] and viewing at default size (100% scaling), otherwise adjust the <tt>-y</tt> option to <tt>dvips</tt>.
 
;Check size: Before uploading, check that the default size of the image is neither too large nor too small by opening in an [[SVG#Support in applications|SVG application]] and viewing at default size (100% scaling), otherwise adjust the <tt>-y</tt> option to <tt>dvips</tt>.
;Name: Make sure the file has a [[Wikipedia:Naming_conventions|meaningful name]].
+
;Name: Make sure the file has a meaningful name.
 
;Upload: [[commons:Special:Userlogin|Login to Wikimedia Commons]], then <span class="plainlinks">[http://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=ownwork upload the file]</span>; for the '''Summary''', give a brief description.
 
;Upload: [[commons:Special:Userlogin|Login to Wikimedia Commons]], then <span class="plainlinks">[http://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=ownwork upload the file]</span>; for the '''Summary''', give a brief description.
 
Now go to the [[Help:Image page|image page]] and add a [[commons:Commons:First steps/Quality and description#Good file descriptions|description]], including the '''source code''', using this template:
 
Now go to the [[Help:Image page|image page]] and add a [[commons:Commons:First steps/Quality and description#Good file descriptions|description]], including the '''source code''', using this template:
Line 1,556: Line 1,553:
 
* (Don't include it in the Summary section, which is just supposed to be a summary.)  
 
* (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 <tt>[[commons:Template:PD-self|PD-self]]</tt>; some use <tt>[[commons:Template:PD-self|PD-ineligible]]</tt>, especially for simple diagrams, or other licenses. Please ''do not'' use the [http://www.gnu.org/copyleft/fdl.html GFDL], as it requires the entire text of the GFDL to be attached to any document that uses the diagram.
 
;License: The most common license for commutative diagrams is <tt>[[commons:Template:PD-self|PD-self]]</tt>; some use <tt>[[commons:Template:PD-self|PD-ineligible]]</tt>, especially for simple diagrams, or other licenses. Please ''do not'' use the [http://www.gnu.org/copyleft/fdl.html 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 Wikipedia page relevant to the diagram.
+
;Description: If possible, link to a page relevant to the diagram.
 
;Category: Include <tt><nowiki>[[Category:Commutative diagrams]]</nowiki></tt>, so that it appears in [[commons:Category:Commutative diagrams]]. There are also subcategories, which you may choose to use.
 
;Category: Include <tt><nowiki>[[Category:Commutative diagrams]]</nowiki></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 <tt><nowiki>[[Image:Diagram.svg]]</nowiki></tt>
 
;Include image: Now include the image on the original page via <tt><nowiki>[[Image:Diagram.svg]]</nowiki></tt>
Line 1,597: Line 1,594:
  
 
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 mathematic 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 TeX spaces that remain invisible on the left of right of the expression and that force the PNG rendering wherever they occur in the expression, notably the TeX backspace "\!").
 
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 mathematic 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 TeX spaces that remain invisible on the left of right of the expression and that force the PNG rendering wherever they occur in the expression, notably the TeX backspace "\!").
 
==See also==
 
*[[Wikipedia:Manual of Style (mathematics)#Typesetting of mathematical formulae|Typesetting of mathematical formulae]]
 
*Proposed [[m:Music markup]] and [[Help:Musical symbols]]
 
*[[Table of mathematical symbols]]
 
*[[mw:Extension:Blahtex]], or [[Wikipedia talk:WikiProject Mathematics/Archive10#blahtex: a LaTeX to MathML converter|blahtex: a LaTeX to MathML converter for Wikipedia]]
 
*[[commons:Category:Images which should use TeX]]
 
  
 
== External links ==
 
== External links ==
{{Wikibooks|LaTeX}}
 
 
* [http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ A LaTeX tutorial].
 
* [http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ A LaTeX tutorial].
 
* {{Citation
 
* {{Citation

Latest revision as of 08:19, 1 June 2011

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, TeX is generated by compilation, and not by an Interpreter program, there is one essential difference between, e.g., Knuth's TeX or 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 TeX images (more precisely: PNG images) for the equations, embedded into usual text, and with short TeX 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 TeX 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, which in turn passes the commands to TeX for the actual rendering. Thus, only a limited part of the full TeX language is supported; see below for details.

To have math rendered in a particular MediaWiki installation, one has to set $wgUseTeX = true;</code> in [[mw:Manual:LocalSettings.php|LocalSettings.php]]. __TOC__ =='"`UNIQ--h-0--QINU`"' Basics == Math markup goes inside <code>'"`UNIQ--nowiki-00000000-QINU`"'</code>. The TeX 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 [[:Template:Tim]] for more information. ==='"`UNIQ--h-1--QINU`"' 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}... ==='"`UNIQ--h-2--QINU`"' 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. # $ % ^ & _ { } ~ \

These characters can be use all the same 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.

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 include matrix, align, etc. See below.

Rendering

The PNG images are black on white (not transparent). These 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. The css selector of the images is img.tex. It should be pointed out that solutions to most of these shortcomings have been proposed by Maynard Handley, but have not been implemented yet.

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 alt attribute for the math element. For example, <math alt="Square root of pi">\sqrt{\pi}</math> generates an image <math alt="square root of pi">\sqrt{\pi}</math> 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 \text or \mathrm. For example, \(\text{abc}\) gives \(\text{abc}\). This does not work for special characters; they are ignored unless the whole \( expression is rendered in HTML:

  • <math>\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\)
  • \(\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\,\!\)

gives:

  • \(\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\)
  • \(\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\,\!\)

TeX vs HTML

Before introducing TeX 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).

TeX syntax (forcing PNG) TeX rendering HTML syntax HTML rendering
\(\alpha\,\!\) \(\alpha\,\!\) {{math|<var>&alpha;</var>}} Template:Math
\(\sqrt{2}\) \(\sqrt{2}\) {{math|{{radical|2}}}} Template:Math
\(\sqrt{1-e^2}\) \(\sqrt{1-e^2}\!\) {{math|{{radical|1 − ''e''²}}}} Template:Math

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

&alpha; &beta; &gamma; &delta; &epsilon; &zeta;
&eta; &theta; &iota; &kappa; &lambda; &mu; &nu;
&xi; &omicron; &pi; &rho; &sigma; &sigmaf;
&tau; &upsilon; &phi; &chi; &psi; &omega;
&Gamma; &Delta; &Theta; &Lambda; &Xi; &Pi;
&Sigma; &Phi; &Psi; &Omega;
α β γ δ ε ζ
η θ ι κ λ μ ν
ξ ο π ρ σ ς
τ υ φ χ ψ ω
Γ Δ Θ Λ Ξ Π
Σ Φ Ψ Ω
&int; &sum; &prod; &radic; &minus; &plusmn; &infin;

&asymp; &prop; {{=}} &equiv; &ne; &le; &ge; &times; &middot; &divide; &part; &prime; &Prime; &nabla; &permil; &deg; &there4; &Oslash; &oslash; &isin; &notin; &cap; &cup; &sub; &sup; &sube; &supe; &not; &and; &or; &exist; &forall; &rArr; &hArr; &rarr; &harr; &uarr; &alefsym; - &ndash; &mdash;

∫ ∑ ∏ √ − ± ∞
≈ ∝ = ≡ ≠ ≤ ≥
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀
⇒ ⇔ → ↔ ↑
ℵ - – —

The project has settled on both HTML and TeX 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. The formula’s background and font size match the rest of HTML contents and the appearance respects CSS and browser settings while the typeface is conveniently altered to help you identify formulae. 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. Formulae typeset with HTML code will be accessible to client-side script links (a.k.a. scriptlets).
  2. Pages using HTML code for formulae will load faster.
  3. The HTML code, if entered diligently, will contain all semantic information to transform the equation back to TeX or any other code as needed. It can even contain differences TeX does not normally catch, e.g. {{math|''i''}} for the imaginary unit and {{math|<var>i</var>}} for an arbitrary index variable.

Pros of TeX

  1. TeX is semantically more precise than HTML.
    1. In TeX, "\(x\)" means "mathematical variable \(x\)", whereas in HTML "x" is generic and somewhat ambiguous.
    2. On the other hand, if you encode the same formula as "{{math|<var>x</var>}}", you get the same visual result Template:Math 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.
    One consequence of this is that TeX code can be transformed into HTML, but not vice-versa.[dilHTML] 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 TeX. 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. Another consequence of this is that TeX can be converted to MathML for browsers which support it, thus keeping its semantics and allowing the rendering to be better suited for the reader’s graphic device.
  2. TeX 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 TeX. TeX 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. Once a formula is done correctly in TeX, 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 browsers are generally able to substitute a matching glyph from a different font family, this may not work for combined glyphs (compare ‘ Template:IPA ’ and ‘  ’).[browsupp]
  3. TeX formulae, by default, render larger and are usually more readable than HTML formula and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
  4. While TeX 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 TeX PNG into simple text will return the LaTeX source.
Template:Note unless your wikitext follows the style of point 1.2
Template:Note 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. &ndash; for ‘–’ and &minus; for ‘−’).

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

Functions, symbols, special characters

Accents/diacritics

\dot{a}, \ddot{a}, \acute{a}, \grave{a} \(\dot{a}, \ddot{a}, \acute{a}, \grave{a} \!\)
\check{a}, \breve{a}, \tilde{a}, \bar{a} \(\check{a}, \breve{a}, \tilde{a}, \bar{a} \!\)
\hat{a}, \widehat{a}, \vec{a} \(\hat{a}, \widehat{a}, \vec{a} \!\)

Standard functions

\exp_a b = a^b, \exp b = e^b, 10^m \(\exp_a b = a^b, \exp b = e^b, 10^m \!\)
\ln c, \lg d = \log e, \log_{10} f \(\ln c, \lg d = \log e, \log_{10} f \!\)
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f \(\sin a, \cos b, \tan c, \cot d, \sec e, \csc f\!\)
\arcsin h, \arccos i, \arctan j \(\arcsin h, \arccos i, \arctan j \!\)
\sinh k, \cosh l, \tanh m, \coth n \(\sinh k, \cosh l, \tanh m, \coth n \!\)
\operatorname{sh}\,k, \operatorname{ch}\,l, \operatorname{th}\,m, \operatorname{coth}\,n \(\operatorname{sh}\,k, \operatorname{ch}\,l, \operatorname{th}\,m, \operatorname{coth}\,n \!\)
\operatorname{argsh}\,o, \operatorname{argch}\,p, \operatorname{argth}\,q \(\operatorname{argsh}\,o, \operatorname{argch}\,p, \operatorname{argth}\,q \!\)
\sgn r, \left\vert s \right\vert \(\sgn r, \left\vert s \right\vert \!\)

Bounds

\min x, \max y, \inf s, \sup t \(\min x, \max y, \inf s, \sup t \!\)
\lim u, \liminf v, \limsup w \(\lim u, \liminf v, \limsup w \!\)
\dim p, \deg q, \det m, \ker\phi \(\dim p, \deg q, \det m, \ker\phi \!\)

Projections

\Pr j, \hom l, \lVert z \rVert, \arg z \(\Pr j, \hom l, \lVert z \rVert, \arg z \!\)

Differentials and derivatives

dt, \operatorname{d}t, \partial t, \nabla\psi \(dt, \operatorname{d}t, \partial t, \nabla\psi\!\)
\operatorname{d}y/\operatorname{d}x, {\operatorname{d}y\over\operatorname{d}x}, {\partial^2\over\partial x_1\partial x_2}y \(\operatorname{d}y/\operatorname{d}x,{\operatorname{d}y\over\operatorname{d}x}, {\partial^2\over\partial x_1\partial x_2}y \!\)
\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y \(\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y\)

Letter-like symbols or constants

\infty, \alef, \complement, \backepsilon, \eth, \Finv, \hbar \(\infty, \alef, \complement, \backepsilon, \eth, \Finv, \hbar \!\)
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \(\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!\)

Modular arithmetic

s_k \equiv 0 \pmod{m} \(s_k \equiv 0 \pmod{m} \!\)
a\,\bmod\,b \(a\,\bmod\,b \!\)
\gcd(m, n), \operatorname{lcm}(m, n) \(\gcd(m, n), \operatorname{lcm}(m, n)\)
\mid, \nmid, \shortmid, \nshortmid \(\mid, \nmid, \shortmid, \nshortmid \!\)

Radicals

\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \(\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \!\)

Operators

+, -, \pm, \mp, \dotplus \(+, -, \pm, \mp, \dotplus \!\)
\times, \div, \divideontimes, /, \backslash \(\times, \div, \divideontimes, /, \backslash \!\)
\cdot, * \ast, \star, \circ, \bullet \(\cdot, * \ast, \star, \circ, \bullet \!\)
\boxplus, \boxminus, \boxtimes, \boxdot \(\boxplus, \boxminus, \boxtimes, \boxdot \!\)
\oplus, \ominus, \otimes, \oslash, \odot \(\oplus, \ominus, \otimes, \oslash, \odot\!\)
\circleddash, \circledcirc, \circledast \(\circleddash, \circledcirc, \circledast \!\)
\bigoplus, \bigotimes, \bigodot \(\bigoplus, \bigotimes, \bigodot \!\)

Sets

\{ \}, \O \empty \emptyset, \varnothing \(\{ \}, \O \empty \emptyset, \varnothing \!\)
\in, \notin \not\in, \ni, \not\ni \(\in, \notin \not\in, \ni, \not\ni \!\)
\cap, \Cap, \sqcap, \bigcap, \setminus, \smallsetminus \(\cap, \Cap, \sqcap, \bigcap, \setminus, \smallsetminus \!\)
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus \(\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus \!\)
\subset, \Subset, \sqsubset \(\subset, \Subset, \sqsubset \!\)
\supset, \Supset, \sqsupset \(\supset, \Supset, \sqsupset \!\)
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq \(\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq \!\)
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq \(\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq \!\)
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq \(\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq \!\)
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq \(\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq \!\)

Relations

=, \ne \neq, \equiv, \not\equiv \(=, \ne \neq, \equiv, \not\equiv \!\)
\doteq, \overset{\underset{\mathrm{def}}{}}{=}, := \(\doteq, \overset{\underset{\mathrm{def}}{}}{=}, := \!\)
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong \(\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong \!\)
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto \(\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto \!\)
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot \(<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot \!\)
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot \(>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot \!\)
\le \leq, \lneq, \leqq, \nleqq, \lneqq, \lvertneqq \(\le \leq, \lneq, \leqq, \nleqq, \lneqq, \lvertneqq \!\)
\ge \geq, \gneq, \geqq, \ngeqq, \gneqq, \gvertneqq \(\ge \geq, \gneq, \geqq, \ngeqq, \gneqq, \gvertneqq \!\)
\lessgtr \lesseqgtr \lesseqqgtr \gtrless \gtreqless \gtreqqless \(\lessgtr \lesseqgtr \lesseqqgtr \gtrless \gtreqless \gtreqqless \!\)
\leqslant, \nleqslant, \eqslantless \(\leqslant, \nleqslant, \eqslantless \!\)
\geqslant, \ngeqslant, \eqslantgtr \(\geqslant, \ngeqslant, \eqslantgtr \!\)
\lesssim, \lnsim, \lessapprox, \lnapprox \(\lesssim, \lnsim, \lessapprox, \lnapprox \!\)
\gtrsim, \gnsim, \gtrapprox, \gnapprox \( \gtrsim, \gnsim, \gtrapprox, \gnapprox \,\)
\prec, \nprec, \preceq, \npreceq, \precneqq \(\prec, \nprec, \preceq, \npreceq, \precneqq \!\)
\succ, \nsucc, \succeq, \nsucceq, \succneqq \(\succ, \nsucc, \succeq, \nsucceq, \succneqq \!\)
\preccurlyeq, \curlyeqprec \(\preccurlyeq, \curlyeqprec \,\)
\succcurlyeq, \curlyeqsucc \(\succcurlyeq, \curlyeqsucc \,\)
\precsim, \precnsim, \precapprox, \precnapprox \(\precsim, \precnsim, \precapprox, \precnapprox \,\)
\succsim, \succnsim, \succapprox, \succnapprox \(\succsim, \succnsim, \succapprox, \succnapprox \,\)

Geometric

\parallel, \nparallel, \shortparallel, \nshortparallel \(\parallel, \nparallel, \shortparallel, \nshortparallel \!\)
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ \(\perp, \angle, \sphericalangle, \measuredangle, 45^\circ \!\)
\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar \(\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar \!\)
\bigcirc, \triangle \bigtriangleup, \bigtriangledown \(\bigcirc, \triangle \bigtriangleup, \bigtriangledown \!\)
\vartriangle, \triangledown \(\vartriangle, \triangledown\!\)
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \(\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!\)

Logic

\forall, \exists, \nexists \(\forall, \exists, \nexists \!\)
\therefore, \because, \And \(\therefore, \because, \And \!\)
\or \lor \vee, \curlyvee, \bigvee \(\or \lor \vee, \curlyvee, \bigvee \!\)
\and \land \wedge, \curlywedge, \bigwedge \(\and \land \wedge, \curlywedge, \bigwedge \!\)
\bar{q}, \overline{q}, \lnot \neg, \not\operatorname{R}, \bot, \top \(\bar{q}, \overline{q}, \lnot \neg, \not\operatorname{R}, \bot, \top\!\)
\vdash \dashv, \vDash, \Vdash, \models \(\vdash \dashv, \vDash, \Vdash, \models \!\)
\Vvdash \nvdash \nVdash \nvDash \nVDash \(\Vvdash \nvdash \nVdash \nvDash \nVDash \!\)
\ulcorner \urcorner \llcorner \lrcorner \(\ulcorner \urcorner \llcorner \lrcorner \,\)

Arrows

\Rrightarrow, \Lleftarrow \(\Rrightarrow, \Lleftarrow \!\)
\Rightarrow, \nRightarrow, \Longrightarrow \implies \(\Rightarrow, \nRightarrow, \Longrightarrow \implies\!\)
\Leftarrow, \nLeftarrow, \Longleftarrow \(\Leftarrow, \nLeftarrow, \Longleftarrow \!\)
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff \(\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff \!\)
\Uparrow, \Downarrow, \Updownarrow \(\Uparrow, \Downarrow, \Updownarrow \!\)
\rightarrow \to, \nrightarrow, \longrightarrow \(\rightarrow \to, \nrightarrow, \longrightarrow\!\)
\leftarrow \gets, \nleftarrow, \longleftarrow \(\leftarrow \gets, \nleftarrow, \longleftarrow\!\)
\leftrightarrow, \nleftrightarrow, \longleftrightarrow \(\leftrightarrow, \nleftrightarrow, \longleftrightarrow \!\)
\uparrow, \downarrow, \updownarrow \(\uparrow, \downarrow, \updownarrow \!\)
\nearrow, \swarrow, \nwarrow, \searrow \(\nearrow, \swarrow, \nwarrow, \searrow \!\)
\mapsto, \longmapsto \(\mapsto, \longmapsto \!\)
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons \(\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons \,\!\)
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright \(\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright \,\!\)
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft \(\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft \,\!\)
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow \(\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow \!\)

Special

\amalg \P \S \% \dagger \ddagger \ldots \cdots \(\amalg \P \S \% \dagger \ddagger \ldots \cdots \!\)
\smile \frown \wr \triangleleft \triangleright \(\smile \frown \wr \triangleleft \triangleright\!\)
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \(\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!\)

Unsorted (new stuff)

\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes \(\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes \!\)
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq \(\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq \!\)
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork \(\intercal \barwedge \veebar \doublebarwedge \between \pitchfork \!\)
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright \(\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright \!\)
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq \(\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq \!\)

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

Larger expressions

Subscripts, superscripts, integrals

Feature Syntax How it looks rendered
HTML PNG
Superscript a^2 \(a^2\) \(a^2 \,\!\)
Subscript a_2 \(a_2\) \(a_2 \,\!\)
Grouping 10^{30} a^{2+2} \(10^{30} a^{2+2}\) \(10^{30} a^{2+2}\,\!\)
a_{i,j} b_{f'} \(a_{i,j} b_{f'}\) \(a_{i,j} b_{f'}\,\!\)
Combining sub & super without and with horizontal separation x_2^3 \(x_2^3 \,\!\)
{x_2}^3 \({x_2}^3 \,\!\)
Super super 10^{10^{8}} \(10^{10^{8}} \,\!\)
Preceding and/or additional sub & super \sideset{_1^2}{_3^4}\prod_a^b \(\sideset{_1^2}{_3^4}\prod_a^b \,\!\)
{}_1^2\!\Omega_3^4 \({}_1^2\!\Omega_3^4 \,\!\)
Stacking \overset{\alpha}{\omega} \(\overset{\alpha}{\omega} \,\!\)
\underset{\alpha}{\omega} \(\underset{\alpha}{\omega} \,\!\)
\overset{\alpha}{\underset{\gamma}{\omega}} \(\overset{\alpha}{\underset{\gamma}{\omega}} \,\!\)
\stackrel{\alpha}{\omega} \(\stackrel{\alpha}{\omega} \,\!\)
Derivative (f in italics may overlap primes in HTML) x', y'', f', f'' \(x', y'', f', f''\) \(x', y'', f', f'' \!\)
Derivative (wrong in HTML) x^\prime, y^{\prime\prime} \(x^\prime, y^{\prime\prime}\) \(x^\prime, y^{\prime\prime} \!\)
Derivative (wrong in PNG) x\prime, y\prime\prime \(x\prime, y\prime\prime\) \(x\prime, y\prime\prime \!\)
Derivative dots \dot{x}, \ddot{x} \(\dot{x}, \ddot{x}\)
Underlines, overlines, vectors \hat a \ \bar b \ \vec c \( \hat a \ \bar b \ \vec c\)
\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f} \( \overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f}\)
\overline{g h i} \ \underline{j k l} \( \overline{g h i} \ \underline{j k l}\)
Arrows A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C \( A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C\)
Overbraces \overbrace{ 1+2+\cdots+100 }^{5050} \(\overbrace{ 1+2+\cdots+100 }^{5050}\)
Underbraces \underbrace{ a+b+\cdots+z }_{26} \(\underbrace{ a+b+\cdots+z }_{26}\)
Sum \sum_{k=1}^N k^2 \(\sum_{k=1}^N k^2\)
Sum (force \textstyle) \textstyle \sum_{k=1}^N k^2 \(\textstyle \sum_{k=1}^N k^2\)
Sum in a fraction (default \textstyle) \frac{\sum_{k=1}^N k^2}{a} \(\frac{\sum_{k=1}^N k^2}{a}\)
Sum in a fraction (force \displaystyle) \frac{\displaystyle \sum_{k=1}^N k^2}{a} \(\frac{\displaystyle \sum_{k=1}^N k^2}{a}\)
Product \prod_{i=1}^N x_i \(\prod_{i=1}^N x_i\)
Product (force \textstyle) \textstyle \prod_{i=1}^N x_i \(\textstyle \prod_{i=1}^N x_i\)
Coproduct \coprod_{i=1}^N x_i \(\coprod_{i=1}^N x_i\)
Coproduct (force \textstyle) \textstyle \coprod_{i=1}^N x_i \(\textstyle \coprod_{i=1}^N x_i\)
Limit \lim_{n \to \infty}x_n \(\lim_{n \to \infty}x_n\)
Limit (force \textstyle) \textstyle \lim_{n \to \infty}x_n \(\textstyle \lim_{n \to \infty}x_n\)
Integral \int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx \(\int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx\)
Integral (alternative limits style) \int_{1}^{3}\frac{e^3/x}{x^2}\, dx \(\int_{1}^{3}\frac{e^3/x}{x^2}\, dx\)
Integral (force \textstyle) \textstyle \int\limits_{-N}^{N} e^x\, dx \(\textstyle \int\limits_{-N}^{N} e^x\, dx\)
Integral (force \textstyle, alternative limits style) \textstyle \int_{-N}^{N} e^x\, dx \(\textstyle \int_{-N}^{N} e^x\, dx\)
Double integral \iint\limits_D \, dx\,dy \(\iint\limits_D \, dx\,dy\)
Triple integral \iiint\limits_E \, dx\,dy\,dz \(\iiint\limits_E \, dx\,dy\,dz\)
Quadruple integral \iiiint\limits_F \, dx\,dy\,dz\,dt \(\iiiint\limits_F \, dx\,dy\,dz\,dt\)
Line or path integral \int_{(x,y)\in C} x^3\, dx + 4y^2\, dy \(\int_{(x,y)\in C} x^3\, dx + 4y^2\, dy\)
Closed line or path integral \oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy \(\oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy\)
Intersections \bigcap_{i=_1}^n E_i \(\bigcap_{i=_1}^n E_i\)
Unions \bigcup_{i=_1}^n E_i \(\bigcup_{i=_1}^n E_i\)

Fractions, matrices, multilines

Feature Syntax How it looks rendered
Fractions \frac{2}{4}=0.5 or {2 \over 4}=0.5 \(\frac{2}{4}=0.5\)
Small fractions \tfrac{2}{4} = 0.5 \(\tfrac{2}{4} = 0.5\)
Large (normal) fractions \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a \(\dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a\)
Large (nested) fractions \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a \(\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a\)
Binomial coefficients \binom{n}{k} \(\binom{n}{k}\)
Small binomial coefficients \tbinom{n}{k} \(\tbinom{n}{k}\)
Large (normal) binomial coefficients \dbinom{n}{k} \(\dbinom{n}{k}\)
Matrices
\begin{matrix}
 x & y \\
 z & v
\end{matrix}
\(\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{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} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} \)
\begin{Bmatrix}
 x & y \\
 z & v
\end{Bmatrix}
\(\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}\)
\begin{pmatrix}
 x & y \\
 z & v
\end{pmatrix}
\(\begin{pmatrix} x & y \\ z & v \end{pmatrix}\)
\bigl( \begin{smallmatrix}
 a&b\\ c&d
\end{smallmatrix} \bigr)
\( \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}
\(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{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}
\( \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}
\(\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}
\(\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) \,\!\)
\(= \sum_{n=0}^\infty a_n x^n \)
\(= a_0+a_1x+a_2x^2+\cdots\)

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

Simultaneous equations
\begin{cases}
 3x + 5y + z \\
 7x - 2y + 4z \\
 -6x + 3y + 2z
\end{cases}
\(\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}
\( \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

Feature Syntax How it looks rendered
Bad ( \frac{1}{2} ) \(( \frac{1}{2} )\)
Good \left ( \frac{1}{2} \right ) \(\left ( \frac{1}{2} \right )\)

You can use various delimiters with \left and \right:

Feature Syntax How it looks rendered
Parentheses \left ( \frac{a}{b} \right ) \(\left ( \frac{a}{b} \right )\)
Brackets \left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack \(\left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack\)
Braces \left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace \(\left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace\)
Angle brackets \left \langle \frac{a}{b} \right \rangle \(\left \langle \frac{a}{b} \right \rangle\)
Bars and double bars \left | \frac{a}{b} \right \vert \left \Vert \frac{c}{d} \right \| \(\left | \frac{a}{b} \right \vert \left \Vert \frac{c}{d} \right \|\)
Floor and ceiling functions: \left \lfloor \frac{a}{b} \right \rfloor \left \lceil \frac{c}{d} \right \rceil \(\left \lfloor \frac{a}{b} \right \rfloor \left \lceil \frac{c}{d} \right \rceil\)
Slashes and backslashes \left / \frac{a}{b} \right \backslash \(\left / \frac{a}{b} \right \backslash\)
Up, down and up-down arrows \left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow \(\left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow\)
Delimiters can be mixed,
as long as \left and \right match
\left [ 0,1 \right )
\left \langle \psi \right |
\(\left [ 0,1 \right )\)
\(\left \langle \psi \right |\)
Use \left. and \right. if you don't
want a delimiter to appear:
\left . \frac{A}{B} \right \} \to X \(\left . \frac{A}{B} \right \} \to X\)
Size of the delimiters \big( \Big( \bigg( \Bigg( \dots \Bigg] \bigg] \Big] \big]/ \(\big( \Big( \bigg( \Bigg( \dots \Bigg] \bigg] \Big] \big]\)
\big\{ \Big\{ \bigg\{ \Bigg\{ \dots \Bigg\rangle \bigg\rangle \Big\rangle \big\rangle \(\big\{ \Big\{ \bigg\{ \Bigg\{ \dots \Bigg\rangle \bigg\rangle \Big\rangle \big\rangle\)
\big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| \(\big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big|\)
\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor \dots \Bigg\rceil \bigg\rceil \Big\rceil \big\rceil \(\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor \dots \Bigg\rceil \bigg\rceil \Big\rceil \big\rceil\)
\big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \(\big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow\)
\big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \(\big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow\)
\big / \Big / \bigg / \Bigg / \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \(\big / \Big / \bigg / \Bigg / \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash\)

Equation numbering

The templates Template:Tl and Template:Tl can be used to number equations. The template Template:Tl can be used to refer to a numbered equation from surrounding text. For example, the following syntax:


{{NumBlk|:|\(x^2 + y^2 + z^2 = 1 \,\)|{{EquationRef|1}}}}


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

Template:NumBlk

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


As seen in equation ({{EquationNote|1}}), blah blah blah...


The result looks like this:


As seen in equation (Template:EquationNote), blah blah blah...


Note that the equation number produced by Template:Tl 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.

Greek alphabet
\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \(\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \!\)
\Eta \Theta \Iota \Kappa \Lambda \Mu \(\Eta \Theta \Iota \Kappa \Lambda \Mu \!\)
\Nu \Xi \Pi \Rho \Sigma \Tau \(\Nu \Xi \Pi \Rho \Sigma \Tau \!\)
\Upsilon \Phi \Chi \Psi \Omega \(\Upsilon \Phi \Chi \Psi \Omega \!\)
\alpha \beta \gamma \delta \epsilon \zeta \(\alpha \beta \gamma \delta \epsilon \zeta \!\)
\eta \theta \iota \kappa \lambda \mu \(\eta \theta \iota \kappa \lambda \mu \!\)
\nu \xi \pi \rho \sigma \tau \(\nu \xi \pi \rho \sigma \tau \!\)
\upsilon \phi \chi \psi \omega \(\upsilon \phi \chi \psi \omega \!\)
\varepsilon \digamma \varkappa \varpi \(\varepsilon \digamma \varkappa \varpi \!\)
\varrho \varsigma \vartheta \varphi \(\varrho \varsigma \vartheta \varphi \!\)
Blackboard bold/scripts
\mathbb{A} \mathbb{B} \mathbb{C} \mathbb{D} \mathbb{E} \mathbb{F} \mathbb{G} \(\mathbb{A} \mathbb{B} \mathbb{C} \mathbb{D} \mathbb{E} \mathbb{F} \mathbb{G} \!\)
\mathbb{H} \mathbb{I} \mathbb{J} \mathbb{K} \mathbb{L} \mathbb{M} \(\mathbb{H} \mathbb{I} \mathbb{J} \mathbb{K} \mathbb{L} \mathbb{M} \!\)
\mathbb{N} \mathbb{O} \mathbb{P} \mathbb{Q} \mathbb{R} \mathbb{S} \mathbb{T} \(\mathbb{N} \mathbb{O} \mathbb{P} \mathbb{Q} \mathbb{R} \mathbb{S} \mathbb{T} \!\)
\mathbb{U} \mathbb{V} \mathbb{W} \mathbb{X} \mathbb{Y} \mathbb{Z} \(\mathbb{U} \mathbb{V} \mathbb{W} \mathbb{X} \mathbb{Y} \mathbb{Z} \!\)
Boldface
\mathbf{A} \mathbf{B} \mathbf{C} \mathbf{D} \mathbf{E} \mathbf{F} \mathbf{G} \(\mathbf{A} \mathbf{B} \mathbf{C} \mathbf{D} \mathbf{E} \mathbf{F} \mathbf{G} \!\)
\mathbf{H} \mathbf{I} \mathbf{J} \mathbf{K} \mathbf{L} \mathbf{M} \(\mathbf{H} \mathbf{I} \mathbf{J} \mathbf{K} \mathbf{L} \mathbf{M} \!\)
\mathbf{N} \mathbf{O} \mathbf{P} \mathbf{Q} \mathbf{R} \mathbf{S} \mathbf{T} \(\mathbf{N} \mathbf{O} \mathbf{P} \mathbf{Q} \mathbf{R} \mathbf{S} \mathbf{T} \!\)
\mathbf{U} \mathbf{V} \mathbf{W} \mathbf{X} \mathbf{Y} \mathbf{Z} \(\mathbf{U} \mathbf{V} \mathbf{W} \mathbf{X} \mathbf{Y} \mathbf{Z} \!\)
\mathbf{a} \mathbf{b} \mathbf{c} \mathbf{d} \mathbf{e} \mathbf{f} \mathbf{g} \(\mathbf{a} \mathbf{b} \mathbf{c} \mathbf{d} \mathbf{e} \mathbf{f} \mathbf{g} \!\)
\mathbf{h} \mathbf{i} \mathbf{j} \mathbf{k} \mathbf{l} \mathbf{m} \(\mathbf{h} \mathbf{i} \mathbf{j} \mathbf{k} \mathbf{l} \mathbf{m} \!\)
\mathbf{n} \mathbf{o} \mathbf{p} \mathbf{q} \mathbf{r} \mathbf{s} \mathbf{t} \(\mathbf{n} \mathbf{o} \mathbf{p} \mathbf{q} \mathbf{r} \mathbf{s} \mathbf{t} \!\)
\mathbf{u} \mathbf{v} \mathbf{w} \mathbf{x} \mathbf{y} \mathbf{z} \(\mathbf{u} \mathbf{v} \mathbf{w} \mathbf{x} \mathbf{y} \mathbf{z} \!\)
\mathbf{0} \mathbf{1} \mathbf{2} \mathbf{3} \mathbf{4} \(\mathbf{0} \mathbf{1} \mathbf{2} \mathbf{3} \mathbf{4} \!\)
\mathbf{5} \mathbf{6} \mathbf{7} \mathbf{8} \mathbf{9} \(\mathbf{5} \mathbf{6} \mathbf{7} \mathbf{8} \mathbf{9} \!\)
Boldface (Greek)
\boldsymbol{\Alpha} \boldsymbol{\Beta} \boldsymbol{\Gamma} \boldsymbol{\Delta} \boldsymbol{\Epsilon} \boldsymbol{\Zeta} \(\boldsymbol{\Alpha} \boldsymbol{\Beta} \boldsymbol{\Gamma} \boldsymbol{\Delta} \boldsymbol{\Epsilon} \boldsymbol{\Zeta} \!\)
\boldsymbol{\Eta} \boldsymbol{\Theta} \boldsymbol{\Iota} \boldsymbol{\Kappa} \boldsymbol{\Lambda} \boldsymbol{\Mu} \(\boldsymbol{\Eta} \boldsymbol{\Theta} \boldsymbol{\Iota} \boldsymbol{\Kappa} \boldsymbol{\Lambda} \boldsymbol{\Mu} \!\)
\boldsymbol{\Nu} \boldsymbol{\Xi} \boldsymbol{\Pi} \boldsymbol{\Rho} \boldsymbol{\Sigma} \boldsymbol{\Tau} \(\boldsymbol{\Nu} \boldsymbol{\Xi} \boldsymbol{\Pi} \boldsymbol{\Rho} \boldsymbol{\Sigma} \boldsymbol{\Tau} \!\)
\boldsymbol{\Upsilon} \boldsymbol{\Phi} \boldsymbol{\Chi} \boldsymbol{\Psi} \boldsymbol{\Omega} \(\boldsymbol{\Upsilon} \boldsymbol{\Phi} \boldsymbol{\Chi} \boldsymbol{\Psi} \boldsymbol{\Omega} \!\)
\boldsymbol{\alpha} \boldsymbol{\beta} \boldsymbol{\gamma} \boldsymbol{\delta} \boldsymbol{\epsilon} \boldsymbol{\zeta} \(\boldsymbol{\alpha} \boldsymbol{\beta} \boldsymbol{\gamma} \boldsymbol{\delta} \boldsymbol{\epsilon} \boldsymbol{\zeta} \!\)
\boldsymbol{\eta} \boldsymbol{\theta} \boldsymbol{\iota} \boldsymbol{\kappa} \boldsymbol{\lambda} \boldsymbol{\mu} \(\boldsymbol{\eta} \boldsymbol{\theta} \boldsymbol{\iota} \boldsymbol{\kappa} \boldsymbol{\lambda} \boldsymbol{\mu} \!\)
\boldsymbol{\nu} \boldsymbol{\xi} \boldsymbol{\pi} \boldsymbol{\rho} \boldsymbol{\sigma} \boldsymbol{\tau} \(\boldsymbol{\nu} \boldsymbol{\xi} \boldsymbol{\pi} \boldsymbol{\rho} \boldsymbol{\sigma} \boldsymbol{\tau} \!\)
\boldsymbol{\upsilon} \boldsymbol{\phi} \boldsymbol{\chi} \boldsymbol{\psi} \boldsymbol{\omega} \(\boldsymbol{\upsilon} \boldsymbol{\phi} \boldsymbol{\chi} \boldsymbol{\psi} \boldsymbol{\omega} \!\)
\boldsymbol{\varepsilon} \boldsymbol{\digamma} \boldsymbol{\varkappa} \boldsymbol{\varpi} \(\boldsymbol{\varepsilon} \boldsymbol{\digamma} \boldsymbol{\varkappa} \boldsymbol{\varpi} \!\)
\boldsymbol{\varrho} \boldsymbol{\varsigma} \boldsymbol{\vartheta} \boldsymbol{\varphi} \(\boldsymbol{\varrho} \boldsymbol{\varsigma} \boldsymbol{\vartheta} \boldsymbol{\varphi} \!\)
Italics
\mathit{A} \mathit{B} \mathit{C} \mathit{D} \mathit{E} \mathit{F} \mathit{G} \(\mathit{A} \mathit{B} \mathit{C} \mathit{D} \mathit{E} \mathit{F} \mathit{G} \!\)
\mathit{H} \mathit{I} \mathit{J} \mathit{K} \mathit{L} \mathit{M} \(\mathit{H} \mathit{I} \mathit{J} \mathit{K} \mathit{L} \mathit{M} \!\)
\mathit{N} \mathit{O} \mathit{P} \mathit{Q} \mathit{R} \mathit{S} \mathit{T} \(\mathit{N} \mathit{O} \mathit{P} \mathit{Q} \mathit{R} \mathit{S} \mathit{T} \!\)
\mathit{U} \mathit{V} \mathit{W} \mathit{X} \mathit{Y} \mathit{Z} \(\mathit{U} \mathit{V} \mathit{W} \mathit{X} \mathit{Y} \mathit{Z} \!\)
\mathit{a} \mathit{b} \mathit{c} \mathit{d} \mathit{e} \mathit{f} \mathit{g} \(\mathit{a} \mathit{b} \mathit{c} \mathit{d} \mathit{e} \mathit{f} \mathit{g} \!\)
\mathit{h} \mathit{i} \mathit{j} \mathit{k} \mathit{l} \mathit{m} \(\mathit{h} \mathit{i} \mathit{j} \mathit{k} \mathit{l} \mathit{m} \!\)
\mathit{n} \mathit{o} \mathit{p} \mathit{q} \mathit{r} \mathit{s} \mathit{t} \(\mathit{n} \mathit{o} \mathit{p} \mathit{q} \mathit{r} \mathit{s} \mathit{t} \!\)
\mathit{u} \mathit{v} \mathit{w} \mathit{x} \mathit{y} \mathit{z} \(\mathit{u} \mathit{v} \mathit{w} \mathit{x} \mathit{y} \mathit{z} \!\)
\mathit{0} \mathit{1} \mathit{2} \mathit{3} \mathit{4} \(\mathit{0} \mathit{1} \mathit{2} \mathit{3} \mathit{4} \!\)
\mathit{5} \mathit{6} \mathit{7} \mathit{8} \mathit{9} \(\mathit{5} \mathit{6} \mathit{7} \mathit{8} \mathit{9} \!\)
Roman typeface
\mathrm{A} \mathrm{B} \mathrm{C} \mathrm{D} \mathrm{E} \mathrm{F} \mathrm{G} \(\mathrm{A} \mathrm{B} \mathrm{C} \mathrm{D} \mathrm{E} \mathrm{F} \mathrm{G} \!\)
\mathrm{H} \mathrm{I} \mathrm{J} \mathrm{K} \mathrm{L} \mathrm{M} \(\mathrm{H} \mathrm{I} \mathrm{J} \mathrm{K} \mathrm{L} \mathrm{M} \!\)
\mathrm{N} \mathrm{O} \mathrm{P} \mathrm{Q} \mathrm{R} \mathrm{S} \mathrm{T} \(\mathrm{N} \mathrm{O} \mathrm{P} \mathrm{Q} \mathrm{R} \mathrm{S} \mathrm{T} \!\)
\mathrm{U} \mathrm{V} \mathrm{W} \mathrm{X} \mathrm{Y} \mathrm{Z} \(\mathrm{U} \mathrm{V} \mathrm{W} \mathrm{X} \mathrm{Y} \mathrm{Z} \!\)
\mathrm{a} \mathrm{b} \mathrm{c} \mathrm{d} \mathrm{e} \mathrm{f} \mathrm{g} \(\mathrm{a} \mathrm{b} \mathrm{c} \mathrm{d} \mathrm{e} \mathrm{f} \mathrm{g} \!\)
\mathrm{h} \mathrm{i} \mathrm{j} \mathrm{k} \mathrm{l} \mathrm{m} \(\mathrm{h} \mathrm{i} \mathrm{j} \mathrm{k} \mathrm{l} \mathrm{m} \!\)
\mathrm{n} \mathrm{o} \mathrm{p} \mathrm{q} \mathrm{r} \mathrm{s} \mathrm{t} \(\mathrm{n} \mathrm{o} \mathrm{p} \mathrm{q} \mathrm{r} \mathrm{s} \mathrm{t} \!\)
\mathrm{u} \mathrm{v} \mathrm{w} \mathrm{x} \mathrm{y} \mathrm{z} \(\mathrm{u} \mathrm{v} \mathrm{w} \mathrm{x} \mathrm{y} \mathrm{z} \!\)
\mathrm{0} \mathrm{1} \mathrm{2} \mathrm{3} \mathrm{4} \(\mathrm{0} \mathrm{1} \mathrm{2} \mathrm{3} \mathrm{4} \!\)
\mathrm{5} \mathrm{6} \mathrm{7} \mathrm{8} \mathrm{9} \(\mathrm{5} \mathrm{6} \mathrm{7} \mathrm{8} \mathrm{9} \!\)
Fraktur typeface
\mathfrak{A} \mathfrak{B} \mathfrak{C} \mathfrak{D} \mathfrak{E} \mathfrak{F} \mathfrak{G} \(\mathfrak{A} \mathfrak{B} \mathfrak{C} \mathfrak{D} \mathfrak{E} \mathfrak{F} \mathfrak{G} \!\)
\mathfrak{H} \mathfrak{I} \mathfrak{J} \mathfrak{K} \mathfrak{L} \mathfrak{M} \(\mathfrak{H} \mathfrak{I} \mathfrak{J} \mathfrak{K} \mathfrak{L} \mathfrak{M} \!\)
\mathfrak{N} \mathfrak{O} \mathfrak{P} \mathfrak{Q} \mathfrak{R} \mathfrak{S} \mathfrak{T} \(\mathfrak{N} \mathfrak{O} \mathfrak{P} \mathfrak{Q} \mathfrak{R} \mathfrak{S} \mathfrak{T} \!\)
\mathfrak{U} \mathfrak{V} \mathfrak{W} \mathfrak{X} \mathfrak{Y} \mathfrak{Z} \(\mathfrak{U} \mathfrak{V} \mathfrak{W} \mathfrak{X} \mathfrak{Y} \mathfrak{Z} \!\)
\mathfrak{a} \mathfrak{b} \mathfrak{c} \mathfrak{d} \mathfrak{e} \mathfrak{f} \mathfrak{g} \(\mathfrak{a} \mathfrak{b} \mathfrak{c} \mathfrak{d} \mathfrak{e} \mathfrak{f} \mathfrak{g} \!\)
\mathfrak{h} \mathfrak{i} \mathfrak{j} \mathfrak{k} \mathfrak{l} \mathfrak{m} \(\mathfrak{h} \mathfrak{i} \mathfrak{j} \mathfrak{k} \mathfrak{l} \mathfrak{m} \!\)
\mathfrak{n} \mathfrak{o} \mathfrak{p} \mathfrak{q} \mathfrak{r} \mathfrak{s} \mathfrak{t} \(\mathfrak{n} \mathfrak{o} \mathfrak{p} \mathfrak{q} \mathfrak{r} \mathfrak{s} \mathfrak{t} \!\)
\mathfrak{u} \mathfrak{v} \mathfrak{w} \mathfrak{x} \mathfrak{y} \mathfrak{z} \(\mathfrak{u} \mathfrak{v} \mathfrak{w} \mathfrak{x} \mathfrak{y} \mathfrak{z} \!\)
\mathfrak{0} \mathfrak{1} \mathfrak{2} \mathfrak{3} \mathfrak{4} \(\mathfrak{0} \mathfrak{1} \mathfrak{2} \mathfrak{3} \mathfrak{4} \!\)
\mathfrak{5} \mathfrak{6} \mathfrak{7} \mathfrak{8} \mathfrak{9} \(\mathfrak{5} \mathfrak{6} \mathfrak{7} \mathfrak{8} \mathfrak{9} \!\)
Calligraphy/script
\mathcal{A} \mathcal{B} \mathcal{C} \mathcal{D} \mathcal{E} \mathcal{F} \mathcal{G} \(\mathcal{A} \mathcal{B} \mathcal{C} \mathcal{D} \mathcal{E} \mathcal{F} \mathcal{G} \!\)
\mathcal{H} \mathcal{I} \mathcal{J} \mathcal{K} \mathcal{L} \mathcal{M} \(\mathcal{H} \mathcal{I} \mathcal{J} \mathcal{K} \mathcal{L} \mathcal{M} \!\)
\mathcal{N} \mathcal{O} \mathcal{P} \mathcal{Q} \mathcal{R} \mathcal{S} \mathcal{T} \(\mathcal{N} \mathcal{O} \mathcal{P} \mathcal{Q} \mathcal{R} \mathcal{S} \mathcal{T} \!\)
\mathcal{U} \mathcal{V} \mathcal{W} \mathcal{X} \mathcal{Y} \mathcal{Z} \(\mathcal{U} \mathcal{V} \mathcal{W} \mathcal{X} \mathcal{Y} \mathcal{Z} \!\)
Hebrew symbols
\aleph \beth \gimel \daleth \(\aleph \beth \gimel \daleth \!\)

Mixed text faces

Feature Syntax How it looks rendered
Non-italicised characters \text{xyz} \(\text{xyz}\) \(\text{xyz}\!\)
Mixed italics (bad) \text{if} n \text{is even} \(\text{if} n \text{is even} \) \(\text{if} n \text{is even} \!\)
Mixed italics (good) \text{if }n\text{ is even} \(\text{if }n\text{ is even}\) \(\text{if }n\text{ is even}\!\)
Mixed italics (alternative: ~ or "\ " forces a space) \text{if}~n\ \text{is even} \(\text{if}~n\ \text{is even} \) \(\text{if}~n\ \text{is even} \!\)

Color

Equations can use color:

  • {\color{Blue}x^2}+{\color{YellowOrange}2x}-{\color{OliveGreen}1}
  • \[{\color{Blue}x^2}+{\color{YellowOrange}2x}-{\color{OliveGreen}1}\]
  • x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}
  • \[x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}\]
Colors supported
\(\color{Apricot}\text{Apricot}\) \(\color{Aquamarine}\text{Aquamarine}\) \(\color{Bittersweet}\text{Bittersweet}\) \(\color{Black}\text{Black}\)
\(\color{Blue}\text{Blue}\) \(\color{BlueGreen}\text{BlueGreen}\) \(\color{BlueViolet}\text{BlueViolet}\) \(\color{BrickRed}\text{BrickRed}\)
\(\color{Brown}\text{Brown}\) \(\color{BurntOrange}\text{BurntOrange}\) \(\color{CadetBlue}\text{CadetBlue}\) \(\color{CarnationPink}\text{CarnationPink}\)
\(\color{Cerulean}\text{Cerulean}\) \(\color{CornflowerBlue}\text{CornflowerBlue}\) \(\color{Cyan}\text{Cyan}\) \(\color{Dandelion}\text{Dandelion}\)
\(\color{DarkOrchid}\text{DarkOrchid}\) \(\color{Emerald}\text{Emerald}\) \(\color{ForestGreen}\text{ForestGreen}\) \(\color{Fuchsia}\text{Fuchsia}\)
\(\color{Goldenrod}\text{Goldenrod}\) \(\color{Gray}\text{Gray}\) \(\color{Green}\text{Green}\) \(\color{GreenYellow}\text{GreenYellow}\)
\(\color{JungleGreen}\text{JungleGreen}\) \(\color{Lavender}\text{Lavender}\) \(\color{LimeGreen}\text{LimeGreen}\) \(\color{Magenta}\text{Magenta}\)
\(\color{Mahogany}\text{Mahogany}\) \(\color{Maroon}\text{Maroon}\) \(\color{Melon}\text{Melon}\) \(\color{MidnightBlue}\text{MidnightBlue}\)
\(\color{Mulberry}\text{Mulberry}\) \(\color{NavyBlue}\text{NavyBlue}\) \(\color{OliveGreen}\text{OliveGreen}\) \(\color{Orange}\text{Orange}\)
\(\color{OrangeRed}\text{OrangeRed}\) \(\color{Orchid}\text{Orchid}\) \(\color{Peach}\text{Peach}\) \(\color{Periwinkle}\text{Periwinkle}\)
\(\color{PineGreen}\text{PineGreen}\) \(\color{Plum}\text{Plum}\) \(\color{ProcessBlue}\text{ProcessBlue}\) \(\color{Purple}\text{Purple}\)
\(\color{RawSienna}\text{RawSienna}\) \(\color{Red}\text{Red}\) \(\color{RedOrange}\text{RedOrange}\) \(\color{RedViolet}\text{RedViolet}\)
\(\color{Rhodamine}\text{Rhodamine}\) \(\color{RoyalBlue}\text{RoyalBlue}\) \(\color{RoyalPurple}\text{RoyalPurple}\) \(\color{RubineRed}\text{RubineRed}\)
\(\color{Salmon}\text{Salmon}\) \(\color{SeaGreen}\text{SeaGreen}\) \(\color{Sepia}\text{Sepia}\) \(\color{SkyBlue}\text{SkyBlue}\)
\(\color{SpringGreen}\text{SpringGreen}\) \(\color{Tan}\text{Tan}\) \(\color{TealBlue}\text{TealBlue}\) \(\color{Thistle}\text{Thistle}\)
\(\color{Turquoise}\text{Turquoise}\) \(\color{Violet}\text{Violet}\) \(\color{VioletRed}\text{VioletRed}\) <math style="background:black">\pagecolor{Black}\color{White}\text{White}</math>
\(\color{WildStrawberry}\text{WildStrawberry}\) \(\color{Yellow}\text{Yellow}\) \(\color{YellowGreen}\text{YellowGreen}\) \(\color{YellowOrange}\text{YellowOrange}\)

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.

Formatting issues

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 \(a \qquad b\)
Quad space a \quad b \(a \quad b\)
Text space, forced space a\ b
a~b
\(a\ b\)
Text space without PNG conversion a \text{ } b \(a \text{ } b\)
Large space a\;b \(a\;b\)
Medium space a\>b [not supported]
a\;\;\!\!b
\(a\;\;\!\!b\)
Small space a\,b \(a\,b\)
No space ab \(ab\,\)
Small negative space a\!b \(a\!b\)

Automatic spacing may be broken in very long expressions (because they produce an overfull hbox in TeX):

\(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

<source lang="CSS">img.tex { vertical-align: middle; }</source>

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

If you need to align it otherwise, use <math style="vertical-align:-100%;">...</math> and play with the vertical-align 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 "HTML if simple" mode, but not for "HTML if possible" mode (math rendering settings in preferences).

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 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:

Syntax How it looks rendered
a^{c+2} \(a^{c+2}\)
a^{c+2} \, \(a^{c+2} \,\)
a^{\,\!c+2} \(a^{\,\!c+2}\)
a^{b^{c+2}} \(a^{b^{c+2}}\) (WRONG with option "HTML if possible or else PNG"!)
a^{b^{c+2}} \, \(a^{b^{c+2}} \,\) (WRONG with option "HTML if possible or else PNG"!)
a^{b^{c+2}}\approx 5 \(a^{b^{c+2}}\approx 5\) (due to "\(\approx\)" correctly displayed, no code "\,\!" needed)
a^{b^{\,\!c+2}} \(a^{b^{\,\!c+2}}\)
\int_{-N}^{N} e^x\, dx \(\int_{-N}^{N} e^x\, dx\)

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:

<!-- The \,\! is to keep the formula rendered as PNG instead of HTML. Please don't remove it.-->

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 TeX

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

Simpler packages include:

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{{\color{black}$$ % Frame for margin

\xymatrix{ % The diagram is a 3x3 matrix
%%% Diagram goes here %%%
}

$$}}} % 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 TeX and Ghostscript, and the inkscape program is a useful tool for creating or modifying your diagrams by hand. There is also a utility pstoedit which supports direct conversion from Postscript files to many vector graphics formats, but it requires a non-free plugin to convert to SVG, and regardless of the format, this editor has not been successful in using it to convert diagrams with diagonal arrows from TeX-created files.

These programs are:

Upload the file

Template:Seealso Template:Seealso

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.)

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.

Now go to the image page and add a description, including the source code, using this template:


|Description =

}}
|Source=Created as per: [[:en:meta:Help:Displaying a formula#Commutative diagrams]]
<pre>
% TeX source here
</pre>
|Date = The Creation Date, like 1999-12-31
|Author = [[User:YourUserName|Your Real Name]]
|Permission = {{self|PD-self (or other license)|author=[[User:YourUserName|Your Real Name]]}}
}}


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, 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 page relevant to the diagram.
Category
Include [[Category:Commutative diagrams]], 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]]

Examples

A sample conforming diagram is commons:Image:PSU-PU.svg.

Not implemented elements, and warnings

\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 center 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 TeX 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 consistant circle.

Three-fold curved integral symbol \oiiint (a variation of \iiint with an additional centered circle covering the three integrals, that should also be preferably more tightly kerned) are also commonly found in mathematics, physics and technical litterature (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.

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).

\phi and \varphi

To the main symbols of TeX belong the elements "\phi" and "\varphi". With these elements, particularly with the use or non-use of the syllable "var", one should be particularly careful:

  • The letter "\varphi", as a PNG-image or in long equations, can be written as \(\varphi\!\) ; it looks as \(\varphi\!\) and is a standard name for azimuthal angles ; using Unicode, the correct Greek character to use in plain-text (preferably in italic style) would be U+03C6 (φ) and is the standard letter "phi" of the Greek alphabet.
  • In contrast, "\phi" (also written as PNG-image by \(\phi\!\)) looks as \(\phi\!\), and is the standard name not for angles, but for electric potentials, again in Maxwell's equations and in similar contexts ; using Unicode, the correct Greek character to use in plain-text (preferably in italic style) would be U+03D5 (ϕ) and is an alternative representation of the letter, not used in Greek language but within scientific notations.

Both are very important. However unfortunately, at present the HTML-representation for the last-mentioned potentials \(\phi\!\) is \(\phi\), which reminds more to "\varphi" instead of "\phi", although this HTML-substitute is obtained by the same symbol \(\phi\) as before, but without the PNG-image-enforcing addition "\," (or better "\!").

Thus at present, due to this bug, and although generally one should not enforce PNG-images, for \phi an exception should be made.

Note: \epsilon and \varepsilon have an analogous problem.

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 critical, 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 TeX 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 TeX (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 mathematic 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 TeX spaces that remain invisible on the left of right of the expression and that force the PNG rendering wherever they occur in the expression, notably the TeX backspace "\!").

External links

  • Template:Citation. A paper introducing LaTeX — skip to page 49 for the math section. See page 63 for a complete reference list of symbols included in LaTeX and AMS-LaTeX.
How to Cite This Entry:
Displaying a formula. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Displaying_a_formula&oldid=19458