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.

"Math extension cannot connect to Restbase"

Jameshfisher (talkcontribs)
Reply to ""Math extension cannot connect to Restbase""

$wgMathValidModes are ignored on Mediawiki 1.35.1

1 (talkcontribs)

$wgMathValidModes does not forbid user or server to use the excluded options. I tested only on Mediawiki 1.35.1. For example, the below LocalSettings.php allows user to use 'source' or 'png':

wfLoadExtension( 'Math' );
$wgMathValidModes[] = 'mathml';
$wgDefaultUserOptions['math'] = 'mathml';
Reply to "$wgMathValidModes are ignored on Mediawiki 1.35.1"

Google Chrome bug causes incorrect formula display

Lady G2016 (talkcontribs)

The MediaWiki support desk is reporting a bug with the Windows 10 version of Chrome. Chrome fails to display the minus '-' sign when zooming at certain levels of magnification.

Please see: Minus sign not visible in chrome on following page

How can this be reported to the Chrome developers?

Reply to "Google Chrome bug causes incorrect formula display"

I cannot see the math formula while editing in visualEditor

Amglez (talkcontribs)

After you close the math editor, you cannot see the math formula you have create so in editing mode you do not see that there is a math code there (but you can see it is if you change to the code view).

This makes editing it afterwars quite dificult.

Tacsipacsi (talkcontribs)

Do you happen to use the Native MathML Firefox extension? VisualEditor has become incompatible with it a few months(?) ago. Probably VisualEditor needs to be fixed, but as a workaround you can disable the extension while editing formulæ in VE.

Amglez (talkcontribs)

Thank you very much for your answer. I disabled the extension and everything works again.

Tacsipacsi (talkcontribs)

@Amglez: The fix has been released, so now you can re-enable the extension and it will work correctly while editing in VisualEditor.

Reply to "I cannot see the math formula while editing in visualEditor"
Cuppajoelad (talkcontribs)

In my settings I have explicitly set the render to be `mathml`, see these lines in my `LocalSettings.php`

# Allow Mathmatical formatting

wfLoadExtension( 'Math' );

$wgMathValidModes = ['mathml'];

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

Anything I write in the math tags always shows up as an svg.

For example one of them lead to this link: https://wikimedia.org/api/rest_v1/media/math/render/svg/a137aa404d27ba648640b3badea2c0c53e45989c, which seems to explicitly be asking for an svg, pasting that link in a new tab with svg replaced by mml yields:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" alttext="{\displaystyle M_{f}\left(n\right)=\left\lfloor \log _{2}(n)\right\rfloor +1}">


    <mrow class="MJX-TeXAtom-ORD">

      <mstyle displaystyle="true" scriptlevel="0">



          <mrow class="MJX-TeXAtom-ORD">















              <mrow class="MJX-TeXAtom-ORD">





            <mo stretchy="false">(</mo>


            <mo stretchy="false">)</mo>








    <annotation encoding="application/x-tex">{\displaystyle M_{f}\left(n\right)=\left\lfloor \log _{2}(n)\right\rfloor +1}</annotation>



Which gives the correct MathML output. I wanted to know if this issue was just on my wiki, so I looked on wikipedia, went to appearance in the preferences and the math option was checked on MathML with svg fallback. Then I went to a page on wikipedia and it also indeed only loaded svg's...

Not sure what's going on here, but any explanation/fix would be highly appreciated!

Cscott (talkcontribs)
Cuppajoelad (talkcontribs)

After some discussion on IRC we determined the problem was simply that my browser (chrome based) didn't have support for mathml, and then having a closer look at Extension:Math#Viewing math shows us that we need a certain extension. After installing said extension, everything works right.

Reply to "SVG is always rendered"
Cuppajoelad (talkcontribs)

Hi, I just installed this plugin, but I have no idea of the extents of which I can use latex. Is it just normal latex, are there certain packages used, can we modify which packages are available etc... I can't find any information on how to actually use this extension.

Physikerwelt (talkcontribs)
Cuppajoelad (talkcontribs)

Thanks, though I still don't know what packages are included in the math tags, can I use my own custom latex packages? I'd like to create algorithms, but each option requires the import of a package, is this possible? Where can I learn more?

Physikerwelt (talkcontribs)

This is really complicated. If you run it on your server and you trust that the input you can set Manual:$wgMathDisableTexFilter to 'always' and use a custom mathoid installation. This uses mathjax in the background and in theory you might be able to use all the packages that exist for MathJax. However, for algorithms you should be better off with extension Extension:SyntaxHighlight. Extension math was designed only for math and some chemestry. (talkcontribs)

I think your right. As of right now I will use the following example from wikipedia to write my pseudocode:

algorithm Halton-Sequence is
    inputs: index 
    output: result 


    while  do


Although it would be great if we could render tikz directly through mathoid (not sure if that's possible)

Cuppajoelad (talkcontribs)

The above comment was me (forgot to login).

Reply to "Documentation?"

Math only displayed as raw tags

3 (talkcontribs)

Hello! I am on a brand new installation of MW and I cannot seem to get the Math extension to function properly. No matter what I do, <math>E=mc^2</math> is just displayed as the raw input, <math>E=mc^2</math>

(not with this computer code markup of course). Does anyone have an idea what I can try?

Versions are as such:

MediaWiki 1.35.0
PHP 7.4.3 (apache2handler)
MariaDB 10.3.25-MariaDB-0ubuntu0.20.04.1
ICU 66.1
Lua 5.1.5

and I have installed Math version 3.0.0 (b5a8f57) 12:52, 13 July 2020 (as seen in the Special:Version page).

I followed the installation instructions, including $wgDefaultUserOptions['math'] = 'mathml', running the update procedure, and setting

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

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

$wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org/';

On the special page MathStatus I get the following output:

This page displays information about the enabled math rendering modes.

The following rendering modes are enabled:

PNG images

LaTeX source (for text browsers)

MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools)

Running backend tests for rendering mode MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools).

Test Rendering the input "x^2+\text{a sample Text}" succeeded.

Test Comparing to the reference rendering succeeded.

Test Rendering of a+b in plain MathML mode succeeded.

Test Checking the presence of '+' in the MathML output succeeded.

Test Comparing the generated SVG with the reference failed.

Test Checking if MathML input is supported succeeded.

Test Rendering Presentation MathML sample succeeded.

Test Checking if the link to SVG image is correct succeeded.

Backend tests for rendering mode MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools) completed. (talkcontribs)

Well, feel free to delete this. For some reason my text was enclosed in nowiki tags by default. I do not know why; maybe me not understanding the visual editor. The test that fails is still an open question to me but maybe of lesser importance (Test Comparing the generated SVG with the reference failed.)

Tacsipacsi (talkcontribs)

The visual editor works with WYSIWYG text, not with wikitext, so in order to accurately represent what you see (the raw wikicode), it surrounds it with <nowiki>. This is expected. I don’t know what’s the case with the failing test, but it also fails on this wiki (see Special:MathStatus), so no difference compared to your wiki.

Reply to "Math only displayed as raw tags"

Math extension stopped working

Summary by Fokebox

After upgrading to MW 1.35 all works now

Fokebox (talkcontribs)


I had following settings and all worked fine:

wfLoadExtension( 'Math' );
// Set MathML as default rendering option
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'https://en.wikipedia.org/api/rest_';
$wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org/';

But today I have noticed that extension does not work anymore showing mistake: Math extension cannot connect to Restbase

What had happened and how can I fix it?

BBUCommander (talkcontribs)

Experiencing the same issue on MW 1.3.0 after upgrading to PHP 7.4.3. Upgrading MW to 1.3.5 resolved the issue.

Fokebox (talkcontribs)

After upgrading to MW 1.35 all works now

Raw <Math> tag in visual editor edit and math formula editor

2 (talkcontribs)

I followed every step but raw <Math> tag shows in visual editor edit and math formula editor.

It's fine in view mode. (talkcontribs)

I tried to build Mathoid Server myself, but it seems to have failed.

It is a bit slow when used with the following content, but it is working.

Please let me know if there is a fast wgMathMathMLUrl in Asia.

// Set MathML as default rendering option

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

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

$wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org/';

Reply to "Raw <Math> tag in visual editor edit and math formula editor"
Angryitguy (talkcontribs)

Hello! I am new to mediawiki and have inherited an environment that is currently running a mediawiki server. I was asked to get the Math extension installed for my users, and I believe I have done so correctly. However, my user is seeing an error displayed on the page, showing the following:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("$3") from server "$2":): {\displaystyle \nabla \cdot E = \rho/\epsilon_0 }

I have seen similar articles referring to this error, but they seem to be showing a RESTbase issue. I can provide additional information if needed, I thank you all for your time

Reply to "Math extension error"