Extension:WikiTex

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
WikiTex
Release status: unmaintained
Implementation Tag
Description Enter math inside $..$
Author(s) Laszlo Csirmaz
Latest version wikitex (2008-01-14)
MediaWiki 1.7
License No license specified
Download Extension:WikiTex/Installation
Translate the WikiTex extension if it is available at translatewiki.net
Check usage and version matrix.

Adding the <wikitex> ... </wikitex> tags for an easier entry of mathematical formulas.

Problems with the standard <math> tag[edit]

  • too much to type, error prone (<math>x</math> rather than $x$)
  • slow to generate the result
  • white background (rather than transparent)
  • no proper vertical alignement
  • smart syntax checker which knows better than I do.
This formula is on a non-white background and aligned badly.

While one can change formula background to transparent by hacking the helper function, it requires another round by the sloooow convert program.

What Extension:WikiTex offers[edit]

  • math text is entered between $ symbols
  • fast turnaround (using plain TeX -> dvipng)
  • transparent background
  • proper vertical alignment (almost)
  • displayed formulas between $$ and $$
  • user costumizable TeX definition files

Caveats[edit]

  • no fancy things, all math is a picture
  • unfriendly error messages (syntax error)
  • easy littering: pictures of erased math text remain around
  • possible formatting problems with new lines; certain extensions might not work properly (due to the recursive call of wiki formatting)
  • tested on linux only

Parser extension tags[edit]

This extension adds two tags. The main additional tag is <wikitex> which indicates that from here math text is entered between $..$. Internally math text is wrapped inside <tex> tags, but this can also be used directly. The extension supports certain attributes, such as dpi=100 to make smaller images, or include="Math:Mycommands" to automatically include your TeX macros.

Documentation[edit]

Full documentation is in Extension:WikiTex/Documentation.

How to use it[edit]

Use <wikitex> and </wikitex> to enclose the part of the page (maybe the all page) on which you want to use the usual math editing:

<wikitex>
Let $Q$ be any finite set, and $\mathcal B=2^Q$ be the collection of the subsets of
$Q$. Let $f:\mathcal B\rightarrow \mathbb R$ be a function assigning real numbers to
the subsets of $Q$ and suppose $f$ satisfies the following conditions:
:(i) $f(A)\ge 0$ for all $A\subseteq Q$, $f(\emptyset)=0$,
:(ii) $f$ is monotone, i.e. if $A\subseteq B\subseteq Q$ then $f(A)\le f(B)$,
:(iii) $f$ is submodular, i.e. if $A$ and $B$ are different subsets of $Q$ then
      $$f(A)+f(B)\ge f(A\cap B) + f(A\cup B).\eqno{(2)}$$
</wikitex>

Beware: formulas are typeset with plain TeX with some predefined commands (such as \mathcal or \mathbb above). LaTeX constructs do not work.

WikiTexSample.png

Formula numbers[edit]

Displayed formulas might have formula numbers. They should come inside the $$ signs, and it should be the argument of the TeX macro \eqno{...}:

 $$f(A)+f(B)\ge f(A\cap B) + f(A\cup B). \eqno{(2)}$$

Be default, formula numbers appear on the right of the formula (but can be on the left when changing the appropriate style), and are not part of the formula.

 $$a_2^3$$

Installation[edit]

  1. You need the standard <math> tag enabled and working
  2. You need an external worker program which transforms plain tex files into pictures and returns certain status information.
    1. If your wiki was configured with math, then probably TeX was installed. Otherwise you need to install TeX as well.
    2. Install dvipng, a fast dvi bitmap converter program.
    3. Copy the supplied shell program, or something similar, into /usr/local/bin/texconvert, or change the name and/or location in WikiTex.php.
  3. Install the supplied WikiTex.php program into the extensions directory of your wiki.
  4. Edit MediaWiki:Common.css which sets how displayed formulas are shown.
  5. Edit MediaWiki:TexInclude which contains some standard TeX macros.
  6. Enjoy

Details a and source are in Extension:WikiTex/Installation.

See also[edit]