Forum How do I...?

MathML Rendering Issue

pramodtiwari
There is some padding adds to the equation elements whenever there’s a superscript present in the equation.

I am sharing html file and PDF. Please have a look.
PFA

  1. out(1).pdf12.3 kB
    PDF file
  2. test1(1).html4.9 kB
    HTML file
mikeday
I don't think we will be able to address this issue in the short term, it may be worthwhile using MathJax or another tool to convert the MathML into SVG for now.
howcome
It's quite easy to use MathJax as a preprocessor, it will happily read your MathML and convert it into SVG.

For example, to convert your example to PDF in Linux, I did:

sudo apt install npm
sudo npm install -g mathjax-node-page
wget -O test.html \
   https://www.princexml.com/forum/post/22573/attachment/test1%281%29.html
mjpage < test.html > test-with-svg.html
prince test-with-svg.html


The first two lines install the "npm" package manager and the "mathjax" package.

The "wget" command fetches your example.

The magic happens in the next line, when "mjpage" converts the MathML markup in the HTML file to SVG.

In the last line, Prince happily converts the resulting HTML/SVG code into PDF.
  1. test-with-svg.html13.9 kB
  2. test-with-svg.pdf24.8 kB

Edited by howcome