book
book copied to clipboard
epub or mobi version
Would be great for those of us with e-book readers. Thanks!
When I looked into this in the past, the results with "mobi" and "ePub" are difficult to achieve and faulty. LaTeX just isn't meant to generate them.
I use PDFs on my iPad Mini. The book looks fine, but the font is small. If I have the time, I'll look into tuning the page format for a smaller screen. (less margins, larger font, but keep images the same size.)
http://tex.stackexchange.com/questions/16374/effort-to-make-latex-ebook-friendly
http://tex.stackexchange.com/questions/3070/preparing-pdf-files-for-ebook-readers-etc
On Fri, Jun 21, 2013 at 10:56 AM, slacka [email protected] wrote:
Would be great for those of us with e-book readers. Thanks!
— Reply to this email directly or view it on GitHubhttps://github.com/HoTT/book/issues/287 .
In the meanwhile we prepared hott-ebook.pdf
with small margins. Please use that until someone figures out how to typeset math for ebooks.
Dandy!
On Fri, Jun 21, 2013 at 1:44 PM, Andrej Bauer [email protected]:
In the meanwhile we prepared hott-ebook.pdf with small margins. Please use that until someone figures out how to typeset math for ebooks.
— Reply to this email directly or view it on GitHubhttps://github.com/HoTT/book/issues/287#issuecomment-19811309 .
I've figured out how to typeset maths for ebooks ...
But it's definitely non-trivial to convert a LaTeX file to ePub. I got something that compiled, but needs some work to make it a true ePub version.
I will buy you a beer if you can do this.
To give you a flavour of what it might look like (and also to show where work would need to be done) here's the introduction as an ePub:
http://www.math.ntnu.no/~stacey/documents/HoTT-introduction.epub
This is a valid ePub3 with mathematics embedded as MathML. It opens in iBooks, but some of the glyphs are missing (as are the references, but that's because it's just the first chapter). There are probably lots of other oddities that someone familiar with the text would spot.
The big issue (which is common to any LaTeX-to-non-fixed-format conversion) is that there are things where you have to work out "What do I want this to be like in the final document?" and the answer isn't always the same for PDF as for XHTML (including ePub) as PDF is a visual, fixed layout format and XHTML isn't.
But fortunately, this is perhaps something that is easy to do via a collaborative effort. If I can get the backbone working then others can put the flesh on it by figuring out the figures and replacements for missing glyphs and so forth.
Would it make sense to have a separate branch for this? How much will we have to "pollute" the source to get epub working?
Inevitably some messing with the main text will be necessary (particularly with diagrams). At the moment I'm trying my best not to mess with the actual text and just handle things at the macro level.
Though I'm coming up against some issues with your ... creative ... use of the equation environment! I might have to rewrite those as I've not found a way to embed ordinary text inside mathematics and still have full range of text.
Technical bit: the equation environment signals maths, so we start a MathML piece. Text within that gets put into an mtext tag, but you then want emphasised text within that and the naive
\begin{equation}\label{eq:tautology1} \text{\emph{``If not $A$ and not $B$, then not ($A$ or $B$)''}.} \end{equation}
Technically here, the outer mathematical environment is doing nothing. But an automated system still sees it.
An alternative would be to have a textequation environment which centres its contents and sticks the equation label exactly as the equation environment does, but doesn't go into maths mode.
For that sort of thing we probably don't care whether it really is a math environment. It just has to look kind of the same.
A very simple version would be:
\newenvironment{textequation}{\equation\hbox\bgroup}{\egroup\endequation}
I am inclined to start this off as a fork first, and then pull it in when we can be sure it's working. I imagine you already have a fork. I'll follow you there, and here maybe you can post a link to it for people who are interested in coperation.
Or we make a branch. I am not sure which is The Correct Thing to do in this case.
I guess the reason to make this a math environment was to get it an equation number. On Jun 21, 2013 10:53 AM, "loopspace" [email protected] wrote:
A very simple version would be:
\newenvironment{textequation}{\equation\hbox\bgroup}{\egroup\endequation}
— Reply to this email directly or view it on GitHubhttps://github.com/HoTT/book/issues/287#issuecomment-19830773 .
Here are some samples generated using pandoc (v1.11.1 compiled with texmath 0.6.1.3):
$ pandoc -t epub3 -f latex -o ~/Dropbox/HoTT/hott-intro-pandoc.epub introduction.tex
https://www.dropbox.com/s/saxm6cdqnjccd8g/hott-intro-pandoc.epub
$ pandoc -t epub3 -f latex -R -o ~/Dropbox/HoTT/hott-intro-pandoc-raw.epub introduction.tex
https://www.dropbox.com/s/hmoan0vzio2u5o9/hott-intro-pandoc-raw.epub
Any macro debugging will help all of these efforts. The best github way to do this would probably be to create an "epub" feature branch in your project. Contributors would still use forks and pull requests to submit changes to the "epub" branch, and whichever work pans out can later be merged into the master branch on the official project.
The textequation that I gave above will get an equation number.
I foresee two types of changes needed to get an epub version. Some changes are things that can be done on the main version and have no effect there but make life easier for conversion scripts (such as mine or pandoc). These are things like the textequation environment, and changing underscores in reference names to hyphens.
Others will be things that are specific to an epub version.
I'm currently working just on my own machine. I'll create a github fork sometime soon and make it a bit more official. I wanted to see if it were even possible before doing anything serious.
Right, here's what I've gotten today. It's everything up to the appendix, apart from the fact that I've blanked out a few things that I know are going to be tricky (diagrams mainly) and there are a few symbols that I can't find in the unicode list. It opens in Azardi, I haven't tried it in iBooks yet. There are validation errors, mostly due to references but a few due to maths in the section titles.
http://www.math.ntnu.no/~stacey/documents/HoTT-main.epub
I've uploaded a new version to the above link which does open in iBooks on an iPad. It contains all the sections up to the appendix.
This loks very promising! On my ipad in iboks there seem to be missing math fonts.
@andrejbauer Yes, it would appear that iBooks doesn't come with enough fonts to cover the unicode range. Fortunately, it is possible to embed fonts in an epub. I've just replaced the above version with one with the main STIX fonts embedded (the STIX licence allows this, I believe) and that fixes a lot of the missing glyphs. There's still some missing (integral signs and the like) because I didn't embed the full STIX family on the first go as I didn't know if it would work.
Anyway, try it again from http://www.math.ntnu.no/%7Estacey/documents/HoTT-main.epub
It is using German gothic letters instead of mathsf, weird. I am still amazed at how quickly you got this far.
Oh, that's because I was lazy and couldn't remember off the top of my head what mathsf looked like so I set it to mathfrak for the time being.
Hmm, the bit that actually does the conversion to MathML doesn't yet know about mathsf. I've set it to mathrm for the time being and will look into adding that later.
New version uploaded (same link as above), now includes bibliography.
Things that need work:
- Indexing will take a bit to get right.
- tikzpicture and xymatrix stuff needs converting to proper diagrams
- need to implement tables
- the stuff used in formal.tex needs implementing (mathpartir) which means figuring out how all those diagrams should look in MathML, so for now that file isn't included
I have created a proper fork for this project now. I'm new to git/github so I may get things horribly wrong!
The stuff in formal didn't take too much (though it could probably be made better). Latest version has that in as well. Tables also (though the colours in the homotopy groups of spheres aren't as yet). So indexing and figures are the main missing bits.
On a Cybook e-reader, there are still a lot of symbols missing, for instance \to, \mathbb{N}, \equiv, \simeq, \top, \bot, \vee, \wedge … Not all of them are missing, for instance greek letters, \times, \infty, \int are present (yes, there are some integral signs in the book ^^). Also, indices and exponents do not seem to work (but maybe this e-reader does not understand MathML)
@guillaumebrunerie There aren't that many ebook readers that can cope with MathML so it wouldn't surprise me that it didn't work. I know that iBooks has rudimentary support, and there are some desktop readers that work as well (Azardi does, Calibre has MathJaX embedded). Sorry about that.
If you're seeing integral signs, then the markup you're getting might just be a symptom of it being a work in progress.
MathML is part of the newer ePub 3.0 standard, so look for e-reader software that supports it.
(New version just uploaded.)
Yes, definitely a work in progress! I've just uploaded a screenshot to G+ showing that at certain font sizes then it renders very curiously. I suspect that I need to embed more fonts, probably the entire STIX family.
I just tried it out in the Firefox ePub reader add-on and it looks much better than in iBooks (superiority of Gecko's MathML rendering over Webkit's I guess) which suggests that there is a limit to how good this is going to get.
It’s a bit strange that MathML is mandatory for ePub 3 but not the mathematical fonts. What is MathML good for if you can’t display any mathematical symbol?
My understanding is that MathML isn't mandatory for ePub3 but that ePub3 works on a modular system so it's possible for an ebook reader to say "We support the core of ePub3" without actually supporting MathML.
For iBooks then MathML support is almost an accident. iBooks is based on Webkit and so when something is supported in Webkit then it automatically gets supported in iBooks. But that doesn't mean that they've deliberately thought about it in great detail (I'm not saying they haven't, just that it needn't follow). Given that its support in Webkit is no where near Gecko's, I guess the rationale is that there's no point embedding a slew of fonts until it is more developed.
But I'm guessing on most of this. It might just be that I don't yet know how to make it use the fonts correctly. It certainly looks okay in the Firefox epub reader with no missing glyphs (well, hardly any).
I have downloaded the epub version from the link that loopspace posted 8 days ago to my Sony PRS T2 ebook reader. Most formulas look o.k. but a) no subscripts or superscripts, e.g. in the formula for ISO(A,B) in the section on constructivity from the introduction, everything is on one line. \pi_1 or x^2 is rendered on one line, like "x 2" (But footnotes ARE shown as superscripts.) b) certain missing symbols are shown as a crossed-rectangle, for example mathcal-U (in particular) and mathbb-S (but not mathbb-Z),
Besides c) The math fonts are upright and not italic. d) displayed equations are left-aligned. e) equation numbers appear as 1.2.1 instead of (1.2.1) in the book, both where they are defined and where they are cited (but there they are highlighted as hyperlinks) f) there are boxes around theorems, lemmas and proofs etc. g) there is no table of contents h) figures are missing.
I have also looked at it with the FBReader program on a Linux computer, and there it did not look better (the layout is even worse, equation numbers are on the left, tables are not usable at all)