# Description

The \mathbin{C} and \mathrel{C} should add extra space around the character. 4/18th of an em to \mathbin and 5/18th of an em for \mathrel.

The desired behavior is discussed at
http://tex.stackexchange.com/questions/38982/what-is-the-difference-between-mathbin-vs-mathrel

The current spacing with the MathML/SVG rendering misses any extra spacing.

Status:

# Details

### Event Timeline

Restricted Application added a subscriber: Aklapper. Oct 15 2016, 10:00 PM

In some cases the spacing should depend on the context. The ordinary plus sign is a binary operator, and when one types "5+3", the spacing to the right of "+" is conspicuously larger than what it is when one types "+3", using "+" as a unary operator. Similarly in a\ln b and a\ln(b), the spacing to the right is different: much smaller in the latter.

This is a texvcjs bug.

A \mathrel{C} B turns into A{\mathrel {C}}B (same for \mathbin) and that messes up TeX layout.

The output is the expected result for the texvc output.

Pkra triaged this task as Medium priority.Dec 7 2018, 8:49 AM

Based on Pkra's observation above, it seems like all that needs to be done here is in texutil.js (link) to comment out \\mathbin and \\mathrel at lines 669 & 678 and to move them to fun_ar1nb instead (line 714). But, I'm certainly not 100% sure that this would work...very little of this is documented and I have no way to actually test it, and I certainly don't know how to actually get anything done around here.

Will anyone actually see this? Am I just talking into the void?

@Physikerwelt now that the workflow problems of T207535 are solved, might this be an easy fix?

Physikerwelt set the point value for this task to 2.Sep 17 2020, 7:23 AM

Change 628048 had a related patch set uploaded (by Physikerwelt; owner: Physikerwelt):
[mediawiki/services/texvcjs@master] Correct spacing for \mathbin and \mathrel

https://gerrit.wikimedia.org/r/628048

It should work on with the demo on https://mathoid2.wmflabs.org can someone double-check that before we go through this deployment process again, please?

I'm having problems getting anything sensible out of the mathoid server. I'm getting lots error messages in the console and I can't see if its doing anything

Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

With firefox:
Content Security Policy: The page's settings blocked the loading of a resource at inline ("default-src").

Both running under windows.

p.s. The https://en.wikipedia.org/wiki/Simply_typed_lambda_calculus page makes very heavy use of \mathbin so might be good for testcases.

I think security problems might be related to this bug
I've a feeling the webserver is configured to set default headers which restrict what can be done.

x-content-security-policy
default-src 'self'; object-src 'none'; media-src *; img-src *; style-src *; frame-ancestors 'self'

there does not appear to be a script-src item.

I am using Firefox on Windows ... strange

I'll add another issue for the csp problem. Indeed all the js is in a script tag in the html page. I guess changing that would resolve the issue. Indeed I can reproduce the problem with chrome

I've run some examples from https://en.wikipedia.org/wiki/Opposite_group, Which uses \mathbin and all look good.

With and example from https://en.wikipedia.org/wiki/Galves%E2%80%93L%C3%B6cherbach_model

X[t'\mathrel{:}t]

in Firefox MathML and SVG are giving slightly different spacing

it looks a little too much spacing in SVG to me.

But in chrome the MathML is buggy. \mathbin also fails in Chrome

@SalixAlba Thanks for testing. Thus I think the change is an improvement and the other problems you describe did exist before? While I see that the other problems would be good to fix, the model to fix one thing at a time works best if we fix one problem at a time.
I don't see the problem with \mathrm in chrome canary Version 87.0.4268.0 with experimental web platform features enabled. However, the apostrophe is to my subjective impression too high.

So I would go ahead and prepare the deployment?

@SalixAlba what do you think. Should I prepare the deployment of the implemented change or is more work required?

MathML errors are more likely to be problems with chrome's rendering.

Change 629134 had a related patch set uploaded (by Physikerwelt; owner: Physikerwelt):
[mediawiki/services/texvcinfo@master] Update dependencies

https://gerrit.wikimedia.org/r/629134

Change 629138 had a related patch set uploaded (by Physikerwelt; owner: Physikerwelt):
[mediawiki/services/mathoid@master] Release mathoid 0.7.5

https://gerrit.wikimedia.org/r/629138

@AMooney @Clarakosi Thank you for looking into this. Please let me know if you have any questions, since improving documentation and reducing the bus factor is a side project of the new review process.

Change 628048 merged by jenkins-bot:
[mediawiki/services/texvcjs@master] Correct spacing for \mathbin and \mathrel

https://gerrit.wikimedia.org/r/628048

@ Clarakosi thank you for your code review. To publish the npm module you need to get access to npm T259001

Change 629134 merged by jenkins-bot:
[mediawiki/services/texvcinfo@master] Update dependencies

https://gerrit.wikimedia.org/r/629134

Change 629138 merged by jenkins-bot:
[mediawiki/services/mathoid@master] Release mathoid 0.7.5

https://gerrit.wikimedia.org/r/629138

Change 641514 had a related patch set uploaded (by Clarakosi; owner: Clarakosi):
[operations/deployment-charts@master] Mathoid: Update mathoid to use the latest tag

https://gerrit.wikimedia.org/r/641514

Change 641514 merged by jenkins-bot:
[operations/deployment-charts@master] Mathoid: Update mathoid to use the latest tag

https://gerrit.wikimedia.org/r/641514

The changes have been deployed and published on npm so I'm marking as resolved but please reopen if there is more work to be done

curl -X POST "https://en.wikipedia.org/api/rest_v1/media/math/check/inline-tex" -H  "accept: application/json" -H  "Content-Type: multipart/form-data" -F "q=A \mathrel{C} B 2020-11-18"
curl -X POST "https://en.wikipedia.org/api/rest_v1/media/math/check/inline-tex" -H  "accept: application/json" -H  "Content-Type: multipart/form-data" -F "q=A \mathrel{C} B 2020-11-17"