Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Recently I purchased an ebook reader (Kindle), and I want to export some of my document in LaTeX to an ebook format.

I tried exporting from LaTeX to PDF, but isn't perfect because I have to zoom in-out and move around the page many times (isn't confortable like when you read a normal ebook purshased in book stores). I tried too exporting to RTF, but none of my mathematical formulas were in the output document.

So, do you know a better way to export from LaTeX documents to ebook formats that includes mathematical formulas? And, that works with Kindle (mobipocket)!

share|improve this question
2  
possible duplicate of Use LaTeX to produce Epub – Caramdir Apr 25 '11 at 16:15
2  
What I usually do is to set the document size to (a bit less than) the screen size of the Kindle and remove all margins. This works quite well on a Kindle DX, as its screen size is around the page size of a paperback. Not sure how pleasing the result is on a normal-size Kindle. – Caramdir Apr 25 '11 at 16:17
1  
@diegocaro: You haven't selected any answer or posted any comments. Are you still missing something? – ℝaphink Sep 18 '11 at 19:36
3  
EPUB 3 supports mathml. However, no handheld reading devices support EPUB 3 yet. Kindle does not support mathml and probably will not in the foreseeable future. A further problem with Kindle is that images cannot be rendered inline in text, so you can only use images for displayed math. – Ben Crowell Dec 30 '11 at 17:44
See tex.stackexchange.com/questions/95600/… , which has some more up to date discussion. – Ben Crowell Mar 8 at 0:03

migrated from stackoverflow.com Apr 25 '11 at 12:34

8 Answers

up vote 21 down vote accepted

tex4ht does an excellent job at converting LaTeX to (X)HTML, and it can convert math to either bitmap or MathML in the process. From there, you can use Calibre to convert the HTML to EPUB or MOBI.

For example, if you want to produce XHTML with MathML, using UTF-8 encoding, you can do:

mk4ht htlatex youfile.tex 'xhtml,charset=utf-8,pmathml' ' -cunihtf -utf8 -cvalidate'

See the documentation for more examples.

On Wikipedia's LaTeX example, this produces a MOBI file which looks like this in Kindle PC Reader:

LaTeX to mobi, with formulas

There's probably a bit to fine-tune, but the idea is there, you get the formulas. Fine-tuning might include disabling ligatures for example.

Note that the tuning might be done in the XHTML to MOBI conversion process, possibly with Calibre's options, since the HTML document looks fine:

latex to XHTML

share|improve this answer

This works for me.

I use document class memoir with parameters [ebook,oneside,openany] with very few modifications respect to the original file (the one that produces PDF).

Compile it with: htlatex myfile "html". Then load the resulting myfile.html in Sigil. Here I add missing metadata, split the chapters and mark the cover page image. Then save as epub and load it (via Calibre) on my reader.

share|improve this answer
With experience I'm improving the workflow. Now I load the htlatex output in Calibre, then convert to EPUB, then edit with Sigil for TOC, metadata and cover. The result is almost perfect. – mvalle Jan 16 '12 at 11:49
Using memoir's ebook option makes perfectly sense if you want to read your document as a native PDF on your reader. I don't see the point in using that when converting to EPUB or MOBI, though. – fudo Jan 25 '12 at 12:24

Why not simply

\documentclass[a5paper]{memoir}

or similar? worked fine with me. The size is adequate and you do not need to zoom in or out. If it is still difficult to read you can set the font size a bit.

share|improve this answer

Take a look at PubTex: http://pubtex.com/

Pubtex lets you use LaTEX via git to make beautiful web pages, iPad and Kindle-readable ePub & Mobi ebooks, and print-on-demand paperbacks

It supports math.

share|improve this answer
MMmmm interesting, but it's a webservice. Would be great if can be a isolated program on my computer. – diegocaro Apr 29 '11 at 1:26
3  
it appears to be dead now. – fudo Jan 24 '12 at 11:57
More than dead, the site told me only that I had won an iPad :P – Dimse Dec 6 '12 at 9:36

If you don't want to make too much change, go on with Andresmp answer (http://tex.stackexchange.com/a/50568/13993), and add this :

\documentclass[12pt,a5paper]{...}
\usepackage[hmargin=3.75em]{geometry} 
...

It would give you this, even if you're working with fancy package (but beware of the header/footer size) :

"Kindle size"

Rather than that :

A4 version

The increasing may look isn't that huge, but I can ensure you does work fine.

Hope that help you.

share|improve this answer

i was also using the Kindle reader for reading the Ebook, but this 6" device was not able to read some technical books related to my Engineering subject. i tried so many converters to make it readable but none of them helped to achieve the same. After several hours of search, i finally found this thread which helped to solve the problem.

share|improve this answer
5  
Welcome to tex.SE. It is customary not to give a link and let it stand for itself, rather summarise the information given and state the URL as your source. – Psirus Feb 23 '12 at 6:54

AFAIK, ePub is similar to / based on HTML, so you could go from latex to HTML, then to ePub.

share|improve this answer
But it doesn't support mathematical formula – diegocaro Apr 24 '11 at 22:46

Have you tried Pandoc?

share|improve this answer
1  
It doesn't support mathematical formula :( – diegocaro Apr 25 '11 at 1:54
1  
@diegocaro: Recent versions of pandoc translate TeX math to MathML. – Aditya Feb 23 '12 at 16:52

protected by Andrew Stacey Apr 3 '12 at 16:55

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

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