Open Bug 236963 (stretch-mtd-math) Opened 20 years ago Updated 2 years ago

Stretchy characters don't stretch in mtd/math elements

Categories

(Core :: MathML, defect, P4)

defect

Tracking

()

People

(Reporter: gemi, Unassigned)

References

Details

Attachments

(2 files, 4 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116 Galeon/1.3.13
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116 Galeon/1.3.13

Style attributes like fontfamily, fontweight or color are not respected.
On the other fontstyle="normal" is respected, but
mathvariant="normal" is not, neither is mathvariant="fraktur" and
mathvariant="script", see 

http://www.w3.org/Math/testsuite/testsuite/Presentation/TokenElements/mi/mimathvariant13.xml

Stretchy arrows don't work in:
http://www.w3.org/Math/testsuite/testsuite/Presentation/TablesAndMatrices/mtable/mtableBsize2.xml



Reproducible: Always
Steps to Reproduce:
>Style attributes like fontfamily, fontweight or color are not respected.

These attributes are supported. It is only the mathvariant attribute that
doesn't work yet -- and that's bug 114365.

> Stretchy arrows don't stretch in table cells.
That's a separate issue. The usual practice is to report one issue per bug.

I am mutating this bug because there is nothing yet in bugzilla about strecthy
characters in math table cells. 

This bug is now meant for the problem that "stretchy characters don't stretch in
mtable cells".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: style attributes in mathml tags not respected → Stretchy characters don't stretch in mtable cells
OS: Linux → All
Hardware: PC → All
Sorry about mixing issues.
However I beg to disagree about the style attributes.
The attached image shows the rendering of the following:

      <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
	<mi fontfamily="Courier">A</mi>
	<mi fontstyle="normal">A</mi>
	<mi mathstyle="normal">A</mi>
	<mi color="blue">A</mi>
	<mi mathcolor="blue">A</mi>
	<mi fontweight="bold">A</mi>
	<mi mathvariant="bold">A</mi>
      </math>
Attached image style attributes not respected (obsolete) —
Attached image screenshot with a stock mozilla buidl (obsolete) —
Works for me on Win2K. Not sure why there should be any difference with the
Galeon build. Note: |mathstyle| is an invalid attribute and is ignored. Also
note that mathvariant="bold" resets everything except the font-size, i.e., in
the terminlogy of CSS, mathvariant="bold" is equivalent to style="font: medium
serif bold; font-size: inherit;" That's why there is a difference between
<mi fontweight="bold">A</mi> and <mi mathvariant="bold">A</mi>.
Also, stretching doesn't happen in a <math> tag if there's no enclosing mrow. 
This is contrary to the MathML spec since a math tag acts as an implied mrow.

(I've known about this problem for a few years, but it was recently brought to
my attention again.  Kind of a pain for automatic generation of MathML:  is
<math> an implied mrow or not?

My guess is that the <math> tag generates a frame which is not a
nsMathMLContainerFrame, hence doesn't participate in the stretchy computation.

If this testcase/bug is cluttering up this bug, I'd be happy to make a new bug.
But this bug seemed a bit confused anyway.)
On further thought, it may be that the problem mentioned in Comment #5 is the 
same as bug 219873.  (math tag doesn't know its height)
Getting the discussion back to the original title "Stretchy characters don't stretch in mtable cells".

I have observed this also. For example, the following two blocks should look the same:

<mtable>
    <mtr>
        <mtd>
            <mrow>
                <mo stretchy="true">(</mo>
                <mfrac><mi>x</mi><mi>y</mi></mfrac>
                <mo stretchy="true">)</mo>
            </mrow>
        </mtd>
    </mtr>
</mtable>

and

<mtable>
    <mtr>
        <mtd>
             <mo stretchy="true">(</mo>
             <mfrac><mi>x</mi><mi>y</mi></mfrac>
             <mo stretchy="true">)</mo>
        </mtd>
    </mtr>
</mtable>

because the <mtd> should contain an implied <mrow>. However, they render differently (Firefox 1.5); the parentheses stretch in the first one but not in the second.
Stretching in the case of table cells is complicated by the fact that it has to be resolved based on the height of the whole row (or the width of the whole column). For example, if you have:

<mtable>
    <mtr>
        <mtd>
             <mo>(</mo>
             <mfrac><mn>1</mn><mn>2</mn></mfrac>
        </mtd>
        <mtd>
             <mfrac>
                 <mfrac><mn>1</mn><mn>2</mn></mfrac>
                 <mfrac><mn>3</mn><mn>4</mn></mfrac>
             </mfrac>
             <mo>)</mo>
        </mtd>
    </mtr>
</mtable>

Then, the left paranthesis and the right parenthesis should stretch to the same height.

Picture the left/right/up/downarrows of a commutative diagram for example. They should stretch automatically if at least the minsizes of one vertical arrow and one horizontal are given. That is, the stretching will be passed on to the other arrows to make the whole thing look uniform.  That's why this bug is quite involved.
I don't see why this bug, narrowly construed, is so "involved." If the Spec says: <math> (or <mtd> or whatever) has an implied <mrow>, then the behaviour should be the same whether one places an explicit <mrow> or one doesn't.

But the behaviour is not the same.

Which is a bug.
Details on stretching operators within tables are here:

http://www.w3.org/TR/MathML3/chapter3.html#id.3.2.5.8.2
The special rules for operator stretching in tables seem to only apply when the operator is the "sole direct sub-expression of an mtd element".

http://www.w3.org/TR/MathML3/chapter3.html#presm.inferredmrow implies that

<mtd>
  <mo>&stretchyoperator;</mo>
</mtd>

"is treated as if it were"

<mtd>
  <mrow>
    <mo>&stretchyoperator;</mo>
  </mrow>
</mtd>

which seems contradictory as the operator would no longer be a direct sub-expression.

I guess the intention is that we should read the inferred mrow statement backwards and treat the form with the explicit mrow in the same manner as is specified for the form with and inferred mrow.

The operators for parentheses in comment 8 are not sole direct sub-expressions, so they should only stretch to the height of the implied mrow within their individual mtd.
(In reply to comment #11)
> The special rules for operator stretching in tables seem to only apply when the
> operator is the "sole direct sub-expression of an mtd element".
> 
> http://www.w3.org/TR/MathML3/chapter3.html#presm.inferredmrow implies that
> 
> <mtd>
>   <mo>&stretchyoperator;</mo>
> </mtd>
> 
> "is treated as if it were"
> 
> <mtd>
>   <mrow>
>     <mo>&stretchyoperator;</mo>
>   </mrow>
> </mtd>
> 
> which seems contradictory as the operator would no longer be a direct
> sub-expression.
> 
> I guess the intention is that we should read the inferred mrow statement
> backwards and treat the form with the explicit mrow in the same manner as is
> specified for the form with and inferred mrow.
> 

	Actually, according to the section "inferred <mrow>s" the children are treated as a single mrow only "if the number of children is 0, or is more than 1". Hence the rule of the "sole direct sub-expression" still applies. Moreover it is also the case with the explicit mrow, according to the rule of the "<mrow> of one argument":

http://www.w3.org/TR/MathML3/chapter3.html#id.3.3.1.3.1
QA Contact: ian → mathml
Blocks: mathml-2
Assignee: rbs → nobody
Alias: stretchy-in-cells
Blocks: 557086
Attachment #143511 - Attachment is obsolete: true
Attachment #143558 - Attachment is obsolete: true
Attached file Testcase for mtd (obsolete) —
Here is a testcase for mtd. It seems that MathJax uses mfenced.
Alias: stretchy-in-cells → stretch-mtd-math
Summary: Stretchy characters don't stretch in mtable cells → Stretchy characters don't stretch in mtd/math elements
Priority: -- → P5
Making this blocking MathJax as I suggested the team to use <mrow>+<mo> instead of <mfenced>.
Priority: P5 → P4
Blocks: 958947
Attached file Testcase (obsolete) —
Attachment #687059 - Attachment is obsolete: true
Attached file Testcase
Attachment #8499983 - Attachment is obsolete: true
Assignee: nobody → jkitch.bug
Assignee: jkitch.bug → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.