3 ms·
I settled on something similar for my needs, and I'm really happy with it. 1. Book is entirely written in LaTeX, every chapter in it's own file, master doc wit
by grecy 8y ago
I settled on something similar for my needs, and I'm really happy with it.
1. Book is entirely written in LaTeX, every chapter in it's own file, master doc with everything combined. I really like having different gutters for left and right pages, ultimate control over formatting, fancy things like Lettrine, header layout and design etc. When I want to do something across the entire doc I write a new command and can use it anywhere.
I Create perfectly formatted print-ready pdf to go to printers directly from this.
2. Run LaTeX file through pandoc to create an ePub.
A little known trick that is now supported by pandoc is conditionals in the LaTeX doc, so when formatting gets hairy I declare commands like this in the master LaTeX document:
\iftoggle{ebook}{
\newcommand{\textbreak}{\newline\hrule\newline}
}{
\newcommand{\textbreak}{\begin{center}\LARGE{$\Psi\quad\Psi\quad\Psi$}\end{center}}
}
So I can use \textbreak{} anywhere I want, and I know it will be formatted perfectly in both output formats.
3. Un-pack the ePub and tune some of the html/css to my personal taste, then pack it back together. I run it through kindlegen to make sure it's valid, and I have an epub/mobi ready to upload to stores.
I like this workflow so much I'm using it again for my next book
- sehugg 8y agoI've never been able to get a good LaTeX -> epub pipeline working. There are too many issues with things like tables and splitting code listings across pages -- epubs are just optimized for fiction. I find it's better just to ship a PDF.
- grecy 8y agoI agree epub are painful when you have complicated layouts like tables and code listings.. it's just how the format is. My book was a non-fiction novel, so that made life much easier, I only had some tricky image layouts to deal with.