GetWiki:Custom Formulas

aesthetics  →
being  →
complexity  →
database  →
enterprise  →
ethics  →
fiction  →
history  →
internet  →
knowledge  →
language  →
licensing  →
linux  →
logic  →
method  →
news  →
perception  →
philosophy  →
policy  →
purpose  →
religion  →
science  →
sociology  →
software  →
truth  →
unix  →
wiki  →
essay  →
feed  →
help  →
system  →
wiki  →
critical  →
discussion  →
forked  →
imported  →
original  →
edit index GetWiki:Custom Formulas


GetWiki allows TeX markup for mathematics and logic formulas. Instead of assuming complicated dependencies and server resources on all GetWiki-based wikis just to generate PNG images, GetWiki translates TeX into simple XHTML markup1, with LaTeX parsing and image rendering available as a deprecated option2. In the future, as browsers become even more XML capable, GetWiki could easily generate MathML instead, which is also a subset of XML.

Mathematics and Logic formulas are rendered by placing your TeX code inside interchangeable , or tags. It is your personal, or philosophical, preference as to which of these tags you use. Line breaks and other wiki formatting within the tags are not rendered3.

Using this approach has many advantages:
  • Server resources beyond the wiki engine are not necessary
  • Dependencies and mysterious subdependencies are avoided (LaTeX, Divips, Ghostsript, etc)
  • Formula text matches the rest of the article, unlike defaulted Ghostcript images
  • Formulas are indexable as text, with no TeX code used as image "alt text"
  • Formulas align properly when displayed inline with text
  • Text and background colours can be easily customized through CSS

Very complex formulas and matrices might very well fail to render correctly under this approach, so proofreading is necessary, and perhaps, further translation by the author(s) from TeX to plain text. Unfortunately, there is currently no perfect server-side solution to translating TeX for the web, so the approach in GetWiki is a compromise4, favouring standards and ease of setup: The advantages for a wiki outweigh the disadvantages5, and migration toward future developments in XML is trivial.

If you find a glaring omission of a symbol, function or argument which could be better represented using plain text entities, please post on the talk page for this article.

Formula Tags

feature syntax rendered
equivalent tags
r is odd cos sr
r is odd cos sr
(q AB
(q AB
(r + s) = (t + v)
(r + s) = (t + v)

Simple Formulas

feature syntax rendered
standard functions sin x + ln y + operatorname{sgn} z
s∈ x + ln y + sgn z
sin {y} + ln x + cos z
s∈ y + ln x + cos z
Modular Algorithm s_k equiv 0 pmod{m}
sk ≡ 0 (modm
Derivatives nabla partial x dx dot x ddot y
∇ &(art; x dx deriv(⋅) x dderiv(⋅) y
Sets forall x notin varnothing subseteq A cap B cup exists {x,y} times C
∀ x not∈ varnoth∈g &su(;eq A &ca(; B &cu(; eξsts xy ⋅ C
Logic p land bar{q} to plor lnot q therefore
( ∧ q → (∨ ˜ q &#there4;
Root sqrt{2}approx 1.4
2&asy&(lusmn;; 1.4
Relations sim simeq cong le ge equiv notequiv approx ne
∼ &≅; ≅ ≤ ≥ ≡ &≠; &asy&(lusmn;; ≠
Geometric triangle angle perp | 45^circ
triang≤ ang≤ &(er(; || 45ο

leftarrow rightarrow leftrightarrow

longleftarrow longrightarrow

mapsto longmapsto

nearrow searrow swarrow nwarrow

uparrow downarrow updownarrow

← → ↔

long← long→

ma(s→ longma(s→

≠arrow searrow swarrow nwarrow

↑ ⇓ u(⇓

Leftarrow Rightarrow Leftrightarrow

Longleftarrow Longrightarrow Longleftrightarrow

Uparrow Downarrow Updownarrow

⇐ ⇒ ⇔

Long← Long→ Long↔

⇑ ↓ U(⇓

Special oplus otimes pm mp hbar dagger ddagger star circ cdot times bullet infty
&o(lus; &o⋅; &(lusmn; &(lusmn; h&dag≥r; d&dag≥r; * ο cderiv(⋅) ⋅ • &∈f∈;

Subscripts, Superscripts

feature syntax rendered
Superscript a^2
Subscript a_2
Grouping a^{2+2}
Combining sub & super x_2^3
Derivative x'
Underlines & Overlines
(use > to space)
hat a bar b vec c widehat {d e f} overline {g h i} underline {j k l}
^ a b c wide^ d e f sin;e;">;">g h i sin;e;">;">j k l
widehat {d>e>f} overline {g>h>i} underline {j>k>l}
wide^ d>e>f sin;e;">;">g>h>i sin;e;">;">j>k>l
Sum sum_{k=1}^N k^2
Σk=1N k2
Product prod_{i=1}^N x_i
&(rod;i=1N xi
Limit lim_{n to infty}x_n
limn → &∈f∈;xn
Integral int_{-N}^{N} e^x, dx
∈t-NN ex dx
Line Integral oint_{C} x^3, dx + 4y^2, dy
o∈tC x3 dx + 4y2 dy

Fractions, Matrices, Multilines

feature syntax rendered
Fractions frac{2}{4} or {2over4}
B∈omial Coefficients n or k n or k
Matrices begin{pmatrix} x & y z & v end{pmatrix}
matrix( x & y z & v )
begin{bmatrix} 0 & cdots & 0 vdots & ddots & vdots 0 & cdots &
matrix[ 0 & cderiv(⋅)s & 0 vderiv(⋅)s & dderiv(⋅)s & vderiv(⋅)s 0 & cderiv(⋅)s &
matrix{ x & y z & v } matrix{ x & y z & v }
begin{vmatrix} x & y z & v end{vmatrix}
matrix|| x & y z & v ||
begin{Vmatrix} x & y z & v end{Vmatrix}
matrix|||| x & y z & v ||||
begin{matrix} x & y z & v end{matrix}
matrix x & y z & v endmatrix
Case Distinctions f(n) = left { begin{matrix} n/2, & mbox{if }nmbox{ is even} 3n+1, & mbox{if }nmbox{ is odd} end{matrix} right.
f(n) = (&nbs(; matrix n/2 & if n is even 3n+1 & if n is odd endmatrix &nbs(;).
Multiline Equations begin{matrix}f(n+1) & = & (n+1)^2 &

& n^2 + 2n + 1 end{matrix}

matrixf(n+1) & = & (n+1)2 & = & n2 + 2n + 1 endmatrix


feature syntax rendered
Greek Letters alpha beta gamma Gamma phi Phi Psi tau Omega
&al(ha; &bη; γ Γ &(hi; Φ Ψ τ Ω
Blackboard Bold xinmathbb{R}submathbb{C}
Boldface (Vectors) mathbf{x}cdotmathbf{y} = 0
xcderiv(⋅)y = 0
Boldface (Greek) boldsymbol{alpha} + boldsymbol{beta} + boldsymbol{gamma}
&al(ha; + &bη; + γ
Fraktur Typeface mathfrak{a} mathfrak{B}
Fraktura FrakturB
Script mathcal{ABC}
Hebrew Alphabet aleph beth gimel daleth
a≤(h beth gimel da≤th
Italics mbox{abc}
mbox{if} n mbox{is even}
if n is even
mbox{if }nmbox{ is even}
if n is even

Parenthesizing Expressions

feature syntax rendered
Example ( frac{1}{2} )
( 1/2 )
Example ( {1}over{2} )
( 1/2 )
Example left ( frac{1}{2} right )
(&nbs(;( 1/2 &nbs(;) )

You can use various delimiters with left and right:

feature syntax rendered
Parentheses left ( A right )
(&nbs(;( A &nbs(;) )
Brackets left [ A right ]
(&nbs(;[ A &nbs(;) ]
Braces left { A right }
(&nbs(; A &nbs(;)
Angle Brackets left langle A right rangle
(&nbs(;lang≤ A &nbs(;) rang≤
Bars and Double Bars left | A right | and left | B right |
(&nbs(;|| A &nbs(;) || and (&nbs(;|| B &nbs(;) ||
Delimiters can be mixed,
as long as left and right match
left [ 0,1 right )
left langle psi right |
(&nbs(;[ 01 &nbs(;) )

(&nbs(;lang≤ &(si; &nbs(;) ||
Use left. and right. if you don't
want a delimiter to appear:
left . frac{A}{B} right } to X
(&nbs(;. A/B &nbs(;) → X


feature syntax rendered
Doubled-Double Space a qquad b
a &nbs(;&nbs(;&nbs(;&nbs(; b
Double Space (quad) a quad b
a &nbs(;&nbs(; b
Large Space a;b
Medium Space a>b
Small Space (uses CSS) a,b
No Space ab
Negative Space (uses CSS) a!b

Legacy Code

Forcing PNG rendering2 is ignored, such as placing ,! (small space and negative space, which cancel out) inside your tags. To turn on PNG rendering, the wiki administrator must toggle the setting in LocalSettings.php and ensure the dependency tree is installed and functioning (not recommended).

syntax rendered
a^{2+2} ,!
int_{-N}^{N} e^x, dx
∈t-NN ex dx
int_{-N}^{N} e^x, dx ,!
∈t-NN ex dx


  1. The PNG image generation is a great feature, but good only for a narrow use, and many developers are moving away from such solutions, toward standards-based XML, of which XHTML is a subset. The images certainly look nicer to the eye at first glance (on a white page, at least), but because their formulae cannot be indexed or searched, and because host systems sometimes cannot be configured correctly, the image-generation solution is neither standards-based nor accessible. In short, such solutions are behind the times.
  2. If you must, a toggle in LocalSettings.php will turn on the PNG rendering of formulae, assuming you have LaTeX, Divips, and Ghostscript installed, and only if their hidden and inconsistent dependencies are installed, which is different for each system. Also, download the texvc (+/- 400k) utility and place it in your installation directory. The related user options have been deprecated.
  3. This text approach has been tested with the formulas on this page, and seems to work perfectly for simple to intermediate formulas, but when your formulas become very complex, the text approach may not give the best results. This is, after all, a compromise. Consider typing our your fomulas using standard HTML/XHTML entities rather than using TeX, or adding an explanation for a complex formula.
  4. This was a problem on Wikinfo with this solution, where the host systems simply could not be configured correctly to support the assumptions built into MediaWiki. It was not only the image generation, but the very parsing of TeX with LaTeX, which was the problem. Weeks of testing resulted in having to lock out the settings from MediaWiki defaults (and eventually led to GetWiki).
  5. Unfortunately, along with problems with complex equations, some older browsers cannot display a few of the characters from the extended entity lists, and very old browsers cannot display the few CSS tweaks used, mentioned above. However, this has been kept to a minimum, and the character data is still indexable, searchable, and portable. CSS is used where actual characters are not available, such as negative spaces, or overlines.

External Links

  • weblink - LaTeX tutorial
  • weblink - (pp. 39-ff)
  • weblink - (pp. 59, 72, with a complete reference list of symbols in LaTeX/AMS-LaTeX)
  • weblink - TeX reference
  • weblink - AMS-LaTeX reference
  • weblink - symbol bitmaps (public domain)

Some content adapted from the MetaWikipedia article "MediaWiki User's Guide: Editing mathematical formulae" under the GNU Free Documentation License.
edit index
[ last updated: 6:17pm EDT - Sat, Aug 02 2008 ]
LATEST EDITS [ see all ]
Eastern Philosophy
History of Philosophy
M.R.M. Parrott