6

I have so far tried using Pandoc to convert Markdown text containing LaTeX math to ePub with MathML. This works, but the resulting math displays quite horribly compared to what the corresponding math looks like when generating PDF from LaTeX. For example, upper and lower limits of an integral do not align well. I have tried using Calibre too and here it is actually possible to convert the math to MathJax-viewable format, but it seems I cannot rely on other ebook readers to be able to use MathJax. Besides, this only worked when converting from HTML, not Markdown.

Update: @karsten-w's answer made me think more about embedding the maths as graphics. I found out that ePub seems to support SVG, at least ePub from v. 3.0 according to what I stumbled across. So for example, I can generate the math SVG from LaTeX using http://www.tlhiv.org/ltxpreview/ (see https://tex.stackexchange.com/questions/103282/convert-latex-to-svg-online). I can then easily embed the SVG in Markdown and convert to ePub using Pandoc.

Now I would just like a smoother workflow that can take me directly from LaTeX with maths or Markdown with LaTeX maths to ePub with embedded SVGs...

  • You should only edit your question to improve clarity, not to change the goal as you did (from improving looks to getting a smoother workflow), Changing the question beyond improving clarity invalidates the existing answers, makes the question less useful. Just create a new question for the smoothness issue and refer to this question if it helps clarify that new question. – Anthon Jan 16 '15 at 11:15
4

For my ebook experiment, I use PNG, via Formula Sheet.

  • Yes, converting to bitmapped graphics is of course an option. I would just really like not to have to bitmap the maths, but if that is the only option it still looks much better than MathML. – Thomas Arildsen Jan 15 '15 at 8:09
  • The downside to images, of course, is the total lack of any semantic information or support for the visually disabled. You can get around this to some extent with alt tags in your image, but that gets tedious to put in. Given that at present MathML support is not universal and MathJax requires JavaScript, which is also not universal, images might be your best bet. – Tom Jan 15 '15 at 8:56
  • This is a good idea. What if there is one ereader that supports math markup, but 50 ereaders that don't? Most ereaders support images. – Bulrush Apr 21 '16 at 18:14
4

I believe that tex4ebook auto-converts from LaTeX to ePub using SVG for math. Looks a little complicated to set up, though. (I haven't tried it personally.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.