# Re: Hindawi responsive equations

From: Peter Krautzberger <peter.krautzberger@mathjax.org>
Date: Tue, 15 Dec 2015 11:48:54 +0100
Message-ID: <CABqxo83CpzLUBpDDH6h6XXUsDwVK3Uok8Sp13nbSoapyvGO0vg@mail.gmail.com>
To: Bill Kasdorf <bkasdorf@apexcovantage.com>
Cc: "DPUB mailing list (public-digipub-ig@w3.org)" <public-digipub-ig@w3.org>
Hi,

Sorry for not responding sooner, Bill! It's great to see this can be shared
more widely. It's a really (really!) interesting work on line-breaking!

MathJax has supported automated line-breaks for a few years now so we know
how difficult it is to do a good job, especially on the web and especially
since most MathML is of pretty low quality (especially out of publishing
workflows -- sigh)  which makes it difficult to find good breakpoints.

I haven't seen people use MathJax-node for what Ahmed is doing on the
client yet, i.e., using server-side pre-processing to generate multiple
renditions with media queries. We should probably build a demo for that. I
do know that other people have been working on similar approaches, hiding
it in custom elements similar to <picture> (though nothing in public let
alone OSS, unfortunately).

Anyway, the real meat is in the pre-processing / analysis you could only
hint at, so I'm hoping there'll be more information on that. We have
funding from the Alfred P. Sloan foundation this year to pursue something
that goes beyond linebreaking, but with a similar underlying approach so it

We also analyze the MathML but we go for semantic structure and enrich the
MathML with that. This includes slightly re-writing the MathML which
happens to improve layout in general (did I mention that most MathML in the
wild is low quality? It really really is) and also helps improve
line-breaking.  We then similarly measure subexpressions, but primarily
from a semantic point of view (and also without taking measurements so far
since a) we don't need really need them and b) it would be very costly in
terms of performance on the client).

>From a visual end, what we went after was something beyond line-breaking
though, experimenting with a new way of handling math on small screens. For
that we built on ideas from assistive technologies and maps: summarizing
and collapsing. You can find code and demos at
https://github.com/mathjax/mathjax-respeq and a workshop paper at
https://github.com/mathjax/papers/tree/master/MathUI15. There should also
be a blog post out later this week.

The reason we took this more complex approach is that it is also the basis
for another application, an on-the-fly accessibility solution to work.
There'll be a blog post on that as well but you can already find more
information on the entire project (including demos and videos of the tool)
on our developer wiki at
https://github.com/mathjax/MathJax/wiki/Semantic-Enrichment-project.

Best,
Peter.

On Mon, Dec 14, 2015 at 9:32 PM, Bill Kasdorf <bkasdorf@apexcovantage.com>
wrote:

> I just realized I had never passed this on to the DPUB IG as Ivan had
> suggested I should.
>
>
>
> *From:* Ivan Herman [mailto:ivan@w3.org]
> *Sent:* Friday, December 04, 2015 5:35 AM
> *To:* Bill Kasdorf
> *Cc:* Tzviya Siegman; Markus Gylling; Dave Cramer;
> ahmed.hindawi@hindawi.com
> *Subject:* Re: Hindawi responsive equations
>
>
>
> This looks great indeed. Actually, I think it is an illustration of the
> approach Peter was talking about: what I presume Ahmed does is to do a
> server side processing of the mathematics (MathML or LaTeX) and generate
> the SVG+CSS combination. And the equations nicely reformat themselves
> indeed when the size of the window changes, which is great…
>
>
>
> Of course, the major problem, as also raised by Peter, is accessibility.
> The SVG is purely graphics (as it should be), meaning that the equations
> themselves loose all their original semantics. But that is not Ahmed's
> fault; there is a missing piece here in the technology chain…
>
>
>
> Bill, I would think that it would be worth sharing this with the DPUB IG
> as a whole. I cannot, of course, comment on the EPUB 3.1 Working Group…
>
>
>
> Ivan
>
>
>
>
>
>
>
>
>
> On 2 Dec 2015, at 17:32, Bill Kasdorf <bkasdorf@apexcovantage.com> wrote:
>
>
>
> Copying you on an e-mail I just sent to Peter.
>
>
>
> I'll be very interested in your take on this.
>
>
>
> BTW I was in the process of getting Paul Peters, who now leads Hindawi
> Publishing, on our journals subgroup for EPUB 3.1, but the group evaporated
> too fast, before I could get that accomplished. I mentioned to Paul
> yesterday (at the STM event I spoke at) that we should revisit involving
> Hindawi, and perhaps on the DPUB IG even more than the EPUB 3.1 WG (though
> they'd be valuable to both).
>
>
>
> An interesting piece of EPUB cred for Ahmed ;-): I speak at this STM event
> in London the first week of December basically every year. Of course my
> topic was EPUB 3 the year we published that; the spec was pretty brand new
> at the time. Without Ahmed knowing it, I used Hindawi journal content as an
> example because _*he had already published articles as EPUB with SVG
> equations*_. Beautiful complex mathy EPUBs. We are talking a couple
> months after the spec was finalized. You should have seen the look on
> Ahmed's face when he saw his own EPUB up on the screen as I was stressing
> the point that _*yes this is even for STM content, it's not just for
> trade books: have a look at this, will ya!*_. Way back then.
>
>
>
> Ahmed is a very unusual successful publishing CEO that is _*also*_ a
> mathematician and _*also*_ loves to actually get deep into CSS land. . . .
>
>
>
> For full disclosure purposes I've copied Ahmed on this so he knows what
>
>
>
> --Bill
>
>
>
> *From:* Bill Kasdorf
> *Sent:* Wednesday, December 02, 2015 11:19 AM
> *To:* Peter Krautzberger (peter.krautzberger@mathjax.org)
> *Cc:* 'ahmed.hindawi@hindawi.com'
> *Subject:* Hindawi responsive equations
>
>
>
> Hi, Peter—
>
>
>
> My friend Ahmed Hindawi (of Hindawi publishing, which I presume you know
> about—they are mainly or possibly exclusively a math publisher, based in
> Cairo) gave a very interesting demo of a technology he's developed for
> rendering MathML into responsive equations.
>
>
>
> While it does not use MathJax (or even JavaScript), I thought you'd want
> to take a look at this, and to read the paper he will be publishing on the
> details in a month or so. Ahmed is a mathematician, so he is particularly
> well qualified to build math-specific logic into this. Despite the fact
> that this obviously overlaps with the responsive equations MathJax has been
> developing, I thought you might be interested in both that logic and also
> looking under the hood, especially at the CSS statements, when they are
> available. He will be making all this open source.
>
>
>
> I alerted Greg at Apex to this earlier today. Here's the summary I sent
> him:
>
> . . .
>
> Ahmed Hindawi gave a presentation on a technology he's developed for
> rendering reflowable, responsive math that looks very cool. He is a
> mathematician, as you may know, and so he has built very good logic into it
> in terms of how to deconstruct equations into nested structures, prioritize
> break points, and even generate "implied" operators that are needed at a
> break but aren't in the base equation. It is all done with CSS, SVG, and
> Media Queries—no JavaScript. (Key point: the result isn't one SVG, it's a
> bunch of little SVGs.) It consists of these steps:
>
> --Equation Analyzer breaks the equation up into units, including nested
> structures, and _*measures*_ all the pieces;
>
> --Equation Renderer takes a target width and does cascade matching based
> on the structure and measurements;
>
> --Equation Blockalizer prioritizes the groupings given the available width;
>
> --Equation Maker renders the equation based on SVG Blocks + Media Queries
> + CSS statements.
>
> He is going to publish a paper on it with all the technical details in the
> next month or so, and will be making it all open source. There's a demo at
> http://www.responsiveequations.com/.
>
> . . .
>
>
>
> I copied that literally so that Ahmed, whom I've copied on this, can
> correct me if I've mis-stated or misunderstood something.
>
>
>
> I encouraged Ahmed to be in touch with you and to revisit the issue of
> supporting MathJax. While he declined to do that years ago, a lot has
> happened since then and your 2.6 version certainly will be of interest to
> him. So now you have each other's e-mails. When I think of go-to people for
> anything regarding math, MathML, and math rendering, you two are at the top
> of the list (well, ok, along with Greg) so the two of you should know each
> other in any case.
>
>
>
> And btw I _*did*_ expand the MathJax update to two slides in my
> presentation and included the pitch for sponsorship. Since you should
> probably see what I said (though it was all based on what you told me,
> which of course I acknowledged in my presentation), I've attached it.
>
>
>
> --Bill
>
>
>
> Bill Kasdorf
>
> Vice President, Apex Content Solutions
>
> Apex CoVantage
>
> W: +1 734-904-6252
>
> M: +1 734-904-6252
>
>
> *bkasdorf@apexcovantage.com*
>
> http://isni.org/isni/0000000116490786
>
> https://orcid.org/0000-0001-7002-4786
> <https://orcid.org/0000-0001-7002-4786?lang=en>
>
> www.apexcovantage.com
>
>
>
> <image003.jpg>
>
>
>
> <The Convergence Continues (Rev. 1.0).pdf>
>
>
>
>
> ----
> Ivan Herman, W3C