Page MenuHomePhabricator

Enabling math extension (with texvc) => database error
Open, MediumPublic

Description

I have a clean CentOS 7 VM with SELinux turned off on which I've only done the following:

  1. Install apache, mariadb, texlive, ocaml using yum
  1. Untar'd mediawiki-1.24.0.tar.gz into my DocumentRoot /var/www/mediawiki
  1. Ran the standard installation script and copied LocalSettings.php into $IP

Everything works at this point. After this I did the following:

  1. cloned the math extension git repo into $IP/extensions/Math
  1. Compiled texvc and texvccheck and left them in their default locations.

At this point if I enable the Math extension by adding:

require_once "$IP/extensions/Math/Math.php";

into LocalSettings.php and then try to edit the main page by adding <math>x</math> somewhere there, I get the following error:

A database query error has occurred. This may indicate a bug in the software.

There is nothing printed in my error_log.

Event Timeline

Efagerho raised the priority of this task from to High.
Efagerho updated the task description. (Show Details)
Efagerho added a project: Math.
Efagerho changed Security from none to None.
Efagerho added a subscriber: Efagerho.

I got rid of the database error part. It seems like the extension expects some tables to have been generated, but there's nothing in the manual here about this (the maintenance/update.php scripts also won't add them):

https://www.mediawiki.org/wiki/Extension:Math

that says so. However, the README does mention some unit test (and for some stupid reason the release team has apparently removed the tests/ subdirectory from $IP, so you need to get the git source), so I ran them and they seem to have created the tables. However, every test seems to fail with something like

446) MathCoverageTest::testCoverage with data set #446 ('\\tilde \\mathcal{M}', '<img class="mwe-math-fallback-image-inline tex" alt="\\tilde \\mathcal{M}" src="55072ce6ef8c840c4b7687bd8a028bde.png" />')
Failed to render \tilde \mathcal{M}
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<img class="mwe-math-fallback-image-inline tex" alt="\tilde \mathcal{M}" src="55072ce6ef8c840c4b7687bd8a028bde.png" />'
+'<strong class='error texerror'>Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): \tilde \mathcal{M}</strong>
+'

/var/www/mediawiki/extensions/Math/tests/MathCoverageTest.php:75
/var/www/mediawiki/tests/phpunit/MediaWikiTestCase.php:141

The end result is now that instead of a database error, I get the following error message printed on the page:

Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): x

To double check the existence of those binaries, I did:

[root@wiki ~]# which dvipng
/usr/bin/dvipng
[root@wiki ~]# which gs
/usr/bin/gs
[root@wiki ~]# which latex
/usr/bin/latex
[root@wiki ~]# which convert
/usr/bin/convert

Therefore these are all installed. To make sure that there's nothing from texlive that I'm missing I further did a

yum install texlive-*

The problem remains.

Whatever the problem is, it looks like the current documentation is very incomplete.

I think there is a hint in the manual that update.php script needs to be run. Otherwise the tables won't be created.
The tests are themselves are not required for the extension as far as I know.
The error you are facing is that texvc canot find latex on your system is one of the resaons why I'd recommend to switch to one of the new rendering modes. If you set

$wgDefaultUserOptions['math'] = MW_MATH_MATH;

You should be done.
Otherwise you should have a log at the logfiles.
You should see something like
'Math': "TeX: $cmd\n"
followed by
'texvc': "Executing '$cmd'."
Where the first $cmd is your tex input and the second $cmd is the command that should be executed.
If you know which command was supposed to be executed, you can check if that command can be executed on the commandline.

The problem with the more modern modes as I see it is that we have some custom packages as well as a fairly large set of shortcuts in the standard preamble. I've seen no indication in any of the manuals, that the more modern modes allow enabling custom packages and define new shortcuts without a lot of work. I also couldn't find any mention if xy-pic is possible to use for drawing commutative diagrams.

The issue with custom packages is that they might be filtered out by
texvc... So you'd to adjust texvc which might take some time.
Am 08.12.2014 17:54 schrieb "Efagerho" <no-reply@phabricator.wikimedia.org>:

Efagerho added a comment.

The problem with the more modern modes as I see it is that we have some
custom packages as well as a fairly large set of shortcuts in the standard
preamble. I've seen no indication in any of the manuals, that the more
modern modes allow enabling custom packages and define new shortcuts
without a lot of work. I also couldn't find any mention if xy-pic is
possible to use for drawing commutative diagrams.

TASK DETAIL

https://phabricator.wikimedia.org/T76981

REPLY HANDLER ACTIONS

Reply to comment or attach files, or !close, !claim, !unsubscribe or

!assign <username>.

To: Efagerho
Cc: Aklapper, Efagerho, Physikerwelt, fredw, Pkra

Physikerwelt lowered the priority of this task from High to Medium.Dec 9 2014, 3:17 AM
Physikerwelt moved this task from Inbox to Next-up; only affect PNGs on the Math board.