fontsize in mathml fractions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fontsize in mathml fractions

Del Wegener
Good Afternoon;

I am new to MathML and this is my first encounter with this list.

When I create rational expressions with MathML I do not want the
fontsize to decrease.  It does not in any textbook so should not on my
webpages.
I have stumbled across a means (using <mstyle displaystyle=true >) of
creating simple fractions with the fontsize of both numerator and
denominator the same as any other character in the document.

However, when I create complex rational expressions I have not found a
means of maintaining the proper fontsize.

The easiest example I can give is this page -- filled with complex
rational expressions.
http://www.drdelmath.com/examples/mathjax_examples_rational_expression_complex_simplifying.htm

Can anyone tell me how to fix the problem or point me to a good resource.

Del

_______________________________________________
dev-tech-mathml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-mathml
Reply | Threaded
Open this post in threaded view
|

Re: fontsize in mathml fractions

Frédéric WANG
Hi Del,

Per the spec,

http://www.w3.org/Math/draft-spec/chapter3.html#presm.mfrac

"The mfrac element sets displaystyle to "false", or if it was already
false increments scriptlevel by 1"

So you can indeed force the displaystyle to "true" to prevent the
scriptlevel incrementation, but you must do that for each mfrac. (if you
do that only for the outermost mfrac, then the displaystyle will still
be reset to false in the mfrac descendants and so the scriptlevel will
be incremented in them):

    <p>
      <math>
        <mstyle displaystyle="true">
          <mfrac>
            <mstyle displaystyle="true">
              <mfrac>
                <mn>3</mn>
                <mn>4</mn>
              </mfrac>
            </mstyle>
            <mstyle displaystyle="true">
              <mfrac>
                <mn>6</mn>
                <mn>7</mn>
              </mfrac>
            </mstyle>
          </mfrac>
        </mstyle>
      </math>
    </p>

Note that forcing displaystyle="true" has other implications. If you
only want to reset the scriptlevel, you can instead use the scriptlevel
attribute:

    <p>
      <math>
          <mfrac>
              <mfrac>
                <mstyle scriptlevel="0"><mn>3</mn></mstyle>
                <mstyle scriptlevel="0"><mn>4</mn></mstyle>
              </mfrac>
            </mstyle>
              <mfrac>
                <mstyle scriptlevel="0"><mn>6</mn></mstyle>
                <mstyle scriptlevel="0"><mn>7</mn></mstyle>
              </mfrac>
            </mstyle>
          </mfrac>
        </mstyle>
      </math>
    </p>

It's a been painful to have to use all these <mstyle> elements. Gecko
has CSS properties for scriptlevel and displaystyle but unfortunately
they are only used internally and not exposed to Web authors... Hence
you can not use a CSS selector to set everything in one go. However, you
can at least use the font-size property if you know the font size of
your paragraph, for example:

    <p>
      <style scoped="scoped">
        mfrac > * {
          font-size: 10pt;
        }
      </style>
      <math>
        <mfrac>
          <mn>1</mn>
          <mn>2</mn>
        </mfrac>
        <mfrac>
          <mfrac>
            <mn>3</mn>
            <mn>4</mn>
          </mfrac>
          <mfrac>
            <mn>6</mn>
            <mn>7</mn>
          </mfrac>
        </mfrac>
      </math>
    </p>

Of course, this will only work with CSS-compatible MathML renderers such
as the native implementations in Gecko or WebKit...

Hope that helps,

Le 21/02/2015 20:29, Del Wegener a écrit :

> Good Afternoon;
>
> I am new to MathML and this is my first encounter with this list.
>
> When I create rational expressions with MathML I do not want the
> fontsize to decrease.  It does not in any textbook so should not on my
> webpages.
> I have stumbled across a means (using <mstyle displaystyle=true >) of
> creating simple fractions with the fontsize of both numerator and
> denominator the same as any other character in the document.
>
> However, when I create complex rational expressions I have not found a
> means of maintaining the proper fontsize.
>
> The easiest example I can give is this page -- filled with complex
> rational expressions.
> http://www.drdelmath.com/examples/mathjax_examples_rational_expression_complex_simplifying.htm
>
>
> Can anyone tell me how to fix the problem or point me to a good resource.
>
> Del
>


--
Frédéric Wang
maths-informatique-jeux.com/blog/frederic

_______________________________________________
dev-tech-mathml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-mathml