LaTeX Template for Ebooksnavigate:backcounter

I was toying around with tex4ebook to automatically generate from a single latex source not only dvi, ps and pdf versions but also epub2 ebooks.

After bugging Michal from the tex4ebook project to fix a lot of issues, tex4ebook can now be conveniently used to create simple layouts. I created a template that mimics a typical smashwords novel. It's quite easy to write a novel from scratch when keeping the caveats at the bottom of the page in mind. An already written novel requires perhaps some tweaking. Everything beyond novels, such as technical reports, exceed the capabilities of tex4ebook and will not look good.


Organization of the Template

The template generates an epub version as well as conventional dvi, ps and pdf book versions:


book.tex is my preferred template for typesetting generic text and should be adapted to your liking. As a minimum, you may want to change the title and add an author in the titlepage environment.

In ebook.tex change:

This information is used for the front matter as well as for the ebook meta information.

A brief copyright statement can be put into copyright.tex and the actual novel is in section??.tex. These files are included from ebook.tex and book.tex and shared among them.

The Makefile targets epub, dvi, ps and pdf create the actual ebook ebook.epub as well as conventional book.dvi, and book.pdf book versions. It is highly recommended to call these targets together with clean, e.g. make clean epub, make clean dvi, make clean ps or make clean pdf.


The template is for novels consisting of cover, front matter and text.

For ebooks no space is printed for whitespaces after closing environments and must be manually added (example: "I love {\tt bash\ } but not {\tt csh}."). This enforced spacing happens to look good in the conventional book versions, as well.

On the titlepage, FBreader offsets the author name by 40pt. This is because FBreader is indenting paragraphs by 40 pt and happens to formats author names as paragraphs. Under FBreader, paragraph indentation can be changed under Options -> Format -> Regular Paragraph -> First Line Indent and set to 0. Azardi correctly formats the author name.

Note, horizontal rules (\hrule) as well as Umlaute and other non-7 bit ASCII characters are supported. For the ebook version, ligatures are rewritten into their individual characters. For the conventional book version, ligatures are not rewritten.

Required Software

After installing the required software, but before making any modifications to the template, try out if the vanilla template works for you: unzip the template, then run make clean epub; ls -la ebook.epub as well as make clean dvi; ls -la book.dvi, make clean ps; ls -la and make clean pdf; ls -la book.pdf. This should have generated ebook.epub, book.dvi, and book.pdf. This generated also a lot of temporary files which can be deleted with make clean.


You are welcome to send me comments. Contact information is available on the main page.