Extension talk:Math

Jump to navigation Jump to search

About this board

Previous discussions were archived for 2011–2014 and 2015–2016 on 2016-10-20.

https://wikimedia.org/api/rest_v1/ returning code 0 and not 200

3
Nyet (talkcontribs)

Using mediawiki 1.31 and Math extension REL_31

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":)

If i change it to allow code 0:

diff --git a/MathRestbaseInterface.php b/MathRestbaseInterface.php
 index 2dc5d45..5355177 100644
 --- a/MathRestbaseInterface.php
 +++ b/MathRestbaseInterface.php
 @@ -364,7 +364,7 @@ class MathRestbaseInterface {
          */
         public function evaluateRestbaseCheckResponse( $response ) {
                 $json = json_decode( $response['body'] );
 -               if ( $response['code'] === 200 ) {
 +               if ( $response['code'] === 200 || $response['code'] === 0) {
                         $headers = $response['headers'];
                         $this->hash = $headers['x-resource-location'];
                         $this->success = $json->success;
 
 

I get

Failed to parse (Conversion error. Server ("https://wikimedia.org/api/rest_") reported: "Cannot get mml. Server problem.")

Is the RESTBase server down?

Jdforrester (WMF) (talkcontribs)

Is the RESTBase server down?

No, but maybe the Mathoid service is?

87.123.120.67 (talkcontribs)

My Math extension have been failing with the same error since a few days.

Reply to "https://wikimedia.org/api/rest_v1/ returning code 0 and not 200"
Fokebox (talkcontribs)

Hi everyone. I use Math extension and besically everything is fine. But I have found out small bug when I see formulas at IPad Safari browser - it doesn't display cyrillic symbols when I put them throgh \text{киррилица}

Physikerwelt (talkcontribs)

Lets test here:

Physikerwelt (talkcontribs)

Do you have installed the native MathMl extension? Otherwise you will get a [svg image](https://wikimedia.org/api/rest_v1/media/math/render/svg/e80f165a0d58c6514c476f7e46ac8c9e8a544e3d) with inline text

 1 <svg xmlns:xlink="http://www.w3.org/1999/xlink" width="12.75ex" height="3.343ex" style="vertical-align: -1.171ex;" viewBox="0 -934.9 5489.6 1439.2" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title">
 2 <title id="MathJax-SVG-1-Title">{\displaystyle {\text{киррилица}}}</title>
 3 <defs aria-hidden="true"></defs>
 4 <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
 5 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">к</text>
 6 <g transform="translate(609,0)">
 7 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">и</text>
 8 </g>
 9 <g transform="translate(1219,0)">
10 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">р</text>
11 </g>
12 <g transform="translate(1829,0)">
13 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">р</text>
14 </g>
15 <g transform="translate(2439,0)">
16 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">и</text>
17 </g>
18 <g transform="translate(3049,0)">
19 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">л</text>
20 </g>
21 <g transform="translate(3659,0)">
22 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">и</text>
23 </g>
24 <g transform="translate(4269,0)">
25 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">ц</text>
26 </g>
27 <g transform="translate(4879,0)">
28 <text font-family="monospace" stroke="none" transform="scale(71.759) matrix(1 0 0 -1 0 0)">а</text>
29 </g>
30 </g>
31 </svg>

It depends on the fonts installed on your iPad what you actually see? @Pkra What do you think: Should we try to convert all text elements to paths or leave that to the browser?

Fokebox (talkcontribs)

<chem>m_\text{теор}(CH3COOC2H5) = n(CH3COOC2H5)\cdot M(CH3COOC2H5) = 0,5\text{моль} \cdot 88 \text{г/моль} = 44 \text{г}</chem>

https://wikireshebnik.ru/index.php/%D0%9F%D0%B0%D1%80%D0%B0%D0%B3%D1%80%D0%B0%D1%84_7_-_%D0%A5%D0%B8%D0%BC%D0%B8%D1%8F._10_%D0%BA%D0%BB%D0%B0%D1%81%D1%81._%D0%9A%D1%83%D0%B7%D0%BD%D0%B5%D1%86%D0%BE%D0%B2%D0%B0_%D0%9D.%D0%95.#.D0.9F.D0.BE.D0.BB.D1.83.D1.87.D0.B5.D0.BD.D0.B8.D0.B5_.D1.8D.D1.84.D0.B8.D1.80.D0.B0_.D0.BF.D1.80.D0.B8_.D0.BD.D0.B0.D0.B3.D1.80.D0.B5.D0.B2.D0.B0.D0.BD.D0.B8.D0.B8_.D1.83.D0.BA.D1.81.D1.83.D1.81.D0.BD.D0.BE.D0.B9_.D0.BA.D0.B8.D1.81.D0.BB.D0.BE.D1.82.D1.8B_.D0.B8_.D1.8D.D1.82.D0.B8.D0.BB.D0.BE.D0.B2.D0.BE.D0.B3.D0.BE_.D1.81.D0.BF.D0.B8.D1.80.D1.82.D0.B0

So there isn’t russian text included to the formula on ipad ... on desktop it is fine!

Reply to "Bug at Math extension"

Math extension cannot connect to Restbase.

9
Tunglinwu (talkcontribs)

解析失敗 (MathML 使用 SVG 或 PNG 備用 (建議用於現代瀏覽器與輔助工具):從伺服器 "http://api.formulasearchengine.com/v1/" 收到無效的回應 ("Math extension cannot connect to Restbase.")。)

http://api.formulasearchengine.com/v1/ is error so many times.

Libattery (talkcontribs)
Libattery (talkcontribs)
193.10.97.111 (talkcontribs)
193.10.97.111 (talkcontribs)

This extension seems dead.

Plasma g (talkcontribs)

I was having the same problem, but by changing a line in LocalSettings.php to

$wgMathFullRestbaseURL= 'https://en.wikipedia.org/api/rest_';

and running "php update.php", the problem went away. So I think the above statement "This extension seems dead" is not the definitive word.

Ciencia Al Poder (talkcontribs)

Pointing $wgMathFullRestbaseURL to wikipedia doesn't seem to work since MediaWiki 1.30

193.147.143.68 (talkcontribs)

It works for me with MediaWiki 1.30 and LAMP on Ubuntu 18.04 machine

Ciencia Al Poder (talkcontribs)

I later discovered it doesn't work when you have RestBase installed and configured for Visual Editor. Otherwise it should work.

Reply to "Math extension cannot connect to Restbase."
Prh47bridge (talkcontribs)

Proceeding with this very slowly as time allows!

When Mathoid is running I try to test it using:

curl -d 'q=E=mc^2' localhost:10044

as per the manual. Instead of the expected result I get:

{"status":500,"type":"internal_error","title":"TypeError","detail":"Cannot read property 'semantic' of undefined","method":"POST","uri":"/","success":false,"log":"Cannot read property 'semantic' of undefined","error":""}

My log shows:

{"name":"mathoid","hostname":"ns3299566.ip-5-135-154.eu","pid":1442,"level":50,"message":"500: internal_error","stack":"TypeError: Cannot read property 'semantic' of undefined\n    at srePostProcessor (/usr/lib/node_modules/mathoid/lib/math.js:118:16)\n    at BBPromise.then.then (/usr/lib/node_modules/mathoid/lib/math.js:299:20)\n    at tryCatcher (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:512:31)\n    at Promise._settlePromise (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:569:18)\n    at Promise._settlePromise0 (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:614:10)\n    at Promise._settlePromises (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:693:18)\n    at Async._drainQueue (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:133:16)\n    at Async._drainQueues (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:143:10)\n    at Immediate.Async.drainQueues (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:17:14)\n    at runCallback (timers.js:789:20)\n    at tryOnImmediate (timers.js:751:5)\n    at processImmediate [as _immediateCallback] (timers.js:722:5)","status":500,"type":"internal_error","detail":"Cannot read property 'semantic' of undefined","levelPath":"error/500","request_id":"06e8ae51-0c1c-11e8-a75a-adde2b46ba51","request":{"url":"/","headers":{"user-agent":"curl/7.47.0","content-length":"8","content-type":"application/x-www-form-urlencoded","x-request-id":"06e8ae51-0c1c-11e8-a75a-adde2b46ba51"},"method":"POST","params":{"0":"/"},"query":{},"remoteAddress":"127.0.0.1","remotePort":53513},"msg":"500: internal_error","time":"2018-02-07T15:31:55.216Z","v":0}

As previously, nodejs version is 8.9.4.

Any ideas?

Reply to "Mathoid failing"
Prh47bridge (talkcontribs)

I'm currently getting the following error:

{"name":"mathoid","hostname":"ns3299566.ip-5-135-154.eu","pid":23337,"level":60,"err":{"message":"Cannot read property 'displayMessages' of undefined","name":"TypeError","stack":"TypeError: Cannot read property 'displayMessages' of undefined\n    at Object.exports.config (/usr/lib/node_modules/mathoid/node_modules/mathoid-mathjax-node/lib/main.js:864:14)\n    at initApp (/usr/lib/node_modules/mathoid/app.js:149:11)\n    at module.exports (/usr/lib/node_modules/mathoid/app.js:254:12)\n    at _requireModule.then (/usr/lib/node_modules/mathoid/node_modules/service-runner/lib/worker.js:165:80)\n    at tryCatcher (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:512:31)\n    at Promise._settlePromise (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:569:18)\n    at Promise._settlePromiseCtx (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/promise.js:606:10)\n    at Async._drainQueue (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:138:12)\n    at Async._drainQueues (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:143:10)\n    at Immediate.Async.drainQueues (/usr/lib/node_modules/mathoid/node_modules/bluebird/js/release/async.js:17:14)\n    at runCallback (timers.js:789:20)\n    at tryOnImmediate (timers.js:751:5)\n    at processImmediate [as _immediateCallback] (timers.js:722:5)","levelPath":"fatal/service-runner/worker"},"msg":"Cannot read property 'displayMessages' of undefined","time":"2018-01-16T10:44:55.156Z","v":0}

Nodejs version is 8.9.4

Any ideas?

137.82.12.118 (talkcontribs)

I added the following to my config, under mathoid conf section. It seems that the default mj_config is not populated for some reason.

mj_config:

extensions: "TeX/color,TeX/mediawiki-texvc,TeX/mhchem"

Prh47bridge (talkcontribs)

That worked. Thanks. Now to figure out how to set it up as a service and whatever else I need to do to get it running properly!

Reply to "Trying to get Mathoid to run"
Kaganer (talkcontribs)

These is needed?

Reply to "Extension:Math/newFeatures and listed subpages"

Help with Math extension error /index.php/Special:MathStatus Error from line 415 of /var/www/html/includes/libs/MultiHttpClient.php: Call to undefined function curl_multi_init()

1
120.29.36.246 (talkcontribs)

I am not clear what i need in Localsettings.php. I have texvc working as I run the test as per the read me with

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

(although not wit exact path as above) and that produce the png file as expected

LocalSettings.php

$wgShowExceptionDetails = true;

wfLoadExtension( 'Math' );

$wgDefaultUserOptions['math'] = 'mathml';

$wgMathFullRestbaseURL= 'https://api.formulasearchengine.com/';

Reply to "Help with Math extension error /index.php/Special:MathStatus Error from line 415 of /var/www/html/includes/libs/MultiHttpClient.php: Call to undefined function curl_multi_init()"
160.39.20.102 (talkcontribs)

I've been having a ton of trouble using the Math extension.

Special:MathStatus yields Internal error

[dff8cc5f986b85186244f9eb] /mediawiki/Special:MathStatus MWException from line 213 of /Applications/mediawiki/apps/mediawiki/htdocs/extensions/Math/MathRestbaseInterface.php: Math extension can not find Restbase URL. Please specify $wgMathFullRestbaseURL.

Dehilster (talkcontribs)

I too cannot get it to work. Centos on linux. I'm getting an internal error. I have installed it several times. No luck. No one answering me.

145.118.85.180 (talkcontribs)

I'm getting an error too:

[WPYKsU1ooVIAAEHCJnkAAAAG] /Special:MathStatus MWException from line 104 of /home/petters1/public_html/w/extensions/Math/MathRestbaseInterface.php: TeX input is invalid.

Backtrace:

#0 /home/petters1/public_html/w/extensions/Math/MathRestbaseInterface.php(395): MathRestbaseInterface->calculateHash()

#1 /home/petters1/public_html/w/extensions/Math/MathRestbaseInterface.php(95): MathRestbaseInterface->getContentRequest(string)

#2 /home/petters1/public_html/w/extensions/Math/MathRestbaseInterface.php(224): MathRestbaseInterface->getContent(string)

#3 /home/petters1/public_html/w/extensions/Math/MathRenderer.php(657): MathRestbaseInterface->getSvg()

#4 /home/petters1/public_html/w/extensions/Math/MathMathML.php(357): MathRenderer->getSvg()

#5 /home/petters1/public_html/w/extensions/Math/MathMathML.php(398): MathMathML->correctSvgStyle(NULL)

#6 /home/petters1/public_html/w/extensions/Math/MathMathML.php(466): MathMathML->getFallbackImage()

#7 /home/petters1/public_html/w/extensions/Math/SpecialMathStatus.php(70): MathMathML->getHtmlOutput()

#8 /home/petters1/public_html/w/extensions/Math/SpecialMathStatus.php(52): SpecialMathStatus->testSpecialCaseText()

#9 /home/petters1/public_html/w/extensions/Math/SpecialMathStatus.php(42): SpecialMathStatus->runMathMLTest(string)

#10 /home/petters1/public_html/w/includes/specialpage/SpecialPage.php(522): SpecialMathStatus->execute(NULL)

#11 /home/petters1/public_html/w/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run(NULL)

#12 /home/petters1/public_html/w/includes/MediaWiki.php(283): SpecialPageFactory::executePath(Title, RequestContext)

#13 /home/petters1/public_html/w/includes/MediaWiki.php(851): MediaWiki->performRequest()

#14 /home/petters1/public_html/w/includes/MediaWiki.php(512): MediaWiki->main()

#15 /home/petters1/public_html/w/index.php(43): MediaWiki->run()

#16 {main}

Spas.Z.Spasov (talkcontribs)
Reply to "Error using Math Extension"
Treesys (talkcontribs)

We have installed MediaWiki 1.29.1 (and php 7.1.9) on a Windows 2016 server. The math extension does not work, are you supposed to install Texvc if TeX formulas are used?

Reply to "Is texvc required or not?"

how to point to a local mathoid?

2
Plyd (talkcontribs)

I receive the error:

« Math extension cannot connect to Restbase. »

because the url called is:

http://localhost:10042/v1/media/math/check/tex (which gives 404)

although this example works fine :

curl -d 'q=E=mc^2' http://localhost:10042/

My LocalSettings.php :

wfLoadExtension( 'Math' );
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathValidModes[] = 'mathml';
$wgMathMathMLUrl = 'http://localhost:10042/';
$wgMathFullRestbaseURL = 'http://localhost:10042/';

What should I set to make it call directly http://localhost:10042/ or make mathoid listen to the correct path?

Thanks!

Libattery (talkcontribs)
Reply to "how to point to a local mathoid?"