Difference between revisions of "Enabling math markup"

From Organic Design wiki
(issues with 1.19 math extensions)
(rm legacy stuff)
Line 26: Line 26:
 
<math>e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots</math>
 
<math>e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots</math>
 
}}
 
}}
 
== LocalSettings.php changes ==
 
{{code|<php>
 
$wgEnableUploads      = true;  # Change to allow uploads
 
 
$wgUploadDirectory  = "{$IP}/images";
 
$wgUploadPath      = "{$wgScriptPath}/images";
 
$wgUseTeX          = true;
 
$wgMathPath        = "{$wgUploadPath}/math";
 
$wgTexvc            = "{$IP}/math/texvc";  # Path to compiled texvc
 
$wgMathDirectory    = "{$wgUploadDirectory}/math";
 
$wgTmpDirectory    = "{$wgUploadDirectory}/tmp";
 
</php>}}
 
 
== OSX Specific installation ==
 
Modify the file '''render.ml''' to include the full absolute paths to latex, dvips convert etc as follows:
 
{{code|<pre>
 
let cmd_dvips tmpprefix = "/usr/local/teTeX/bin/powerpc-apple-darwin-current/dvips -q -R -E " ^ tmpprefix ^ ".dvi -f >" ^ tmpprefix ^ ".ps"
 
      2 let cmd_latex tmpprefix = "/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex " ^ tmpprefix ^ ".tex >/dev/null"
 
      3 (* Putting -transparent white in converts arguments will sort-of give you transperancy *)
 
      4 let cmd_convert tmpprefix finalpath = "/usr/local/bin/convert -quality 100 -density 120 " ^ tmpprefix ^ ".ps " ^ finalpath ^ " \
 
        >/dev/null 2>/dev/nu        ll"
 
      5 (* Putting -bg Transparent in dvipng's arguments will give full-alpha transparency *)
 
      6 (* Note that IE have problems with such PNGs and need an additional javascript snippet *)
 
      7 (* Putting -bg transparent in dvipng's arguments will give binary transparency *)
 
      8 let cmd_dvipng tmpprefix finalpath = "/usr/local/teTeX/bin/powerpc-apple-darwin-current/dvipng -gamma 1.5 -D 120 -T tight --strict " ^ \
 
        tmpprefix ^        ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
 
</pre>}}
 
Now compile texvc with '''make''' to create a texvc executable that knows where the locations of the components are.
 
  
 
== See also ==
 
== See also ==
 
*[[MW:Manual:Math]]
 
*[[MW:Manual:Math]]
 
*[[MW:Extension:Math]]
 
*[[MW:Extension:Math]]
*[http://www.mediawiki.org/wiki/Mediawiki_and_LaTeX_on_a_host_with_shell_access#The_traditional_.3Cmath.3E Mediawiki and LaTeX]
+
*[[MW:Manual:Enable TeX]]
*[http://www.mediawiki.org/wiki/Manual:Enable_TeX Manual:Enable TeX]
 
*[http://www.mediawiki.org/wiki/Manual_talk:Running_MediaWiki_on_Mac_OS_X#Mathematics Manual_talk:Running_MediaWiki_on_Mac_OS_X#Mathematics]
 
*[http://www.mediawiki.org/wiki/TeX#TeX TeX#TeX]
 
*[http://www.mwusers.com/forums/showthread.php?t=8168&highlight=math Thread on mwusers]
 
 
*There was a problem extracting the database on 13/11 due to duplicate entries in the math table, see [[13 November 2006]].
 
*There was a problem extracting the database on 13/11 due to duplicate entries in the math table, see [[13 November 2006]].
 
[[Category:Maths]]
 
[[Category:Maths]]

Revision as of 17:47, 3 July 2013

Procedure.svg Enabling math markup
Organic Design procedure
Info.svg Use this procedure to add math rendering support which is not included in the install a new server procedure by default as it requires many additional program libraries (about 200MB worth)


As of MediaWiki version 1.18 the math rendering has been put into the Math extension. See MW:Manual:Math for more details. To download the latest version of the extensions, use:

<bash>git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git</bash>

Note that as of MediaWiki 1.19, the extension repository has become out of sync with the codebase and a specific version needs to be used which you can download from [1].

Build the texvc binary

Enabling math markup requires latex, dvips, gs, and convert. OCaml 3.06 or later from caml.inria.fr is required to compile texvc. On Debian-based systems the requirements can be installed with the following packages:

apt-get install dvipng cjk-latex ocaml
  • Run make from within the MediaWiki's math directory to build the texvc binary on your system.
  • Make sure the directories tmp and math under 'images' exist and are writable.

Example

The following maths code

<math>
e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots
</math>

Should give the following output

[math]e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots[/math]

See also