reckless intuitions of an epistemic hygienist ([info]gustavolacerda) wrote,

MediaWiki LaTeX bleg

I have installed texvc and told MediaWiki to use TeX. But I get the following error message, right on my page:

Failed to parse (Missing texvc executable; please see math/README to configure.): 0


To check whether texvc was executable, I tested it in the shell: inside /home/htdocs/wiki/math, I ran:


./texvc /home/htdocs/wiki/tmp /home/htdocs/wiki/math "y=x+2" iso-8859-1 > tex-out2


the output file contains:
Cdaa63ef966cc412541190bc8794731de<i>y</i> = <i>x</i> + 2^@<mi>y</mi><mo>=</mo><mi>x</mi><mo>+</mo><mn>2</mn>-

or, rendered as HTML:
Cdaa63ef966cc412541190bc8794731dey = x + 2^@y=x+2-

So it is executing.

Just in case, I did a chmod 777, but that didn't help.

latex and dvipng are both installed.



Here is the README:
------------------------------------------------------
== About texvc ==

texvc takes LaTeX-compatible equations and produces formatted output in
HTML, MathML, and (via LaTeX/dvipng) rasterized PNG images.
Input data is parsed and scrutinized for safety, and the output includes
an estimate of whether the code is simple enough that HTML rendering will
look acceptable.

The program was written by Tomasz Wegrzanowski for use with MediaWiki;
it's included as part of the MediaWiki package (http://wikipedia.sf.net)
and is under the GPL license.

Please report bugs at: http://bugzilla.wikimedia.org/ (under "MediaWiki")

== Setup ==

=== Requirements ===

OCaml 3.06 or later is required to compile texvc; this can be acquired
from http://caml.inria.fr/ if your system doesn't have it available.

The makefile requires GNU make.

Rasterization is done via LaTeX, dvipng. These need
to be installed and in the PATH: latex, dvipng

AMS* packages for LaTeX also need to be installed. Without AMS* some
equations will render correctly while others won't render.
Most distributions of TeX already contain AMS*.
In Debian/Ubuntu you need to install tetex-extra.

To work properly with rendering non-ASCII Unicode characters, a
supplemental TeX package is needed (cjk-latex in Debian)

=== Installation ===

Run 'make' (or 'gmake' if GNU make is not your default make). This should
produce the texvc executable.

If you're using MediaWiki's install.php and have enabled $wgUseTeX in your
LocalSettings.php, the installer will try to copy texvc into place, in the
'math' subdirectory under where wiki.phtml is installed.


== Usage ==

Normally texvc is called from MediaWiki's Math.php modules and everything
Just Works. It can be run manually for testing or for use in another app.

=== Command-line parameters ===

texvc

Be sure to properly quote the TeX code!

Example:

texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1

=== Output format ===

Status codes and HTML/MathML transformations are returned on stdout.
A rasterized PNG file will be written to the output directory, named
for the MD5 hash code.

texvc output format is like this:
+%5 ok, but not html or mathml
c%5%h ok, conservative html, no mathml
m%5%h ok, moderate html, no mathml
l%5%h ok, liberal html, no mathml
C%5%h\0%m ok, conservative html, with mathml
M%5%h\0%m ok, moderate html, with mathml
L%5%h\0%m ok, liberal html, with mathml
X%5%m ok, no html, with mathml
S syntax error
E lexing error
F%s unknown function %s
- other error

\0 - null character
%5 - md5, 32 hex characters
%h - html code, without \0 characters
%m - mathml code, without \0 characters


== Troubleshooting ==

Unforunately, many error conditions with rasterization are not well reported.
texvc will return as though everything is successful, and the only obvious
sign of problems for the user is a big X on a wiki page where an equation
should be.

Try running texvc from the command line to ensure that the software it relies
upon is all set up.

Ensure that the temporary and math directories exist and can be written to by
the user account the web server runs under; if you don't control the server,
you may have to make them world-writable.

If some equations render correctly while others don't, you probably don't have
AMS* packages for LaTeX installed. Most distributions of TeX come with AMS*.
In Debian/Ubuntu AMS* is in tetex-extra package.
To check if that is the problem you can try those two equations:
x + y
x \implies y
The first uses only standard LaTeX, while the second uses symbol \implies from AMS*.
If the first renders, but the second doesn't, you need to install AMS*.

== Hacking ==

Before you start hacking on the math package its good to know the workflow,
which is basically:

1. texvc gets called by includes/Math.php (check out the line begining with "$cmd")
2. texvc does its magic, which is basically to check for invalid latex code.
3. texvc takes the user input if valid and creates a latex file containing it, see
get_preface in texutil.ml
4. dvipng(1) gets called to create a .png file
See render.ml for this process (commenting out the removal of
the temporary file is useful for debugging).

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    Your reply will be screened

    Your IP address will be recorded 

  • 18 comments

[info]gustavolacerda

April 19 2008, 22:09:11 UTC 4 years ago

Maybe the official instructions don't apply to shared hosting.
http://meta.wikimedia.org/wiki/LaTex_on_a_shared_host

[info]gustavolacerda

April 19 2008, 22:17:52 UTC 4 years ago Edited:  April 19 2008, 22:19:26 UTC

adding
$wgTmpDirectory = "{$wgScriptPath}/tmp";

the message changed to:

Failed to parse (Can't write to or create math temp directory): 0


One bad side-effect is that this now appears at the top of every article:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/wiki/tmp) is not within the allowed path(s): (/nfsn/content/optimizelife:/nfsn/apps/php5/lib/php:/nfsn/apps/php/lib/php:/nfsn/content/content/nfsn) in /nfsn/content/optimizelife/public/wiki/includes/Math.php on line 47

[info]ernunnos

April 19 2008, 22:22:20 UTC 4 years ago

Try it with the $ outside the {} ... "${wgScriptPath}/tmp"

[info]gustavolacerda

April 19 2008, 22:27:48 UTC 4 years ago

apparently, it makes no difference.

[info]ruht

April 21 2008, 15:51:06 UTC 4 years ago

I read only the first two sentences of this bleg.

Make sure the directory texvc is in is on your path with something like

export PATH = ($PATH /home/htdocs/wiki/math)

then restart mediawiki.

If that does not work,

cd /home/htdocs/wiki
ln -s math/texvc .


then restart mediawiki.

Yeah, I know you probably already tried all this.

[info]gustavolacerda

April 22 2008, 04:47:09 UTC 4 years ago

Good call.

Now I need to figure out how to restart MediaWiki.

[info]gustavolacerda

April 22 2008, 05:05:13 UTC 4 years ago

adding
$wgTexvc = "{$wgScriptPath}/math/texvc";

I get:

Warning: is_executable() [function.is-executable]: open_basedir restriction in effect. File(/wiki/math/texvc) is not within the allowed path(s): (/nfsn/content/optimizelife:/nfsn/apps/php5/lib/php:/nfsn/apps/php/lib/php:/nfsn/content/content/nfsn) in /nfsn/content/optimizelife/public/wiki/includes/Math.php on line 55

[info]gustavolacerda

April 22 2008, 05:18:35 UTC 4 years ago

http://www.sixapart.com/movabletype/kb/dynamic/open_basedir_re.html

suggests that MediaWiki doesn't have the needed permissions. But /math and texvc are both 777.

[info]peamasii

April 23 2008, 19:50:58 UTC 4 years ago

This means the path to the binary is specified wrong and outside the permitted locations.

Instead of specifying a relative path in your virtual host:
/wiki/math/texvc
you should have the absolute location of the binary:
/nfsn/content/optimizelife/wiki/math/texvc


[info]gustavolacerda

April 26 2008, 17:27:04 UTC 4 years ago

using

$wgTexvc = "/nfsn/content/optimizelife/wiki/math/texvc";

the disallowed error disappears, but LaTeX still doesn't work.


What's weird is I can make up directories, and they are "allowed":

$wgTexvc = "mathg";



[info]peamasii

April 26 2008, 17:40:26 UTC 4 years ago

then you have to get some kind of error output to see why it doesn't work

[info]gustavolacerda

April 26 2008, 17:45:10 UTC 4 years ago

it's still the same thing:

Failed to parse (Missing texvc executable; please see math/README to configure.): 0

[info]gustavolacerda

April 26 2008, 19:17:59 UTC 4 years ago

I already saw that.

[info]gustavolacerda

April 27 2008, 02:03:47 UTC 4 years ago Edited:  April 27 2008, 02:04:15 UTC

darkcode: so either add it to the allowed paths, move it to an existing allowed path, turn off safe_mode or use the patch suggested in the safe mode section of the problem page
< gusl > darkcode: hmm... how can I find out which paths are allowed?
< darkcode > php -i | grep open_basedir
< gusl > open_basedir => no value => no value

Anonymous

January 8 2011, 22:42:42 UTC 1 year ago

Plano Willow Bend Mustang Drugs

Whal Mart Pharmacy Drug Coverage [url=http://littlebirdgraphics.com/]generic arimidex[/url] Arimidex is like all medications on the market in that it does come with some unwanted side effects. http://littlebirdgraphics.com/ - evista without prescription
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…