-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TeX-like spacing rules #141
Comments
I plan to remove the LaTeX section and move the “cramped” description in a new embellished operator section. The rest of the section is about the LaTeX spacing, I'm going to remove it. Just copying it here for the record:
|
Perhaps a separate issue, but since this fits under the TeX-like spacing rules, I'm putting it here. The spec currently uses the word may, which is something we should get rid of for consistency among renderers:
Firefox makes a compromise that for scriptlevel>0, lspace and rspace are divided by 2. |
where is it in the spec?
I'm not aware of that, do you have a link to the code? |
Apparently I was looking at an older version. I can't find it now. In any case, we should make sure we all agree the current behavior is what we want (I do) because it differs from TeX (and Firefox). |
@NSoiffer What is the proposal here? I don't think the spec/tests have anything like what Gecko does. |
My proposal is that we follow MathML's spacing rules, not TeX's and not the Gecko "compromise". Here's my rationale:
I tend not to like arguments based on "it's easier to implement", but since that argument has come up a lot in MathML core discussions, not making scripts special means a small reduction in the spec and implementation. If it is helpful to this discussion, I can generate a some examples that compare TeX's rules to MathML's rules specifically for scripts. |
The argument is not whether "it's easier to implement" but "is the feature important enough for adding extra spec, test, implementation & maintenance cost". Note that MathJax intentionally always follows TeX spacing by default not MathML spacing, so that might be something important. Regarding this particular case, with a CSS scriptlevel property and the removal of mfenced, this is only one extra line in the code. Also this is one extra sentence in the spec and one specific test (I guess we will need a test for spacing in scripts anyway). So this specific rule is not too intrusive compared to other MathML3 features we removed. That said, if nobody has strong opinion on keeping it I'm happy to remove it. Explicit lspace/rspace can always be used to tune operator spacing. |
Here are a few examples. TeX input:
Simulated MathML input to TeX:
Simulated Gecko input to TeX:
The following are rendered by quicklatex.com (couldn't render the Gecko Version) |
Much to my surprise, my favorite of the three rendering rules is the Gecko version. My least favorite is the TeX version although I don't like the spacing around the '=' in the MathML rules. |
Consensus from 2019/11/11: postpone so that people can check |
@NSoiffer What is the MathJax config you use? As I said above MathJax does not follow MathML spacing by default. See "mathmlSpacing" in https://docs.mathjax.org/en/latest/options/output/ |
Here's the header I used:
<script type="text/javascript"
src="
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
V3.0 has a bug <mathjax/MathJax#2241> with it's
interpretation of spacing in scripts, so I used the older version.
MathJax uses TeX rules. My comment shows the modifications I made to the
TeX to manually add spacing.
…On Tue, Nov 12, 2019 at 3:08 AM Frédéric Wang ***@***.***> wrote:
@NSoiffer <https://github.com/NSoiffer> What is the MathJax config you
use? As I said above MathJax does not follow MathML spacing by default.
See "mathmlSpacing" in https://docs.mathjax.org/en/latest/options/output/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/mathml-refresh/mathml/issues/38?email_source=notifications&email_token=AALZM3CCLXVZ7V5QELASBOLQTKFC5A5CNFSM4GZHD6H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZ4TBA#issuecomment-552847748>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALZM3A2PVPR64XA5YTVDGTQTKFC5ANCNFSM4GZHD6HQ>
.
|
From the Nov 18 meeting minutes, here is what @davidcarlisle said/found: I looked at TeX, in classic TeX the script font (cmr7) is noticeably wider than 10pt scaled 70%, which means that the effects of TeX not adding space are less pronounced. With xetex/luatex and a scaled font (Stix Two here) it is perhaps more noticable and having the renderer add some space might be better. Here are details: Stix2
|
I think relying on TeX's space commands to "simulate input" and using quicklatex.com or MathJax with TeX spacing rules to render them is a bit unreliable. I attached screenshots for all browsers and modern TeX engines, using their own default spacing rules. |
@fred-wang which fonts were you using with xetex and luatex? I note you are using plain syntax and plain has no standard way to use the opentype math table layout rules. |
@davidcarlisle What do you mean by plain syntax? All browsers and tex engines are using Latin Modern Fonts AFAIK. |
|
I'm not sure, but I can't build my document with luatex and xetex. I had to use lualatex and xelatex. |
@fred-wang you only showed the math fragments not the full tex document so I couldn't really tell very easily (hard to compare 8bit type 1 latin modern from the opentype version just from a png image) but if you used latex and didn't use the unicode-math package then it's unlikely to be using opentype math (of course it is possible but you would need to completely over-write the latex math support , which is what unicode-math does) |
@davidcarlisle i updated the screenshot, using unicode-math |
@fred-wang: for completeness, can you provide the full files you used to do the layout? The link you provide to the igalia site only has the math, so no one can replicate what you did and try out other similar variations. |
@NSoiffer page updated. |
With scriptlevel merged into font-size ( https://github.com/mathml-refresh/mathml/issues/174 ) it's no longer possible to know when we are in a script and apply rules from https://github.com/mathml-refresh/mathml/issues/38#issuecomment-541630188 At least I think Chromium can access the scriptlevel internally ( https://chromium-review.googlesource.com/c/chromium/src/+/2184131/13/third_party/blink/renderer/core/style/computed_style_extra_fields.json5 ) but I'm not sure whether it is legit to specify it that way or if we should instead expose a separate new boolean CSS property. I would avoid introducing TeX-like spacing rules contradicting MathML3 in the first version of core anyway as that probably needs more discussion / thoughts. |
"Follow-up of w3c/mathml#30 (closed), this is an entry to discuss spacing rules:
For now, the implementation note only says that only operator lspace/rspace and italic correction adds spacing in row-like elements: http://www.mathml-association.org/MathMLinHTML5/S3.html#SS3.SSS1
TeX spacing is mentioned here: http://www.mathml-association.org/MathMLinHTML5/S2.html#SS2.SSS2
Gecko's non-standard rules: http://hg.mozilla.org/mozilla-central/file/tip/layout/mathml/nsMathMLContainerFrame.cpp#l1058
"
original report: https://gitlab.com/mathml/MathMLinHTML5/issues/32
The text was updated successfully, but these errors were encountered: