w3c / w3c/mathml

Missing property to indicate needed grouping?

Open
#523 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

intent
Dominant language
HTML
Stars
82
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Summary

Some intents are formed from linear notations and some from 2d notations. That information is lost when the intent is used and so the need to verbally group the intent (such as would be done for "fraction x plus 1 over y end fraction") is lost.

The Problem

Intent is typically layered on top of the presentation. Consider $(a+b) ⨯ c$. A likely mrow version of the intent would be:

   <math>
    <mrow intent="cross-product:infix($x, $y)">
      <mrow arg="x">
        <mo>(</mo>
        <mrow>
          <mi>a</mi>
          <mo>+</mo>
          <mi>b</mi>
        </mrow>
        <mo>)</mo>
      </mrow>
      <mo>⨯</mo>
      <mi arg="y">c</mi>
    </mrow>
   </math>

Because the presentation requires the parens and because they are likely to be part of the arguments to the intent, speech will naturally work because they will be spoken and listeners will understand what the arguments to the cross product are.

However, a \binom macro, An author/generating software would understand how that is laid out and would know that no parens are needed assuming it generates a 2D layout such as $\binom{n+k}{j+1}$. The corresponding concept is binomial-coefficient:infix and the MathML would be:

<math>
  <mrow intent="binomial-coefficient:infix($a, $b)">
    <mo>(</mo>
    </mrow>
    <mfrac linethickness="0">
      <mrow arg='a'>
        <mi>n</mi>
        <mo>+</mo>
        <mi>k</mi>
      </mrow>
      <mrow arg='b'>
        <mi>j</mi>
        <mo>+</mo>
        <mn>1</mn>
      </mrow>
    </mfrac>
    <mo>)</mo>
  </mrow>
</math>

Because this is a core concept, MathCAT knows that "binomial-coefficient" should be spoken as "choose", so "a choose b" or with more complicated args from the example "binomial coefficient n + k choose j + 1 end binomial coefficient". But for open concepts, there is nothing to say grouping around the construct is needed. MathCAT could decide to add parens around the arguments, or more accurately, it could add start xxx/end xxx as it does for fraction. But what tells MathCAT that this needs to happen for xxx:infix but not cross-product:infix?

Potential Solution

One potential solution is to say that AT needs to figure this out. In a simple case like above, the AT can look at the argument and if is non-trivial and not bracketed, look at the ancestors up to the element with the intent. If there is ancestor that has 2D layout (maybe not counting the base of msub, munder, etc.). If any of the arguments has a 2D ancestor, then bracketing words "start binomial ... choose ... end binomial" potentially are used.

I'm not sure this always works though with reference args. For example, what if the intent were $f($x, $y)? Is the stopping point still the intent? Is there a more complicated example where it isn't the element with the intent but some descendent?

Another potential solution is to add a property where the author says whether this requires grouping/bracketing. In a discussion with @davidcarlisle, he suggested a :grouped or :fenced property. If we introduced a similar property, is AT constrained to use it if present and assume its absence indicates that it should not be grouped?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's MathML intent examples and the discussion of :grouped or :fenced; compare the proposed ancestor-based behavior with author-supplied metadata. No files or tests are named. Done requires an agreed specification for grouping semantics, including open concepts and reference arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
accessibility
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.