Difference between revisions of "Enabling math markup"
m (→Build the texvc binary) |
(→Nginx) |
||
Line 27: | Line 27: | ||
<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> | ||
}} | }} | ||
+ | |||
+ | == Nginx == | ||
+ | After we changed over from [[Apache]] to [[Nginx]] I spent many hours trying to figure out why the ''texvc'' binary wouldn't produce the PNG file. The binary was being executed properly by ''shell_exec'' in ''MathTexvc.php'', but for some reason would not build the image. | ||
+ | |||
+ | I couldn't fina anything logged about a problem anywhere, and there were no differences in PHP configuration that I could find. I tried adjusting ''render.ml'' to leave the temporary files so I could analyse those (by removing the lines deleting then from the ''unlink_all'' function then running ''name clean'' and ''make'' to rebuild the ''texvc'' binary, but it wouldn't produce any of the files except the ''.tex'' one. | ||
+ | |||
+ | The only working solution I could come up with was to run the ''texvc'' as root using ''sudo'' by changing line '''123''' of '''MathTexvc.php''' as follows: | ||
+ | {{code|<tt>$contents = wfShellExec( "{{h|sudo}} $cmd" );</tt>}} | ||
+ | |||
+ | |||
+ | To allow the web-server to have ''sudo'' access without compromising security the following line can be added to the sudoers file using ''visudo''. | ||
+ | {{code|<pre>www-data ALL= NOPASSWD: /path/to/wiki/extensions/Math/math/texvc</pre>}} | ||
== See also == | == See also == |
Revision as of 18:06, 3 July 2013
Enabling math markup Organic Design procedure |
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:
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:
- 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.
- Note: on Debian 7 we also required the texlive-latex-extra package.
Example
The following maths code
Should give the following output
Nginx
After we changed over from Apache to Nginx I spent many hours trying to figure out why the texvc binary wouldn't produce the PNG file. The binary was being executed properly by shell_exec in MathTexvc.php, but for some reason would not build the image.
I couldn't fina anything logged about a problem anywhere, and there were no differences in PHP configuration that I could find. I tried adjusting render.ml to leave the temporary files so I could analyse those (by removing the lines deleting then from the unlink_all function then running name clean and make to rebuild the texvc binary, but it wouldn't produce any of the files except the .tex one.
The only working solution I could come up with was to run the texvc as root using sudo by changing line 123 of MathTexvc.php as follows:
To allow the web-server to have sudo access without compromising security the following line can be added to the sudoers file using visudo.
See also
- MW:Manual:Math
- MW:Extension:Math
- MW:Manual:Enable TeX
- MW:Manual:Running MediaWiki on Debian GNU/Linux#TeX_Support
- MW:Manual:Troubleshooting math display errors
- There was a problem extracting the database on 13/11 due to duplicate entries in the math table, see 13 November 2006.