Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 01-21-2012, 01:52 PM   #1
Katsunami
Wizard
Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.
 
Katsunami's Avatar
 
Posts: 3,265
Karma: 14868287
Join Date: Mar 2008
Location: Netherlands
Device: Kindle Paperwhite
EPUB, MOBI, PDF... LaTeX!

After looking into editing EPUB and/or MOBI books, without having to rip them apart, I just started wondering (and searching). Why isn't LaTeX used to do the editing for eBooks? Some people have tried it without much succes, converting the LaTeX source into HTML and then converting that into EPBUB or MOBI.

People who do academic publishing will know LaTeX well: it's a very old format, but it is still updated with new functions today. It is even used for many novels; my copy of Lord of the Rings is written in LaTeX; I can tell, because the publisher used the default output profile, and because the book has some ligatures in it that only the default LaTeX supported at the time of printing.

I've written quite some stuff in LaTeX myself, and it's so easy when you know the basics; you just write and write and write, using the occasional command such as \textbf{} (bold text) here or there, hit a button, and a perfectly formatted PDF comes out the other side. It should be possible to create an EPUB from the same source. If so, I would be able to typeset Gutenberg TXT-files into perfect books into less than half an hour. (And as said, the conversion can be done, but it's hardly perfect.)

The reasong why I wonder about this is, that LaTeX is virtually bug-free, and feature-laden. If there is anything that you can't do with LaTeX in typesetting, then it's generally believed that you can't do it with other typesetters, or even shouldn't do it at all. The language can create chapters, paragraphs, table of contents, can use pictures, make mathematical formulae, tables, lists, enumerations... everything. I never encountered something that couldn't be done.

Also, because it's open-source, and it has such a long history, it can be converted into basically anything. There are some converters out there that try to do a LaTeX to EPUB conversion (I've found PanDOC, for example), but they are far from perfect.

Any idea's, why people are trying to create and typeset books using a markup language such as HTML, which is far from perfect for this task, instead of using a language such as LaTeX, that is *created* for specifically creating and typesetting books, and then convert it into a file readable by an ereader?

edit: I'm going to try it with a short classic, Black Beauty, for which I cannot find a "flawless" formatted version. I'll see what LaTeX, htlatex, pandoc, sigil and calibre can do when combined together. Making a TEX-file from the Gutenberg TXT is trivial...

Sorry for putting this into the wrong forum. Should have looked better.

Last edited by Katsunami; 01-21-2012 at 02:08 PM.
Katsunami is online now   Reply With Quote
Old 01-21-2012, 03:26 PM   #2
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 7,958
Karma: 22622174
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
I have HTML, turn that into LaTeX and create a PDF from that. That same HTML is used to create the epub and mobi books...

And most ereaders only read pdf, epub or mobi (as ebook formats).
Sweetpea is offline   Reply With Quote
Old 01-21-2012, 04:14 PM   #3
Katsunami
Wizard
Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.
 
Katsunami's Avatar
 
Posts: 3,265
Karma: 14868287
Join Date: Mar 2008
Location: Netherlands
Device: Kindle Paperwhite
I've been trying some stuff. After getting the Black Beauty TXT from Gutenberg, I made it into a default LaTeX article, stripping out all Gutenberg stuff, without changing anything in the markup apart from denoting \sections and \subsections to create the ToC. (Even the page number on the title page is still there.)

Then I output a PDF using pdflatex, which can be downloaded here:

http://www.silverforest.net/f-i/mobileread/beauty.pdf

After that, I output an HTML file using htlatex, which can be read here:

http://www.silverforest.net/f-i/mobileread/beauty.html

And at last, I tried to create the epub file using PanDoc, first starting out with the LaTeX file, and then with the HTML file. The LaTeX->epub conversion worked, but it was quite bad, loosing the table of contents, and ignoring sections/subsections. HTML->epub created quite a good epub, but it basically was an "epub"-ified version of the HTML, which is of course logical.

Many things such as page breaks need to be marked up after the HTML->epub conversion, where LaTeX can do that by default; seeing that I still have to do work after the conversion, it is easier to start out with the textfile in Sigil; the only difference is that this time section/subsection (chapters) will be marked in Sigil, instead of LaTex.

If I need a simple, well-readable PDF or HTML file quickly, I'll use LaTeX, and I still wonder why there is no good direct LaTeX to epub convertor, seeing how very quickly a plain text file can be whipped into a well readable document.

To be honest, I woudn't know how to create an epub without Sigil, at the moment.

Last edited by Katsunami; 01-21-2012 at 04:21 PM.
Katsunami is online now   Reply With Quote
Old 01-21-2012, 04:19 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 36,203
Karma: 17169472
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
In your HTML, the beginning quotes are backwards.
JSWolf is offline   Reply With Quote
Old 01-21-2012, 04:27 PM   #5
Katsunami
Wizard
Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.
 
Katsunami's Avatar
 
Posts: 3,265
Karma: 14868287
Join Date: Mar 2008
Location: Netherlands
Device: Kindle Paperwhite
How do you mean, the beginning quotes are backwards?

edit: Oh, I see. You mean the curly quotes. Yes, they're backwards. I've not created that HTML file by hand and did not check it for semantic correctness (or any correctness whatsoever). It comes from the htlatex commandline program, as said in the post above.

This problem is caused by the fact that htlatex probably cannot see the difference between beginning " or ending ". It will probably need `` and '' to do so.

Still, it's not too useful a comment I'm sorry to say, as this is only some experimenting.

Last edited by Katsunami; 01-21-2012 at 04:39 PM.
Katsunami is online now   Reply With Quote
Old 01-21-2012, 04:55 PM   #6
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 738
Karma: 2030839
Join Date: Sep 2010
Device: iriver Story HD
LaTeX is designed to produce prints, as in DVI or PDF, with a fixed page and font size. Documents are often optimized for that size only, e.g. when there is a hyphenation problem with your current size settings, people define custom hyphenation or adapt rules until it fits the current layout. Changing the layout or size might break your document.

Thus LaTeX for eBooks suffers from pretty much the same problems as does PDF. If you have a LaTeX source you have to convert it to HTML, and there are few LaTeX->HTML converters that actually work. I usually end up adapting the TeX source for the converter (remove headers/footers and similar decorations).

I've had some good results using plastex for the conversion step, once the source was adapted accordingly. However only with books, I didn't try any math formula or illustrations.


Of course if a fixed font size actually is what you want, you can use LaTeX to produce very nice PDFs that will fit your reader screen - set the paper size accordingly using the geometry package, select a font size, then fix all layout problems that might be occuring, and you're good.

Last edited by frostschutz; 01-21-2012 at 04:57 PM.
frostschutz is online now   Reply With Quote
Old 01-21-2012, 05:30 PM   #7
Katsunami
Wizard
Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.Katsunami ought to be getting tired of karma fortunes by now.
 
Katsunami's Avatar
 
Posts: 3,265
Karma: 14868287
Join Date: Mar 2008
Location: Netherlands
Device: Kindle Paperwhite
If you mean that LaTeX cannot produce documents of different sizes, margins and fonts, then you are wrong... but I don't think you mean that. If you mean that document and font sizes are hard to change after production, then you are correct. LaTeX is originally not intended to produce reflowable documents.

However, seeing that quite a usable HTML-file is coming out of htlatex, I still think it should be possible; while LaTeX can take page widths and sizes into account, it obviously doesn't need to, as proven by the fact that the HTML-file above is quite resiable and reflowable.

In my honest opinion, eReaders do not need stuff such as headers and footers for novels. They just need these options, for me anyway:

- Cover, and Title Page
- A ToC
- Starting each part / chapter on a new screen
- Possibility to "pop up" a foot note by tapping/clicking it
- Possibility to find a word in the dictionary by tapping it

Everything apart from the cover, title page, and TOC should just be plain text, maybe bold or italic, but that's about it. Maybe I'm just quickly satisfied :P

Last edited by Katsunami; 01-21-2012 at 05:35 PM.
Katsunami is online now   Reply With Quote
Old 02-02-2012, 09:58 AM   #8
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 7,958
Karma: 22622174
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
Quote:
Originally Posted by frostschutz View Post
Of course if a fixed font size actually is what you want, you can use LaTeX to produce very nice PDFs that will fit your reader screen - set the paper size accordingly using the geometry package, select a font size, then fix all layout problems that might be occuring, and you're good.
That's why I use LaTeX: creating PDF's that are specifically made for a 5" screen (but they work perfectly on my 6" as well) In general hyphenation is working fine (got a dictionary for both my Dutch and my English books). There are some mistakes but those aren't enough to worry about (considering I only create my books for myself).
Sweetpea is offline   Reply With Quote
Old 02-07-2012, 02:28 PM   #9
plasmadreamer
Junior Member
plasmadreamer began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Dec 2011
Device: none
LaTeX to ePub

It is essentially inevitable that LaTeX has to be translated to HTML in order
to become an ePub, because ePub is simply XHTML1.1 packaged up in a particular way.

I've written a guide that draws on my own experience here:

http://hutchinson.belmont.ma.us/tth/ebooklatex.html
plasmadreamer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple PDF to Epub or Mobi GatorsUF Conversion 1 01-13-2012 05:03 PM
Créer des epub à partir d'une syntaxe wiki (chaîne d'édition vers PDF (LaTeX), xHTML farvardin Software 1 04-03-2011 12:49 PM
Convert LaTeX into Mobi? ultimatebuster Kindle Formats 1 12-31-2009 03:03 PM
PDF -> LRF, ePUB, MOBI? krischik Calibre 12 07-23-2009 11:37 PM
Chaîne complète d'édition : HTML, LaTeX, PDF, EPUB à venir. Randy11 Software 2 04-05-2009 11:42 AM


All times are GMT -4. The time now is 12:48 PM.


MobileRead.com is a privately owned, operated and funded community.