Difference between revisions of "Enabling math markup"
(Adding OS X notes) |
(formatting) |
||
Line 10: | Line 10: | ||
The file in path {$IP}/math/README explains how to compile ocmal and texvc. You can run an example from the command line | The file in path {$IP}/math/README explains how to compile ocmal and texvc. You can run an example from the command line | ||
+ | {{code|<pre> | ||
+ | texvc <temp directory> <output directory> <TeX code> <encoding> | ||
+ | </pre>}} | ||
− | |||
e.g. | e.g. | ||
− | + | {{code|<pre> | |
− | texvc /Library/WebServer/Documents/mediawiki-biodev3-1.14.0/images/tmp /Library/WebServer/Documents/mediawiki-biodev3-1.14.0/images/math "y=mc+c" iso-8859-1 | + | texvc /Library/WebServer/Documents/mediawiki-biodev3-1.14.0/images/tmp \ |
+ | /Library/WebServer/Documents/mediawiki-biodev3-1.14.0/images/math "y=mc+c" iso-8859-1 | ||
+ | </pre>}} | ||
== Example == | == Example == | ||
The following maths code | The following maths code | ||
− | {{code|<pre><math> | + | {{code|<pre> |
+ | <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 | 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></pre>}} | + | </math> |
+ | </pre>}} | ||
Should give the following output | Should give the following output | ||
− | {{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>}} | + | {{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> | ||
+ | }} | ||
== Build the texvc binary == | == Build the texvc binary == | ||
Line 56: | Line 64: | ||
</pre>}} | </pre>}} | ||
− | + | == OSX Specific installation == | |
− | |||
− | ==OSX Specific installation== | ||
*Modify the file '''render.ml''' to include the full absolute paths to latex, dvips convert etc. | *Modify the file '''render.ml''' to include the full absolute paths to latex, dvips convert etc. | ||
<pre> | <pre> | ||
Line 64: | Line 70: | ||
2 let cmd_latex tmpprefix = "/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex " ^ tmpprefix ^ ".tex >/dev/null" | 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 *) | 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" | + | 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 *) | 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 *) | 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 *) | 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" | + | 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> | </pre> | ||
Now compile texvc with '''make''' to create a texvc executable that knows where the locations of the components are. | Now compile texvc with '''make''' to create a texvc executable that knows where the locations of the components are. | ||
− | ==LocalSettings.php changes== | + | == LocalSettings.php changes == |
− | < | + | {{code|<php> |
$wgEnableUploads = true; # Change to allow uploads | $wgEnableUploads = true; # Change to allow uploads | ||
Line 83: | Line 91: | ||
$wgMathDirectory = "{$wgUploadDirectory}/math"; | $wgMathDirectory = "{$wgUploadDirectory}/math"; | ||
$wgTmpDirectory = "{$wgUploadDirectory}/tmp"; | $wgTmpDirectory = "{$wgUploadDirectory}/tmp"; | ||
− | </ | + | </php>}} |
− | ==See also== | + | |
+ | == See also == | ||
*[http://www.mediawiki.org/wiki/Mediawiki_and_LaTeX_on_a_host_with_shell_access#The_traditional_.3Cmath.3E Mediawiki and LaTeX] | *[http://www.mediawiki.org/wiki/Mediawiki_and_LaTeX_on_a_host_with_shell_access#The_traditional_.3Cmath.3E Mediawiki and LaTeX] | ||
*[http://www.mediawiki.org/wiki/Manual:Enable_TeX Manual:Enable TeX] | *[http://www.mediawiki.org/wiki/Manual:Enable_TeX Manual:Enable TeX] |
Revision as of 07:46, 5 August 2010
Enabling math markup Organic Design procedure |
Enabling math markup requires latex, dvips, gs, and convert.
The file in path {$IP}/math/README explains how to compile ocmal and texvc. You can run an example from the command line
e.g.
Contents
Example
The following maths code
Should give the following output
Build the texvc binary
OCaml 3.06 or later from caml.inria.fr is required to compile texvc
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.
LocalSettings.php customization
The following lines need to be added;
Transparency (not working on current versions)
The /wiki/math/render.ml script has notes about swtches that can be added to the convert and dvips commands to give transparency, but these images will not work correctly in Microsoft browsers prior to IE7. After making changes to render.ml, you must rebuild the texvc executable by issuing a make clean && make.
For older codebases, we used the following render.ml hack instead.
OSX Specific installation
- Modify the file render.ml to include the full absolute paths to latex, dvips convert etc.
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"
Now compile texvc with make to create a texvc executable that knows where the locations of the components are.
LocalSettings.php changes
See also
- Mediawiki and LaTeX
- Manual:Enable TeX
- Manual_talk:Running_MediaWiki_on_Mac_OS_X#Mathematics
- TeX#TeX
- Thread on mwusers
- Articles containing maths
- There was a problem extracting the database on 13/11 due to duplicate entries in the math table, see 13 November 2006.