# Conversion XeTeX -> EPUB

I've got (Xe)TeX document. It s fine to compile into PDF. However, I'd like to know how can I do to export it into EPUB in order to read it with my Sony Reader. I've tried to use many tools such as Calibre to convert from PDF to EPUB, but the conversion is extremely bad...

Thank you

-
When it is for personal use, my favourite thing to do is to use a template I've set up for the dimensions of my reader (in this case a Sony PR-650 or something like that). I then \input the raw .tex file into the template/master file and run lualatex or pdflatex. So far, this seems easier than messing about with trying to get a good .epub file (especially from calibre) --- though this will change, I suspect. –  jon Apr 25 '12 at 2:22
Does this help: Effort to make (La)TeX eBook-friendly Is it a duplicate? –  Werner Apr 25 '12 at 2:24
@Jon Very interesting idea. Actually, I use the same reader as you. What do you mean by template? Do you mean that you just use the geometry package according to the reader screen so you can also watch the same pdf very small on your PC screen? Then you import it in your reader? Because otherwise I have no idea how to make a template... Thank you. –  Swiss12000 Apr 25 '12 at 3:27
I posted a (really) basic example of what I do. It might be useful as a basic starting point. –  jon Apr 25 '12 at 4:24
ConTeXt can export to Epub. Here are two blogs about how to set this up: A style file for eink readers and Creating a style file in ConTeXt –  Marco Apr 25 '12 at 7:38

Here is a simple example (i.e., minus a couple little things I do that aren't relevant to the basic template). I try to maximize the real estate on the screen, so I get rid or headers, footers, and all that. If you want that stuff, you need to tweak the geometry settings some.

\documentclass[12pt,oneside]{memoir}%
\setstocksize{168mm}{118.8mm}
\usepackage[
paperwidth=118.8mm,textwidth=115mm,
paperheight=168mm,textheight=160mm,

% font stuff here

\usepackage[ open, openlevel=1, atend ]{bookmark}

% page set-up, etc., stuff here

\begin{document}
\pagestyle{empty}

\input <somefile.tex> % this is the file you want on the reader

\end{document}

-
Hello, I'll try this example looks nice. –  Swiss12000 Apr 25 '12 at 14:46
Hum actually I confirm that this is a better solution than creating an epub. Indeed by reducing the PDF to the reader screen I have a perfect typography even for maths. This is brillant. Thank you jon. ++ –  Swiss12000 Apr 26 '12 at 14:34
Glad it works for you! –  jon Apr 26 '12 at 16:01

Pandoc is able to convert from LaTeX to epub. In your system command line:

pandoc document.tex -o document.epub


However, I'm not sure how many features from TeX it actually support.

-
Interesting alternative Pandoc... But sorry I don't understand how to use it. On TeXmaker I try to add the line you gave on the settings but it's not working. dl.dropbox.com/u/6421260/pandoc.PNG Did I do something wrong? Thank you –  Swiss12000 Apr 25 '12 at 15:01
You should use it from the command line on your system. cmd in Windows, but that's beyond the scope of these comments. On Super User you can get the help for that. –  Henrik Hansen Apr 25 '12 at 15:49
Hum actually I tried Pandoc by curiosity. And it's good working if you have only 1 TeX file. But I couldn't get my full epub by taking my main tex file who has got many "\input{...}" to the other tex files... –  Swiss12000 Apr 25 '12 at 20:52