[Tex/LaTex] a reasonable course to convert a novel from latex to epub/azw

ebookepubxhtml

I need to convert a novel (NO math, but lots of citations and direct speech) from current PDF/printed paper to high-quality epub/azw4 to publish as eBook.

Current layout is based on memoir and quotmark.

I know I can use htlatex to produce a reasonable output, but that is not really satisfactory because it produces a single .html file with little control over chapters that do not behave "as expected" (i.e.: start a chapter at top of page and not like a "continuous ribbon").

I would like to have a behavior similar to standard Kindle Create output (I tried going the latex->docx->KindleCreate way, but it messes badly with direct speech and "maiuscoletto" I use heavily (using Italian language might add noise to process as MSWord has "localized" Style names possibly unknown to other tools).

Can someone suggest a viable alternative?

I did not find a suitable answer perusing similar questions.

Best Answer

tex4ebook can produce ePub, ePub3 and mobi formats from LaTeX sources. It uses tex4ht (the same system as htlatex uses) for the LaTeX to HTML conversion. The HTML files are then processed and packed to produce the requested output. It needs the kindlegen command installed for the mobi output.

Basic usage:

tex4ebook -f epub3 filename.tex

You may want to add some custom metadata, cover image or a nice CSS. It can be added using a configuration file:

\Preamble{xhtml}   
\CoverMetadata{cover.png}
\Configure{AddCss}{blitz-lite.css}
\begin{document}
\EndPreamble

Save the file as myconfig.cfg and require it in tex4ebook using the following command:

tex4ebook -c myconfig.cfg filename.tex

The config file adds a cover image named conver.png (it must exist in the current directory) and the CSS file provided by The Blitz Framework. You may add how many CSS files you want using the \Configure{AddCss}

BTW, even htlatex can produce separate HTML files for each chapter:

htlatex filename.tex "xhtml,2"

The number in the last parameter specifies at which sectioning levels should be the files partitioned, there are four possible levels (up to \subsection I think). It produces some navigation in each file, which is not that useful in ebooks. tex4ebook removes the navigation, so it is still preferable to use it instead of htlatex.

Related Question