MathML image cropped in document

This code renders the desired equation (for Newtonian gravity) but it is cropped on the page

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="tml-display" style="display:block math;">
  <mrow>
    <mi>F</mi>
    <mo>=</mo>
    <mfrac>
      <mrow>
        <mi>G</mi>
        <msub>
          <mi>m</mi>
          <mn>1</mn>
        </msub>
        <msub>
          <mi>m</mi>
          <mn>2</mn>
        </msub>
      </mrow>
      <msup>
        <mi>r</mi>
        <mn>2</mn>
      </msup>
    </mfrac>
  </mrow>
</math>

and no fiddling with scale or spacing seems to uncrop it.

Can it be rendered correctly in Scrivener (I’m sure it would come out OK when compiled, but such things on the working page are like a paper cut to me… ouch, every time I touch it.)

NB MathML is a pain to write, so I used this site to translate TeX to MathML.

It might be your font that is cheating on its alleged pt size. (?)
See if it works better with a different font, and if so, you’ll have your answer.

Technically, I’m pretty sure it’s an image, but I tried anyway, just in case.

Alas, no.

It can be fixed, however, by adding an extra empty row into the MathML, so the beginning of the code block looks like this

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="tml-display" style="display:block math;">
  <mrow>
  </mrow>
  <mrow>
    <mi>F</mi>
    <mo>=</mo>

and the result looks like this (though note it got a bit smaller!)

image

A tiny bug, easily overcome! Issue closed.

1 Like

If it is an image, couldn’t you screenshot it at the space/size ratio you want it from the source and crop it yourself if needed ?

(You have a misspell btw. bteen)

I don’t believe exporting an image, changing it, and then importing it again would retain the MathML metadata. You wouldn’t be able to right-click on it and “Edit MathML…” to fix it.

That said though, are you using the dialogue box itself to try and fix the size of the image? Yes, I know, this whole setup is something only an engineer could love, but the width and height of the whole entire dialogue changes the amount of padding around the equation. (And the silliness of this is compounded by how the dialogue forgets how big it was before, and so you always have to change the size of the dialogue to fix the padding.)

Ha ha ha ha ha! And :laughing: :laughing: :laughing: :laughing: :laughing: for good measure.

this whole setup is something only an engineer could love, but the width and height of the whole entire dialogue changes the amount of padding around the equation

Surely not, I thought, incredulously, not doubting but mentally blinking furiously. 'Tis true - changing height and width of the dialog box affects the rendering. The dialog even declares this in the explicit “Hint…” at the bottom! (Gorilla on the basketball court.)

(But note, for me, vertical rendered size doesn’t change until the dialog height has been increased above a certain (?content dependant?) threshold).

This is one of the most brilliant examples of a complete disconnect between inspiration and execution, and I now absolutely love it! Dialog size controls resulting image size: brilliantly lateral; doesn’t remember, or give a live readout of numerical spacing: joyously undercooked (actually identical non-default output probably effectively unreproducible). I can almost hear the “I’ll do that tomorrow…” still whistling on the wind.

Thanks @AmberV I now have an equation that is not cropped and doesn’t contain redundant MathML, even if creating the MathML is, to all intents and purpose impractical without a (La)TeX->MathML converter and the spacing is set to “It is what it is.”; I’m not planning on writing a math textbook.

(Extra Q: I think I looked and the answer was “no”, but, is there any facility for inline LaTeX for math-y stuff?)

I wonder if there might be something different between high and low res monitors. For myself, on low res, even at the minimum height so that the text is right up against the edges, it doesn’t crop.

I think I looked and the answer was “no”, but, is there any facility for inline LaTeX for math-y stuff?

That would be great, but no there isn’t anything integrated for that. On the Mac there is this third-party tool that can essentially integrate a vector or raster image into any native Mac program that does rendering and editing much like this does—storing the metadata in the image. But I’m not aware of anything like that for Windows outside of OLE stuff that we can’t use directly in the Qt toolkit.

The monitor I’m using is 1920 x 1200 - I don’t know whether that’s high or low res these days.

Thanks for confirming I hadn’t overlooked anything re LaTeX on Windows.

It has to do with the size of the display, relative to that number. That many pixels on a phone would be high res, but spread across a 24" monitor would not.

94 DPI for future reference; so not “hi res”, but if it is “low res”, then it’s just my misfortune that I see a top edge crop - not a lot, but enough that the loss of aliasing makes the letter G clearly cropped. C’est la vie!