Forum Bugs

MathML Floor Operator Stretching Problem with Fractions

alexmilowski
I'm using a mfenced with the floor operators around a fraction (mfrac) and the operator isn't stretching to the full height of the fraction. It aligns properly with the baseline of the fraction but doesn't stretch to the full height. The result is something that isn't mathematically correct as it looks like the floor operator only applies to the denominator.

Any advice on how to fix this would be greatly appreciated.

I have this MathML:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>s</mi>
<mo>=</mo>
<mfenced open="⌊" close="⌋">
<mfrac>
<msup>
<mi>λ</mi>
<mo>'</mo>
</msup>
<msub>
<mi>λ</mi>
<mi>s</mi>
</msub>
</mfrac>
</mfenced>
<mfenced open="⌊" close="⌋">
<mfrac>
<mn>360</mn>
<msub>
<mi>ϕ</mi>
<mi>s</mi>
</msub>
</mfrac>
</mfenced>
<mo>+</mo>
<mfenced open="⌊" close="⌋">
<mfrac>
<msup>
<mi>ϕ</mi>
<mo>'</mo>
</msup>
<msub>
<mi>ϕ</mi>
<mi>s</mi>
</msub>
</mfrac>
</mfenced>
<mo>+</mo>
<mn>1</mn>
</math>
mikeday
The output I get looks like this:
floor.png

Does it look the same for you?
  1. floor.png6.6 kB
    Screenshot
alexmilowski
No.

Maybe I don't have the right font setup?
mikeday
Which operating system are you running Prince on? Which fonts are used in the PDF file, if you check under Document Properties > Fonts? Are you just converting the MathML fragment that you posted above, or is it embedded in a larger HTML document?
alexmilowski
OS X 10.8.4. There are several fonts ... what am I looking for? I also have the STiX fonts available too.

I'm using Prince 9.0.

The MathML is in a larger HTML document. I just ran it through as a separate MathML document and I got the same results.

My CSS doesn't do anything with the MathML. I don't specify fonts or any other properties. The built-in styles for MathML (lib/prince/style/mathml.css) don't seem to do very much either.
  1. floor.mml0.5 kB
    MathML Input
  2. floor.pdf36.4 kB
    PDF Output
mikeday
It seems that these glyphs in the Arial Unicode MS font are short and don't reach to the full height of other glyphs. Here is an example using three different fonts with the same text:
floor.png

The first is Arial Unicode MS, and you can see that the bars don't reach up as far as the second two examples, which use the OpenSymbol font and DejaVu Serif font respectively.

So you could try using the OpenSymbol font, which isn't installed on MacOS X but is freely available online. I'm not sure if there is any other solution to this issue, unless there is a better font on that is installed on MacOS X by default and has the necessary glyphs.
  1. floor.png1.9 kB
    Screenshot
alexmilowski
I installed the STIX fonts [1] and everything seems to work fine.

Wouldn't it make sense to add:

font-family: "STIX";

to the CSS rules in lib/prince/style/mathml.css ?

[1] http://www.stixfonts.org/
thomasdumm
I also vote for the "Integrate the STIX Fonts with Prince for improved MathML support" on the roadmap.

www.delivros.ch

Edited by thomasdumm

thomasdumm
I do not understand why the 'Arial Unicode MS' has to be declared as a serif font in C:\Program Files (x86)\Prince\Engine\style\fonts.css.

Otherwise the MathML is working now with Arial and Arial Unicode MS with a C:\Program Files (x86)\Prince\Engine\style\fonts.css containing nothing but:

@font-face {
font-family: sans-serif;
src: local("Arial")
}

@font-face {
font-family: serif;
src: local("Arial Unicode MS")
}

www.delivros.ch

Edited by thomasdumm

mikeday
Arial Unicode MS is a "last-resort" font, which contains glyphs for almost all Unicode characters. So Prince uses it as a fallback if there are no glyphs in any of the other specified fonts.