I don’t always use LaTeX, but when I do…

Since I haven’t published anything in almost two months, let me jot down one thought that has come to mind frequently over the past few months.

If you use LaTeX …

Well, first of all, are you sure you have to use LaTeX? By which I mean, are you sure you can’t use Markdown+MathJax or textile+MathJax or restructuredText+MathJax? Especially if you’re teaching your students, are you absolutely sure you are completely and utterly unable to use something simpler? Something that is more modern than learning a hundred bits of print typesetting that your student will never, ever need? Ok, just checking. So…

If you (have to) use LaTeX, then make HTML your primary output.

By which I mean: don’t just produce PDFs that nobody can read on small screens, PDFs that nobody can read accessibly, PDFs that nobody will want to read in 5 years.

Make HTML your first output. It’s important. HTML is the future engine for mathematical and scientific content. If you can’t produce HTML, then ur doin it rong. If you don’t produce HTML, you won’t ever help all the people working on pushing math on the web forward.

It won’t be trivial but easier than you think. Install LaTeXML and learn how to use it. (Alternatively you probably have a copy of tex4ht installed with your TeX.) How hard is it? This hard:

  latexml --dest=mydoc.xml mydoc.tex
  latexmlpost --dest=mydoc.html --format=html5 mydoc.xml

And when you run into LaTeXML limitations, then get over it, report them back, help make it better. If you run into problems with MathJax, report them, help make it better. You need graphics? Check out xyjax. You need pstricks? Check out mathapedia. You need computations? Check out Sage cell server. It’s all there, but you have to get started. To it today.

But if you’ve ever wanted math to be native on the web, then you have to realize that it won’t happen without your help.

If you’re too lazy for converting (e.g., when you’re teaching), then use something that compiles to both TeX and HTML (like markdown+MathJax etc). Pick a decent tool for it, like Qute, ReText, write on the web with FidusWriter or Authorea.com, write in your favorite Mac-editor with Marked, or extend sublimetext, on an iPad app use Writing Kit — and that’s just off the top of my hat; there are many more editing environments that offer good syntax and MathJax integration. Many can save to TeX documents, anything can be converted via pandoc. It’s not perfect yet but it won’t get better unless you give everybody some feedback.

So, if you can, don’t author LaTeX, author into LaTeX. And whatever you do, compile it to HTML. It’s important.

I don't always use LaTeX but when I do I compile to HTML

credit: http://www.quickmeme.com/meme/3umuyt/

Another silly experiment: mobile apps for content delivery

Here’s another post from the category “yet another silly idea” or “don’t try this at home”. Keep in mind that I have absolutely no idea about app development. In short, I don’t know what I’m doing or what I’m talking about. But here it goes.

I’ve written in the past about the problems of mathematical content in ebooks (well, epub3 anyway). Ideally, we should all start producing epub3 files right now and use PDFs only for legacy. Of course, even if we had good workflows for this (which we don’t), we’d still face the problems that our readers couldn’t use our content as ubiquitously as PDFs. Which is a tragedy given how crappy PDFs perform on mobile devices — which are slowly but surely becoming my favorite reading devices. (And even print media does nothing but advertise it)

So I wrote about how you could include MathJax in an epub3 file and hope for the best. But this is stupid. We can reliably create mathematical content in a mobile browser thanks to MathJax, but we can’t easily do so in an offline, deliverable, stand-alone format.

Well, of course you can. MathJax is used in lots of mobile applications and there are even open source sample apps for developers to understand how to do this. Yet, authors don’t want to be app developers. (Though especially $\LaTeX$-affine communities seriously need to make HTML the primary output format — not print.)

Luckily for us, app developers these days have a similar problem and there is much innovation in mobile app frameworks that (aims to) make app development a “design once, compile everywhere” kind of thing.

Why don’t we go for a two pronged approach? Especially one that has been used successfully already: let’s develop our content for standards like epub3, offer it as such — DRM free, leaving it to the competent (possibly trained) user to use that file — but also provide a comfortable version by wrapping an app around our (standard-driven) content? (And really, why not offer both for the same price.) In other words, why not do what O’Reilly has done for years.

Instead of waiting for yet another awesome but proprietary framework (like iBooks Author or Inkling), let’s use an open source, standards oriented framework.

How hard would that be? Well, I decided to give it a try (warning: silliness levels rising).

I chose Phonegap — using HTML+CSS+javascript to develop hybrid apps seems fitting. Even more after hearing a wonderful quote an Adobe expert (Adobe bought PhoneGap): “the goal of Phonegap is to standardize itself out of existence”. But really because of Adobe PhoneGap Build (honestly, I would never have imagined I’d get excited over an Adobe product, ever.)

Because even though you’re using PhoneGap you’ll (naturally) still need a complete development environment — for each platform. That’s a pain to set up. Thinking (not only) as an author, you just don’t want to have to do that, you want to author and just wrap an app around it. Which is where PhoneGap Build comes in: a cloud compilation service. With a free account, you get one private project and infinitely many open source projects (and the peace of mind that you can always take your code home and compile it where you want). In fact, you can also simply link to a github repository to build an app (and build your own webhook). Simple as that. (Of course, if you want to get an iOS version, you have to pay Apple for a developer license etc but let’s ignore that.)

So how hard is it?

Well, if we want to start with a really, really simple example, we start with a real example and simplify it. Then you end up with something this “hard”:

  • Create a file config.xml.
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.phonegap.peter-hello"
        version   = "2.2.0">
    <name>Peter's Hello</name>

    <description>
        Peter says hello.
    </description>

    <author href="http://boolesrings.org/krautzberger" email="admin@test.com">
        Peter
    </author>

    <feature name="http://api.phonegap.com/1.0/device" />

    <preference name="phonegap-version" value="2.2.0" />
    <preference name="orientation"      value="default" />
    <preference name="target-device"    value="universal" />
    <preference name="fullscreen"       value="false" />

</widget>

I hope it’s clear what you might want to modify.

  • Create a file index.html
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <title>Peter's Hello</title>
    </head>
    <body>
      <h1> Hello!<h1>
    </body>
</html>

Again, I think it’s pretty clear, no?

  • Zip those two files up and upload the archive to PhoneGap Build.
  • Wait a bit.
  • Download and install your compiled app.
  • Done.

Well, actually, now you have to author your content. Some people call that the hard part ;) But when you’re done authoring, you zip it up, upload it (or push to your github repo) and you got yourself an app.

Of course, you can now do all the crazy stuff you’d be stupid enough to do on the web itself. Knock yourself out! Here’s an example wrapping an old post of mine, adding some reveal.js sparkle. Shiny, mostly useless — but something you can’t reliably produce in an epub3 right now (and nobody stops you from shipping an epub3 file of your content for download out of the app).

Of course, there’s a lot (A LOT) that’s wrong with this approach. I have no idea if this approach is feasible beyond very basic content. I have no idea how quickly you’ll run into performance, memory or other hazardous problems. Nevertheless, this is not nothing. It shows what could be done and should be done, by professionals.

In short, it shows why we don’t have to take no for an answer when we ask for better mathematical content on mobile devices today.


Small edit: linked to the phonegap, corrected the Win8 comment.

Publishers should invest in browser development (a comment at the scholarly kitchen)

In the tradition of posting stuff I write elsewhere, here’s a comment I just posted at the scholarly kitchen. It’s not really about the article.

On a slightly different note. Despite many investments in typesetting technologies in (and of) the past, publishers are investing very little in the primary typesetting technology of the future: HTML rendering engines.

A good example (though I’m biased) is MathML, the W3C standard for mathematical markup. Despite being used in XML publishing workflows for over a decade, and becoming part of HTML5, no browser vendor has ever spent any money on MathML development. Accordingly, browser typesetting “quality” is highly unreliable (unless you use MathJax — which is where I get my bias from).

Trident (Internet Explorer) has no native support (but the excellent MathPlayer plugin), Gecko (Mozilla/Firefox) has good support thanks to volunteer work and WebKit (Chrome, Safari, and now Opera) has partial support — again solely due to volunteer work. (Unfortunately, only Safari is actually using that code; Google recently yanked it out of Chrome after one release.)

This isn’t surprising from a business perspective — for the longest time, there was simply no MathML content on the web. But of course, this was a chicken-and-egg problem: no browser support => no content => no browser support => … And it ignores the impact MathML support would have on the entire educational and scientific sector where it would enable interactivity, accessibility, re-usability, and searchability of mathematical and scientific content. (Including ebooks — MathML is part of the epub3 standard.)

Now you might say MathML is just math, a niche at best. But very likely its success will determine if other scientific markup languages will become native to the web — languages like CellML, ChemML, and data visualization languages. These will probably see even less interest from browser vendors but will have enormous relevance to the scientific community.

Right now, scientific publishers (in my experience) have neither expertise nor interest in browser engine development. Unfortunately, they also don’t put pressure on browser vendors to improve typesetting (whether scientific or otherwise). That’s very short sighted, I think. Given that Gecko and WebKit are open source, a joint effort of publishers could very well fix things — and show the community that publishers have their eyes on the future rather than the past.

kids, exponential growth and 42

Last week, I was lucky enough to attend the W3C workshop on ebooks in NYC. This allowed me to visit some old and very dear friends. In a conversation with one of their kids, I pulled out a classic that I like very much.

Today, I did some fact checking and — lo and behold — the answer was not 52 but 42! That is, of course, fantastic.

Anyway, the question I asked was: how thick is an piece of regular office paper if you fold it 52 42 times?

The answer is: it would reach all the way to the moon!

That usually surprises kids (and non-kids) and is a nice example for the surprises of exponential growth. In fact, it also surprises me and I’m always somewhat nervous when a kid takes me up on the offer of checking that the number is actually correct.

For this you first have to decide what paper you’re looking at. A piece of A4 paper (I’m German after all) is on average 0.1 mm. That’s actually hard to estimate but it’s what I eventually found on the interwebs; if you have the time, I invite you to delve into the art of density and calipers.

When you fold it 42 times, it’s as if you stacked test $2^{42}$ pieces of paper on top of each other. So the thickness is $2^{42}$ x 0.1mm, which is ~439,804 km (and a kilometer is 1,000,000 milimeter).

The moon is on average 384,400km from earth, and 405,410km at its farthest — so we’ll get there no matter what day. If, that is, we could fold a piece of paper 42 times.

For what it’s worth, the world record for folding paper is 13 times — achieved by high schoolers on MIT’s campus in 2011.

Why academic societies should start fully fledged social networks

The Joint Math Meetings 2013 ended with the AMS’s 125th Anniversary banquet. One of the things mentioned there was that the AMS is working on some form of online communities. That’s great, but doesn’t go far enough.

1. It’s their nature

Academic societies have always been social networks. Online, social networks look different from conferences, book ordering and membership areas.

A lot has been done already. Take the AMS. MathsJobs has solved the job search problem, MathSciNet has solved publication research.

But what is needed is true social connectivity. Or in other words: conferences, workshops and seminars. The net connects everyone, all the time. Why leave it to people not caring for the community? The big social networks are important, but they will never help smaller communities like the mathematical one, never provide the tools we need.

2. The ultimate appeal

Nobody should trust a social network paid through ads. You may trust it a bit more when you pay for it (e.g., app.net).

But a network run by a society (or a joint venture of societies) would have the ultimate appeal: trust and oversight.

Because societies are democratic, they could establish transparent, democratic oversight over a key technology for the community.

3. It’s their mission

But let’s take it at least one step further. Diaspora and other decentralized social networks are a beautiful idea. Societies could move such tools forward, thereby empowering distributed social networks.

On the one hand, members could easily connect across different societies, on the other hand, members could choose to fully control their data on their own servers.

A society that serves its members and community would not be opposed in principle. Which other social network could say the same?

In addition, the underlying software would naturally be open source — both for transparency and scientific reasons.

This would enable everybody to take this important step — a bit of internet enlightenment if you will.

4. It’s forward thinking

Social networks are the new publishers. It’s interesting to read this post at the Scholarly Kitchen which looks at societies from the reverse angle, the fact that PeerJ is moving publishing more towards a membership model is important.

Publishers should fear societies since they will always be able to offer something fundamentally different — a self-governing community.

5. It has consequences

Right now, the majority of users are on at most one social network, usually Facebook (though mathematicians have sometimes skipped that and followed all the cool kids playing on google+).

I expect the majority of users to soon get comfortable to have multiple networks. This is why I also expect to eventually have better connectors between networks. Granted, this has to do with a lot of major internet issues (net neutrality, walled gardens etc), but I prefer to be optimistic about the future.

But the real consequence is: this will cost money. And members should be ready to pay for it. Just as we should for publishing.

New shiny toy: mathblogging.org gets a long overdue update

It’s been a lot of work and it has been delayed again and again, but here it is: mathblogging.org 2.0, powered by SubjectSeeker, the software behind ScienceSeeker.

Read the announcement.

I would like to thank Dave Munger and the team at ScienceSeeker — especially Gabriel and his infinite patience and support.

I would like to thank Sam for his support, expertise and everything.

Run, you fools! Go and break the server!

3 questions in June or: LoC workshops are the best

Here’s another old (forgotten?) draft to make up for my lack of original writing; this should’ve gone out in June… Instead of posting it, I had grand plans to write about the workshop itself — but never had the time (you know, moving across the continent, starting a new job etc., it gets in the way of things…). Why now? Well, Anthony Salvagno reminded me with his post yesterday that I still had this.

In late June, I had the enormous pleasure to be invited to the Preserving Online Science meeting at the Library of Congress. You can read about the workshop over at Trevor’s blog, and after that you can read the report that was released in November, too.

I’m afraid I wasn’t much use during the workshop and have the lingering feeling that I owe an apology to its instigators, Trevor and Abbey (who also gave a few of us an amazing tour of the lair that is the LoC). Besides a serious case of impostor syndrome, there was just too much to take in and too much on my mind at the time (being literally on the move from Boston to Los Angeles).

3 questions, 3 answers

Before the workshop started, participants were asked to answer three questions. For what it’s worth, here are my answers.

1. Value of Content: 50 years from now, what kinds of online science content will invaluable for understanding science in our age? Please give an example of a particular piece of content and explain why it would be significant. Feel free to provide several examples if you wish.

In a fully connected, digital world, we can understand much better how individual researchers work and communities interact. I believe one of the most important “new” content is to be found in the combined virtual presence of individual researchers — the future of personal archives. This ranges from our email inboxes, professional homepages and online teaching tools, to preprint servers, code and data storage, to activity on online platforms, blogs and social media.

This digital version of our academic self is greatly fractured right now but it can offer a much more complete insight into all aspects of research because it offers insight into being a researcher.

2. Future Use of Content: What kinds of uses do you imagine this science content could serve? Please briefly describe the value that you think online science content provides for the future. Ideally, focus on specific kinds of content and explain what value that content provides to different types of users (ex, future scientists, historians, policy makers, etc)

Preserving researchers’ actual activity will allow us to trace networks and interaction among and across research communities, in short. we may be able to globally capture the emergence of scientific thought and the communities around them. First and foremost, it will keep research results in context and thus more accessible to future researchers. Secondly, it will offer a much more complete background for historians to study. Third, as analytics improve, policy makers will not have to exclusively rely on static reports anymore, but base their decisions on the emerging and evolving trends within research communities, highlighting both endangered areas and growing hotspots.

3. Identifying Curatorial Homes: Libraries, Archives and Museums have typically collected published works (like journals and books) unpublished works (like the papers of scientists) and a range of other special collections (everything from collections of specimens, to laboratory equipment, to a range of other artifacts). Where are the natural curatorial homes for various kinds of online science content?

Currently, the virtual presence of a researcher is highly fractured, their online activities spread across numerous institutions and platforms, some open and some proprietary. The first step to create curatorial homes for such diverse repositories is for researchers (and citizens in general) to gain access to their own data and to build tools that allow researchers to backup their activities in a reliable, self-governed fashion. Only then could we develop hubs to serve as archival systems which could be hosted practically anywhere. Given the increase in precarious employment for academic researchers, these hubs will more likely be close to researchers as people then researchers as members of institutions. Hence an archival effort needs to address both institutions and individuals to ensure that data is not lost. In particular, the work of early career researchers who might eventually leave academia is at risk even though they are an integral part of the way the research community makes progress today.

How to include MathJax in an epub3 file to work with iBooks (and possibly others)

At the Joint Mathematics Meetings Present and Future of Mathematics on the Web session, Lila Roberts presented an excellent demo of the good stuff you can do with iBooks author. The demo included MathJax and jsxgraph, and combined both with iBooks Author’s easy, pretty layout tools. Of course, the drawback is that iBooks Author is

  • a proprietary format
  • restricted to iPads (not just iOS)
  • you’re not allowed to sell an iBooks Author file except through iTunes.
  • iBooks Author is not transparent about how its formula editor produces SVGs out of TeX but pastes MathML directly into a page, leading to inconsistent renderings of equivalent mathematics
  • MathML support of iBooks on iOS5 devices is severly broken (and will likely never be fixed) thanks to a mobile Safari bug that screws up the use of STIX fonts.

Anyway, I mentioned in the session that you can actually include MathJax in epub3 files directly to get much of the same. Well, you have to do the pretty layouts yourself and you’ll depend on a javascript-enabled epub3 reading software (like iBooks) but at least you’re using an open standard and retain your rights.

Let’s get started!

If you’re lazy, grab the file at the end of the post and hack from there. But I’ll walk you through it.

  • If you want to learn something, grab a copy of MathJax
  • slim it down as described here
  • I went all the way and restricted output to SVG — to minimize things and to make it work. HTML output should work on iOS5, but last I checked Apple changed something on iOS6 that I couldn’t track down for lack of devices.

Alright, that’s the basics. You now have a copy of MathJax that works on any reasonably recent webkit browser, including most Android and iOS versions.

You have all inputs (LaTeX, asciimath, MathML) available but only SVG output (well, and native MathML but if that worked we wouldn’t be here…).

What’s next?

Create your document. That’s actually hard if you don’t have a workflow already and don’t want to afford InDesign, Blue Griffon etc.

Personally, I will always try pandoc first. It’s the most versatile tool there is and John McFarlane is just fantastic. Its TeX implementation is enough if you are writing TeX with HTML/epub output in mind, I’m sure you won’t run into trouble.

If you can, consider to go through the Haskell-cabal-pain of installing the current development version — see the instructions at the pandoc github wiki. That will get you the new epub3 writer and things should be easy.

Of course, you can hack the example file below and just use a current version of pandoc or whatever you like to generate some xHTML5 (yes, xhtml, not html if you want your file to validate). You’ll have to modify the manifest etc by hand.

Anyway, let’s daringly assume you have an epub3 with your xhtml+mathml content.

Adding MathJax.

  • add the slim down version of MathJax to your epub file using your favoriate tool for adding content to a zip file. (Don’t unzip/rezip unless you know what epub needs when zipping…)
  • Assuming you’re using the copy as in the attachement, add the following to your manifest (modify paths and id’s if needed)
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/BasicLatin.js" id="id0" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscMathSymbolsB.js" id="id1" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/d.js" id="id2" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/jax.js" id="id3" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/cancel.js" id="id4" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/a.js" id="id5" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/AsciiMath/jax.js" id="id6" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/ms.js" id="id7" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/mathchoice.js" id="id8" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Script/Regular/Main.js" id="id9" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/extpfeil.js" id="id10" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/AsciiMath/config.js" id="id11" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Arrows.js" id="id12" media-type="application/x-javascript"/>
    <item href="mathjax/images/CloseX-31.png" id="id13" media-type="image/png"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedA.js" id="id14" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Other.js" id="id15" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Size3/Regular/Main.js" id="id16" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Size2/Regular/Main.js" id="id17" media-type="application/x-javascript"/>
    <item href="mathjax/images/MenuArrow-15.png" id="id18" media-type="image/png"/>
    <item href="mathjax/jax/input/TeX/jax.js" id="id19" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Size1/Regular/Main.js" id="id20" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/h.js" id="id21" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/l.js" id="id22" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/PUA.js" id="id23" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/AMSsymbols.js" id="id24" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/CombDiacritMarks.js" id="id25" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/PUA.js" id="id26" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GreekAndCoptic.js" id="id27" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LatinExtendedB.js" id="id28" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedA.js" id="id29" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscSymbols.js" id="id30" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/scr.js" id="id31" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MiscSymbols.js" id="id32" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/MiscTechnical.js" id="id33" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/newcommand.js" id="id34" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/mmultiscripts.js" id="id35" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/p.js" id="id36" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Main.js" id="id37" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/o.js" id="id38" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/annotation-xml.js" id="id39" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/u.js" id="id40" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/BasicLatin.js" id="id41" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/BasicLatin.js" id="id42" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Size4/Regular/Main.js" id="id43" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/noUndefined.js" id="id44" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/k.js" id="id45" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LetterlikeSymbols.js" id="id46" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/HTML.js" id="id47" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Main.js" id="id49" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js" id="id50" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/BasicLatin.js" id="id51" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/GeometricShapes.js" id="id52" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeometricShapes.js" id="id53" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/config.js" id="id54" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/enclose.js" id="id55" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/EnclosedAlphanum.js" id="id56" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/mhchem.js" id="id57" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/verb.js" id="id58" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/GeneralPunctuation.js" id="id59" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/MathMenu.js" id="id60" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeometricShapes.js" id="id61" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/PUA.js" id="id62" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/LetterlikeSymbols.js" id="id63" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/z.js" id="id64" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Main.js" id="id65" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SpacingModLetters.js" id="id66" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Other.js" id="id67" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/autoload-all.js" id="id68" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/CombDiacritMarks.js" id="id69" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/noErrors.js" id="id70" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/g.js" id="id71" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/BasicLatin.js" id="id72" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SpacingModLetters.js" id="id73" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscSymbols.js" id="id74" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GreekAndCoptic.js" id="id75" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/Main.js" id="id76" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/mml2jax.js" id="id77" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/GeometricShapes.js" id="id78" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/i.js" id="id79" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/q.js" id="id80" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/toMathML.js" id="id81" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/NativeMML/config.js" id="id82" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/BasicLatin.js" id="id83" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/boldsymbol.js" id="id84" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/Other.js" id="id85" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/BoxDrawing.js" id="id86" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/begingroup.js" id="id87" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/v.js" id="id88" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/MiscMathSymbolsA.js" id="id89" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Math/BoldItalic/Main.js" id="id90" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Other.js" id="id91" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/menclose.js" id="id92" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LetterlikeSymbols.js" id="id93" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js" id="id94" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GeneralPunctuation.js" id="id95" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/MiscMathSymbolsB.js" id="id96" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/x.js" id="id97" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Other.js" id="id98" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/j.js" id="id99" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/MathZoom.js" id="id100" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscMathSymbolsA.js" id="id101" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/unicode.js" id="id102" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/c.js" id="id103" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/NativeMML/jax.js" id="id104" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/SupplementalArrowsB.js" id="id105" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/autobold.js" id="id106" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SuppMathOperators.js" id="id107" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/Main.js" id="id108" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/action.js" id="id109" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/fr.js" id="id110" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/Dingbats.js" id="id111" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Dingbats.js" id="id112" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/CombDiacritMarks.js" id="id113" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/Arrows.js" id="id114" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/MathEvents.js" id="id115" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/MathOperators.js" id="id116" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Bold/Main.js" id="id117" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/MathOperators.js" id="id118" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Latin1Supplement.js" id="id119" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/CombDiacritMarks.js" id="id120" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/f.js" id="id121" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Main.js" id="id122" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/bbox.js" id="id123" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/config.js" id="id124" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/CombDiactForSymbols.js" id="id125" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Regular/CombDiacritMarks.js" id="id126" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Arrows.js" id="id127" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/SupplementalArrowsA.js" id="id128" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/r.js" id="id129" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/GeneralPunctuation.js" id="id130" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/BasicLatin.js" id="id131" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/SuppMathOperators.js" id="id132" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/opf.js" id="id133" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/fontdata.js" id="id134" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SpacingModLetters.js" id="id135" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/mglyph.js" id="id136" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/MathOperators.js" id="id137" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/GreekAndCoptic.js" id="id138" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiactForSymbols.js" id="id139" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Bold/Main.js" id="id140" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/w.js" id="id141" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MiscTechnical.js" id="id142" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/Latin1Supplement.js" id="id143" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/MathOperators.js" id="id144" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LetterlikeSymbols.js" id="id146" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/m.js" id="id147" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GeneralPunctuation.js" id="id148" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/multiline.js" id="id149" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/LatinExtendedA.js" id="id150" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/mtable.js" id="id151" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedA.js" id="id152" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/SansSerif/Italic/Main.js" id="id153" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/asciimath2jax.js" id="id154" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/jax.js" id="id155" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/AMSmath.js" id="id156" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/b.js" id="id157" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/fontdata-extra.js" id="id158" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/SuppMathOperators.js" id="id159" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MathOperators.js" id="id160" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/s.js" id="id161" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Script/Regular/BasicLatin.js" id="id162" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Caligraphic/Regular/Main.js" id="id163" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/SpacingModLetters.js" id="id164" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/GreekAndCoptic.js" id="id165" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/BasicLatin.js" id="id166" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/SupplementalArrowsA.js" id="id167" media-type="application/x-javascript"/>
    <item href="mathjax/MathJax.js" id="id168" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/TeX/config.js" id="id169" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/BasicLatin.js" id="id170" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/CombDiacritMarks.js" id="id171" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/TeX/color.js" id="id172" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/Main.js" id="id173" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/LatinExtendedB.js" id="id174" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Italic/CombDiacritMarks.js" id="id175" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Fraktur/Regular/Other.js" id="id176" media-type="application/x-javascript"/>
    <item href="mathjax/extensions/tex2jax.js" id="id177" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/MiscTechnical.js" id="id178" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/autoload/maction.js" id="id179" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/GreekAndCoptic.js" id="id180" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Bold/LatinExtendedB.js" id="id181" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/n.js" id="id182" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/t.js" id="id183" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/BasicLatin.js" id="id184" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/SuppMathOperators.js" id="id185" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/y.js" id="id186" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/jax.js" id="id187" media-type="application/x-javascript"/>
    <item href="mathjax/jax/input/MathML/entities/e.js" id="id188" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/LetterlikeSymbols.js" id="id189" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/AMS/Regular/Latin1Supplement.js" id="id190" media-type="application/x-javascript"/>
    <item href="mathjax/jax/element/mml/optable/CombDiacritMarks.js" id="id191" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Math/Italic/Main.js" id="id192" media-type="application/x-javascript"/>
    <item href="mathjax/jax/output/SVG/fonts/TeX/Main/Regular/Main.js" id="id193" media-type="application/x-javascript"/>
  • To each xhtml file that contains MathML, add
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
    jax: ["input/TeX","input/MathML","output/SVG"],
    extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],
    TeX: {
    extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]
    },
    MathMenu: {
    showRenderer: false
    },
    menuSettings: {
    zoom: "Click"
    },
    messageStyle: "none"
    });
    </script>
    <script type="text/javascript" src="../mathjax/MathJax.js"> </script>
  • I have not activated automatic linebreaking because there’s currently a bug in MathJax on iOS6. If MathJax detects the need to break the line, you’ll get Math Processing errors instead.
  • For each xhtml file with the above we’ll have to modify the properties-part in the manifest to have both mathml scripted, e.g., in the sample file you’ll see
    • <item id="c3" media-type="application/xhtml+xml" href="xhtml/ch1.html" properties="mathml scripted"/>
  • And then you can include wonderful MathML and even webkit deficiencies or the horrible iOS5 Safari+STIX bug will be meaningless to your epub file and you can actually publish a mathematical epub file to be read on iBooks.
    x^ + x y ^ + x y z ^ .

This text is available as an epub3 file which includes MathJax and should run on iOS devices.

JMM 2013

Early this morning, I drove down to San Diego to be at the Joint Math Meetings 2013 for the very first time. (Well, last year, I mostly sneaked in to meet friends and didn’t even register — or got to talks, so I guess that’s fair).

It seems ironic and yet fitting that my first JMM is also the first meeting since I left mathematical research (in the traditional and definitely the (for me) previous sense). Representing MathJax is challenging, exciting, and simply a lot of fun.

Of course, meeting up with old friends is an added bonus that’s simply priceless.

What’s the best TeX-to-HTML or TeX-to-ePUB converter?

What do I do when I don’t find the time to properly write here? I needlessly double post stuff I’ve written elsewhere.

Somebody asked the title question on LinkedIn. My reply was as follows (well, I’ll do the links properly here).

What’s the best TeX-to-HTML or TeX-to-ePUB converter?

I don’t have that much experience with this, but it might be better than nothing.

I think the two main contenders for TeX-to-html are TeX4ht (which most LaTeX distributions ship) and LaTeXML.

TeX4ht is really a dvi-to-html converter so it behaves accordingly. In my limited experience, it is easier to get results.

LaTeXML seems more powerful, but I could never get it to produce results from “arbitrary” TeX (again, not a lot of time spent on this). On the other hand, LaTeXML is used systematically to convert the arXiv with reasonable success rates.

With respect to epub3 (ignoring html-to-epub3), I’m only aware of pandoc (disclaimer: my personal favorite).

The current development branch has an epub3 writer with MathML support. This works reliably in a handful of tests. Pandoc does not have complete TeX support but John McFarlane is just a fantastic guy who built a strong community around pandoc — something the two others seem to lack.

Addendum: TeX.SE has lots of expertise on tex4ht and latexml, of course. See this example


Since the blog has to have something extra

Bonus links from TeX.SE:

Super Bonus links

Bonus observation

the two posts that regularly drive traffic this way are about Markdown and epub. Just saying.

Bonus bonus

That last sentence about John McFarlane got shortened too much and doesn’t quite make sense anymore. So I finally have a reason to embed the most important comic strip on the internet.

xkcd "Duty Calls", cc-by nc
Duty Calls (cc-by-nc).