1

I have a 508-page book setup in LaTex. The book has 60+ images and uses custom fonts (the reason why I'm using XeLaTex). I use Overleaf and can easily spit out PDFs to create the paperback version of the book. I need to create an ePub version of the book for Kindle and digital platforms.

I looked at a lot of different threads and solutions (SimpleTeX4ht, Pandoc, TexStudio > HTML > Calibre, tex4ebook, etc). Nothing seems to work out-of-the-box for XeLaTex-compiled books.

What's the easiest/fastest/simplest way to get from LaTeX to ePub in my situation?

A big reason why I used LaTeX for layout is because it makes it easier to manage/update/reuse in different formats, so ideally I'd like to be able to use the same code base for everything.

  • tex4ebook (which is based on tex4ht ) allows all of the major engines (pdfLaTeX, LuaLaTeX and XeLaTeX) for compilation. – Alan Munn Aug 06 '20 at 21:43
  • I'm a noob. Haven't been able to make it work. Ideally, I'm looking for something easier than command line. – egarbugli Aug 06 '20 at 21:51
  • 1
    You will need to use commandline in every case. Use tex4ebook -x filename.tex to compile usin tex4ebook with xelatex. It can happen that not everything works out of the box, but it can be usually fixed.it would be best if you could add an example that shows what fails. – michal.h21 Aug 06 '20 at 22:14
  • It seems this can't be done without a considerable will to learn new things on your part. On rather simple thing you could try is importing your file to lyx (https://wiki.lyx.org/GSoC/XHTMLePub) and then try from there. I cannot promise you anything except that there is a nice GUI which might make things easier … – phil-elkabat Aug 07 '20 at 07:49
  • 4
    imho as you managed to write a 500 page book you should stop call yourself a noob and tackle the task to learn to use the command line - it is not so difficult, basically it is only a plain black window where you type short words and then hit enter. – Ulrike Fischer Aug 07 '20 at 09:11
  • Haha. Fair point. :-) I did learn LaTeX in the past 8-10 days thanks in part to this community. :-) I'll try with @michal.h21's command and post if I run into issues. Thanks! – egarbugli Aug 07 '20 at 14:50
  • I was able to get it to run. :-) I got a lot of errors though. Any way to fix those?

    Just a sample:

    [ERROR]   htlatex: Filename Line Message
    [ERROR]   htlatex: /usr/local/texlive/2020/texmf-dist/tex/latex/pdfpages/ppxetex.def 43  Package pdfpages Error: The graphics package was loaded with driver
    [ERROR]   htlatex: ? ?  Incomplete \iffalse; all text was ignored after line 472.
    [ERROR]   htlatex: ? ?  Emergency stop.
    [FATAL]   make4ht-lib: Fatal error. Command htlatex returned exit code 1 ```
    
    – egarbugli Aug 10 '20 at 04:18
  • I also run into compilation issues if I try to generate the html with make4ht instead of tex4ebook:
    [STATUS]  make4ht: Input file: main.tex
    [ERROR]   htlatex: Compilation errors in the htlatex run
    [ERROR]   htlatex: Filename Line Message
    [ERROR]   htlatex: ? 45  Fatal Package fontspec Error: The fontspec package requires either XeTeX or
    [ERROR]   htlatex: ? 45  Emergency stop.
    [FATAL]   make4ht-lib: Fatal error. Command htlatex returned exit code 1```
    
    – egarbugli Aug 10 '20 at 04:24
  • 1
    @egarbugli I don't get notifications if you don't my username in your comment. anyway, it is impossible to tell what is wrong without sample of your code. It can be caused by some package clash. From your second error mesage I see that you use Fontspec. In this case you need to call make4ht of tex4ebook with either -x (for XeLaTeX) or -l (for LuaLaTeX) option. – michal.h21 Aug 19 '20 at 15:22

0 Answers0