2

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.

3

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.

  • Thanks. This seems to be exactly what I need. I will need to tweak a bit \frontmatter and insert a few images. Can You suggest the right style to get a properly formatted e-book? Note: my volume is quite large (>700 pages) and divided in three \part; what is the right way to put cover/description/author info in an e-book? – ZioByte Apr 20 at 12:10
  • 1
    @ZioByte I've updated my answer. The author and title should be included automatically from the \title and \author commands. – michal.h21 Apr 20 at 18:39
  • I'm having problems with images (in the text, not cover; inserted using \includegraphics): they disappear from tex4ebook completely (I didn't find any reference to the files in logs). Can You divine what's happening or should I issue another Question? – ZioByte Apr 21 at 10:56
  • @ZioByte do you use the image extensions in \includedraphics? if not, you may need to add the \DeclareGraphicsExtensions{.svg,.png,.jpg,.pdf} command to the configuration file. It it doesn't help, it would be best to post a new question. – michal.h21 Apr 21 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.