Sometimes I have to put text on a path

Tuesday, July 19, 2011

How to post mathematics in wikipedia or in MediaWiki? the MediaWiki API and extensions

How to write mathematics in blog/sites (not wiki)?
See this post:

An ex-ample : the online  NIST Digital Library of Mathematical Functions {Abramowitz and Stegun’s (1964) Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables}.

The first steps for writing/test your equation/formula in wikipedia:
The operation of Wikipedia depends on MediaWiki, a custom-made, free and open source wiki software platform written in PHP and built upon the MySQL database. If you want to compare wiki:

MediaWiki has 3 interfaces (
  • the MediaWiki API, which provides convenient access to wiki features, data and meta-data. 
  • the Special:Export page, which provides bulk export of wiki content as XML. Read the Export help article on for more information.
  • the standard web-based interface.
---version of mediaWiki used by wikipedia:

---inserting unusual characters: allows creation of JavaScript box for inserting unusual characters.
or copy/paste from:

---mathematics, formula, equations:
Mediawiki des not have an integrated equation editor.
It only has a LaTeX rendering: you have to write or copy/paste a latex code  between HTML math-tags.
Then it's painful if you want to write pages on Math with a LARGE number of math equations (and symbols, graphs...), easily.

Mediawiki and MathML and LaTeX:

MediaWiki uses a subset of (\AmS-\LaTeXAMS-LaTeX markup
a superset of LaTeX markup which is in turn a superset of TeX markup.
It generates either PNG images or simple HTML markup, depending on user preferences (see below).

Technical notes on AMS-LaTeX:
The program texvc (TeX validator and converter) validates AMS-LaTeX mathematical expressions and converts them to HTML, (limited MathML), or PNG graphics.

MediaWiki uses texvc to render mathematical formulas and similar content. The aim is to allow a single syntax for math markup while allowing a range of output formats to be generated, and to provide protection against cross-site scripting and other potential security issues. In addition, texvc provides some extensions to standard AMSLaTeX, such as \codes for HTML math character entities (for example, Σ → \Sigma) which have different names in LaTeX.

The HTML-code generated by texvc is based on 3 classes.
  • Conservative: the code should look good and work well in most browsers.
  • Moderate: the code should work and look good in reasonably modern browsers.
  • Liberal: the code is HTML, but it is designed for very recent browsers, such as newer versions of Mozilla. While it should be legible, it might not look very good.

There is also limited support for exporting to MathML.
Texvc is written in OCaml, along with PHP code to integrate it with the rest of MediaWiki.
It uses dvipng (instead of the commonly used combination of ImageMagick and dvips) to convert LaTeX's output to PNG files.
Like the rest of MediaWiki, it is available under the terms of the GNU GPL from the MediaWiki site.
Texvc cannot render arbitrary Unicode characters.

Rendering of this solution and the alt text (
  • The PNG images are black on white (not transparent).
  • 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.


The choice of wikipedia-mediawiki is clear: Latex AND conversion to MathML.
TeX is more display-oriented and MathML is more semantics-oriented, then we need both.
In the future, mediawiki will be able to generate enhanced HTML and MathML in many cases.
See blahtex for information about current work on adding MathML support:
Blahtex is a TeX-to-MathML converter intended for use with MediaWiki. It also outputs PNG graphics, much as the current TeX implementation on Wikipedia does.

Suggested structure of a mathematics article in wikipedia:

for Proofs
Wikipedia is an encyclopedia, not a collection of mathematical texts; but we often want to include proofs:

for Algorithms
There are no universally accepted standards for presenting algorithms on Wikipedia.
Source code should always use syntax highlighting.

--------------Preferences for Latex rendering:
Go to My Preferences
1) the submenu "appearance"
You have 6 choices:

2) the submenu "gadgets"
ProveIt is a user script that makes it really easy to find, edit, add, and cite references in Wikipedia articles.
it uses several javascript libs (jQuery UI, loaded via Google Libraries API.)

WikEd is a full-featured Wikipedia-integrated advanced text editor.
Pasting, import, and wiki code conversion of formatted text, e.g. from Microsoft-Word and web pages
Check the wikEd help page for a description of all buttons:

No equation editor or chemical formulae editor!!!
It only offers some useful tools:
Fix buttons:

  • Fixes some common math issues outside of the math wikitag
  • Fixes unformatted chemical formulas. Super- and subscripts indices, uppercases elements, and fixes reaction arrows. 
  • Correct a large number of physical units. 
DejaVu fonts

Several new software features have been developed to improve the handling of multimedia in Wikipedia in collaboration with Kaltura (
  • Easy searching and adding of media files to Wikipedia articles
  • Simplified uploading of videos and other media files to Wikimedia Commons
  • A new video player that is capable of displaying and adding subtitles
  • A sequence editor to create a mash up presentation of images and sound
--------------New user information (Guidelines, help, resources):


LaTeX to Wikicode is a web-based translator.
LaTeX2wiki converts sections, math, and references using a web form:

Wikipedia supports syntax highlighting. For information on how to use it, and the languages supported, see Syntax Highlight Extension:
Text on Wikipedia is encoded using the UTF-8 character set, which allows the use of many non-English characters and special symbols.
  • Many external editors
  • In-browser editors: wikEd

--------------music symbols and TeX:

No comments:

Post a Comment