ASCIIMath
Question addressed by this recipe
Would you (or your students) like to easily produce goodlooking math formulas on wiki pages using a simple calculatorstyle syntax ?
Description
Notes and Comments
ASCIIMath recipe is based on ASCIIMathPHP by Steven Chan > mailto:kc56 [snail] cornell [period] edu, a PHP port of ASCIIMathML.js from Peter Jipsen.
Installation
 Download and extract
asciimath.zipΔ
to the PmWiki's root directory.  Make sure you have:
 cookbook/asciimath.php file and cookbook/asciimath directory,
 pub/asciimath directory (note to updaters: the pub/xsl directory is no more used).
 In your local/config.php file, you must include the asciimath.php script:
include_once('cookbook/asciimath.php');
Optionally, you may keep the provided Cookbook text pages content (including this one) for further references.
Markup
Once installed, the following markups are available:
{$ %<parameters...>% formula $}  
(:eqn <parameters...> :) [= formula =]  (:eqn <parameters...> :) formula (:eqnend:) 
with the following optional parameters:
height=PIXELS
to set the height reserved for the formula,num(=VALUE)
to display (and eventually set) an equation number,
The markup parameters are filtered and all +...
and ...
unhandled options are silently discarded. All other parameters are forwarded to the MathML style definition.
Syntax
(Excerpt from ASCIIMathML.js : Syntax and List of Constants. Please refer to original site for complete references):
The syntax is very permissive and does not generate syntax errors. This allows mathematically incorrect expressions to be displayed, which is important for teaching purposes. It also causes less frustration when previewing formulas.
The parser uses no operator precedence and only respects the grouping brackets, subscripts, superscript, fractions and (square) roots. This is done for reasons of efficiency and generality. The resulting MathML code can quite easily be processed further to ensure additional syntactic requirements of any particular application.
The sample given on ASCIIMathML.js home page will be rendered with following page content:

Example: Solving the quadratic equation. Suppose We first divide by a to get Then we complete the square and obtain The first three terms factor to give Now we take square roots on both sides and get Finally we move to the right and simplify to get the two solutions: 
Implementation considerations, Limitations
Currently, formulas are handled in a two step process:
 Generate formulas as XML files of MathML code into the
pub/asciimath
directory.  Render generated formulas in wiki page via some
<iframe>
tags with the help of thepmathml.xsl
andpmathmlcss.xsl
stylesheets provided in thepub/asciimath
directory.
A formula file is generated only if it didn't previously exist or if formula text has changed. In edition mode (?action=edit
) formulas are inconditionnally generated to handle preview feedback.
An extra ?action=purgeqns
is made available to allow some clean up of the pub/asciimath
directory if needed.
Each formula is anchored no its own page with the name eqn_<number>
(the order of apparition in the page).
 Nota
 ASCIIMathPHP is based on an outdated version of ASCIIMathML.js (v1.3). Despite the current version has been patched to support more ASCIIMathML.js features, some of them are still lacking or nonfunctional. You may ask the author for upgrades.
See also
 Cookbook /
 AMmathjax Add markup to embed math using ASCII MATH by MathJax. (Stable)
 Formula Lightweight rendering of mathematical formulas in wiki pages (Beta)
 JsMath Add markup to display and embed mathematical formulas in wiki pages using TeX. (Obsolete  use MathJax)
 LaTeXMathJax MathJax support for PmWiki (stable)
 LaTeXMathML Translating LaTeX math notation dynamically to Presentation MathML (Stable)
 LinuxTex Enable TeX markup
 LuaExecute Lets Lua scripts dynamically generate parts of your wiki page (Beta)
 MathJax Add markup to embed math using TeX syntax. (Stable)
 Mathtex Add markup to display and embed several lines of mathematical formulas in wiki pages (testing)
 MimeTeX Add markup to display and embed mathematical formulas in wiki pages (Stable)
 SageCell This allows you to embed an interactive SageCell into your webpage. Sage is an open source alternative to MathLab, Mathematica, and Maple. (Stable)
 SimpleJsMath Notes on modifying the jsMath for a skin (not a complete recipe)
 TrueLatex Enables interpretation and rendering of real LaTeX markups in PmWiki. Support for XeLaTex included in v1.8. (Working perfectly. Very simple to use, customizable and comes with lots of options.)
Contributors
Releases Notes
 20050607 Initial version
 20050820 Updated to modified ASCIIMathPHP v1.10 (patch submitted to the author), and fixed typo bugs.
 20050904 Fixed <:vspace> hint with 2.0.0 and above.
 20060130 Added missing stylesheet and reduced pub/ directory pollution. Minor tweaks.
 20060307 Merging unreleased enhancements.
 20061026 Add RecipeInfo data. Cleaned code.
 20061028 Minor tweaks.
Comments
See discussion at ASCIIMathTalk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.