Recently at English Wikipedia's Help talk:Displaying_a_formula (sorry, the editor here won't actually let me link), a user raised a reasonable complaint. In Preferences / Appearance / Math, the two radio button options are to render math as LaTeX source or as SVG. The typical user doesn't know what either one is. They just want to see well-typeset math, like in publications. So how about re-wording the second option? Maybe "publication-like notation rendered via SVG"? Or something better! Thanks.
Extension talk:Math
I have installed Math version 3.0.0 (7fac46b) today, as seen in the Special:Version page( My wiki version 1.37.1). Following the instructions I run the updatescript, my screen show's this:
...collations up-to-date.
...index rc_name_type_patrolled_timestamp already set on recentchanges table.
...rev_page_id index already non-unique.
...pl_namespace, tl_namespace, il_to indices are already non-UNIQUE.
...h
and Its still running.
Is there a so;lution/option to shorten this process??
Hi,
I'm trying to understand where the Math extension writes temporary files as I want to check the folder permissions. Can anyone point me in the right direction?
I am basically trying to solve an issue where the rendering fails and when I check Math Status in the special pages on my wiki it shows:
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 failed.
Test Checking if the link to SVG image is correct failed.
Backend tests for rendering mode MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools) completed.
As you can see the first failure is where it tries to compare the generated SVG with the reference. I am curious as to whether it is unable to save the generated SVG to the temporary directory.
Hope someone can help me out as I've been trying to solve this for several days now.
Many thanks in advance.
The code is quite complicated, but I don’t think it tries to save the image into a temporary directory at all – instead, it reads the reference image from the images/
directory, and compares it with the generated image in memory. Since SVGs are text files, one possible issue may be wrong line ending. Are you on Windows?
Special:MathStatus also seems to log a fair amount of information. Did you enable debug logging (see Manual:$wgDebugLogFile)?
Hi @Tacsipacsi,
Many thanks for getting back to me.
I have been further investigating and found an example in the logs where the first three math equations in a page fail, but the fourth is successful. The error log shows:
(curl error: 56) Failure when receiving data from the peer
(curl error: 27) Out of memory
(curl error: 27) Out of memory
[http] HTTP complete: code=200 size=133 total=0.167406 connect=0.039775
This leads me to think that the failed to parse error is actually due to a memory issue on my web server. I will post any further updates I have here to hopefully help others that may have issues with the math extension.
If you think there is any there issue causing these errors, of course, please let me know.
Update.
My log file also showed the following error:
[http] Error fetching URL "https://wikimedia.org/api/rest_v1/media/math/check/tex": (curl error: 6) Couldn't resolve host name
The visible error on the media wiki page looked like:
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://en.wikipedia.org/api/rest_v1/":
I tried, but they did not work, the fixes explained by @Johanngan in this discussion topic:
What did work was increasing the memory on my web server to 2048MB. This should not have been necessary but it did solve my problem. I hope this may help others who run into the Math extension cannot connect to Restbase error message.
Thanks for sharing your solution. I’s indeed strange, 2 GiB is a lot… I’ll now close this thread, but feel free to reopen it if you have anything to add.
$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';
Same here. 1.35.x appears to ignore the settings to the configuration parameter.
hello, at the moment the extension simple math jax is the extension with setting for personalizate the formuls of math and chemistry, the extension have the config $wgSmjScale for change the size of the formuls, the extension math have that config similar?
See example broken page: https://en.wikipedia.org/wiki/Generalized_inverse
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?
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.
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.
Thank you very much for your answer. I disabled the extension and everything works again.
@Amglez: The fix has been released, so now you can re-enable the extension and it will work correctly while editing in VisualEditor.
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}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mi>M</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>f</mi>
</mrow>
</msub>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mrow>
<mo>⌊</mo>
<mrow>
<msub>
<mi>log</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msub>
<mo>⁡</mo>
<mo stretchy="false">(</mo>
<mi>n</mi>
<mo stretchy="false">)</mo>
</mrow>
<mo>⌋</mo>
</mrow>
<mo>+</mo>
<mn>1</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle M_{f}\left(n\right)=\left\lfloor \log _{2}(n)\right\rfloor +1}</annotation>
</semantics>
</math>
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!
This seems to work: https://en.wikipedia.org/wiki/User:Cscott/MathML -- it generates mathml, and also svg fallback. What were you expecting?
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.
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.
See w:Help:Math
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?
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.
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 base output: result while do return
Although it would be great if we could render tikz directly through mathoid (not sure if that's possible)
The above comment was me (forgot to login).