That's a long post!
Well... first: have you tried
Prince to convert HTML to PDF? It has hyphenation, kerning, proper paragraph justification... You could even use my epub2pdf.sh script (or similar) to directly convert ePUB to PDF.
As for the LaTeX template, if you are using the memoir class, you don't have to use the geometry package, but use the class's methods instead. I admit I don't fully grasp how the different paramaters interact with each other, but this seems to work:
Code:
\usepackage{calc} %just to be able to use + in the dimensions
\setstocksize{5in}{4in} %set the paper size
\settrimmedsize{\stockheight}{\stockwidth}{*} %the used space is just the paper size
\setheadfoot{10pt}{7mm} %header and footer separations
\setheaderspaces{*}{1mm}{1}
\setlrmarginsandblock{3mm}{3mm}{*} %horizontal margins
\setulmarginsandblock{1mm+\headheight+\headsep}{\footskip+\baselineskip}{*} %vertical margins
\checkandfixthelayout %make everything consistent (this is needed)
The \setsecnumdepth command actually sets the deepest type of division that will get a number, deeper divisions will be unnumbered, so that \setsecnumdepth{part} makes chapters unnumbered (without having to use \chapter*, which has other effects). If you always want this, you can put it outside the chapter style definition. And I can remove the "normal" style definition with no problems. This works fine for me:
Code:
\documentclass[12pt,oneside]{memoir} %you don't need "openany" with "oneside"
\usepackage{calc}
\setstocksize{5in}{4in}
\settrimmedsize{\stockheight}{\stockwidth}{*}
\setheadfoot{10pt}{7mm}
\setheaderspaces{*}{1mm}{1}
\setlrmarginsandblock{3mm}{3mm}{*}
\setulmarginsandblock{1mm+\headheight+\headsep}{\footskip+\baselineskip}{*}
\checkandfixthelayout
\chapterstyle{simple}
\setsecnumdepth{part}
\makeoddfoot {plain}{}{}{\footnotesize page \thepage\ of \thelastpage}
\makefootrule {plain}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeoddhead {plain} {}{}{\footnotesize\thetitle}
\makeheadrule {plain}{\textwidth}{\normalrulethickness}
\pagestyle{plain}
\title{Book Title}
\author{A. Uthor}
\begin{document}
\chapter{1. Lorem}
\label{sec:1. Lorem}
...
\end{document}