[whatwg] Mathematics on HTML5

Henri Sivonen hsivonen at iki.fi
Mon May 29 14:24:18 PDT 2006

On May 29, 2006, at 22:56, Mihai Sucan wrote:

> Another different take:
> If LaTeX is considered to be the best available language for  
> writing mathematical scientific documents, and the best for  
> printing too... why not have user agents implement it?

IIRC, IBM tried it as a plug-in in the Netscape 4 era. Netscape plug- 
ins had to be shipped separately, had no baseline integration with  
the surrounding text, couldn't read the input code from the host  
document, etc.

I think the following could be technically feasible:
  1) Author writes iTeX code as the text content of an <f> element  
for inline formulae (and <df> for display formulae; two elements to  
cut down on verbosity of attributes).
  2) The browser takes the textContent of the <f> element and the  
computed style for the list of fonts, the text color and the font size.
  3) The browser feeds this data to a sandboxed, pruned and heavily  
macro-deprived pdfLaTeX engine that renders the formula using the  
font properties as if the formula was a $...$ formula on an infinite  
line. (This means that line breaks cannot occur in formulae. Consider  
this a good enough approach for feasibility.)
  4) The pdfLaTeX engine hands back a PDF with a bounding box  
indicating the bounds of the rendering and the position of the baseline.
  5) The browser's CSS formatter replaces the box of the <f> element  
with a replaced element box of the size of the PDF bounding box and  
aligns the baseline of the replacement box with the baseline of the  
surrounding CSS line box.
  6) When it is time to draw, the browser draws the drawing  
operations encapsulated in the PDF into its underlying vector  
graphics pipeline.

Obviously, architecturally this would be a departure from DOM and  
CSS, but it could work. And because I guess the implementation would  
take more than a couple of days, I am not volunteering to prototype  
this. :-)

Henri Sivonen
hsivonen at iki.fi

More information about the whatwg mailing list