matthew shane brown
matthew shane brown
matthew shane brown
  • words
  • images
  • about
How to Format a Book for Print and eBook Using LaTeX
Total
0
Shares
0
0
0

LaTeX is an ideal tool/markup language to use for formatting manuscripts, especially those that contain few images. I handled all of the formatting for my new book, Fly Fishing in the 21st Century, in Kile, an open source LaTeX editor from KDE. This is an excellent tool and makes it extremely easy to achieve professional-quality layout easier than using a GUI-based tool like Scribus, inDesign, etc.

It is the only tool you should consider using if you are preparing a similar published work. Folks seem to like Vellum, but I’m an open-source software advocate, and this will work better and is more flexible… and is free.

Another caveat emptor before we begin: I work in Linux (and specifically Arch because the AUR is so helpful, as we’ll see below), so you may experience new and wonderful sorts of difficulties if you do this on MS or Apple OS.

Workflow

From the completed manuscript (usually done in LibreOffice Writer, although I am using Manuskript and think the latest version is pretty great), I’ll copy and paste each chapter into the body of the .tex document in Kile. When everything is in and the compiled document is ready to be printed to .pdf, I compile using XeLaTeX (make sure to select this specifically), and it generates a .pdf in your working directory. This is what you will upload to wherever; the content of your book.

I have my document set up for the two formats the book is published in, 6″ x 9″ hardcover and a 5.50″ x 8.25″ paperback. This is controlled using code in the preamble of the .tex document, and when I want to print one or the other, I just comment out the inactive section.

My publishing company prints using both Ingram Spark and KDP, and there are small variations in file configurations for margins, etc. I’ve included everything below so you can publish your (hopefully) high-quality writing on your own terms.

I am not an expert in LaTeX and have no desire to become one, and when you compile the below code you will likely see a few warning messages. Don’t be alarmed, the compiled file will be fine.

LaTeX Document Setup

In addition to the basic preamble required for setting up the document, I’ve also included below a basic front matter to the book including a Table of Contents (driven off the \chapter{} titles), a dedication page, and a page for an epigraph, if that’s what you’re into.

In this example, the code for the hardcover format has been commended out.


\documentclass[10pt,twoside]{memoir}

% === Layout Settings for 6" × 9" Hardcover ===
% Adjusts the physical trim size, margins, and typeblock for print

%\setstocksize{9in}{6in}                         % Total page size (trim size)
%\settrimmedsize{9in}{6in}{*}                    % Trimmed page size (same as stock)
%\settypeblocksize{6.875in}{4.5in}{*}            % Text block: height × width
%\setlrmarginsandblock{1in}{0.75in}{*}           % Left (inner) = 1", Right (outer) = 0.75"
%\setulmarginsandblock{1in}{0.875in}{*}          % Upper = 1", Lower = 0.875"
%\setheadfoot{14pt}{0.5in}                       % Header height = 14pt, foot baseline = 0.5" from bottom
%\setheaderspaces{*}{*}{1}                       % Let memoir optimize header spacing
%\checkandfixthelayout                           % Apply all layout settings



% === PAGE & MARGIN SETTINGS for PAPERBACK ===
\setstocksize{8.25in}{5.5in}
\settrimmedsize{8.25in}{5.5in}{*}
\settypeblocksize{6.75in}{4.0in}{*}                   % Same text block size
\setlrmarginsandblock{0.875in}{0.625in}{*}            % Inner = 0.875", outer = 0.625"
\setulmarginsandblock{0.75in}{0.75in}{*}
\setheadfoot{12pt}{0.25in}
\setheaderspaces{*}{*}{1}
\checkandfixthelayout

\linespread{1.3} %adjusts spacing between lines

\setlength{\footskip}{0.5in}        % Force page number baseline to 0.5" from bottom edge

\newcommand{\sectionbreak}{
  \Needspace{4\baselineskip}
  \par\vspace{2em}
  \noindent\centerline{\textasteriskcentered\ \textasteriskcentered\ \textasteriskcentered}
  \vspace{1em}\par
}

% === BASIC PACKAGES ===

\usepackage{fontspec}
\setmainfont{Liberation Serif}

\usepackage{microtype}
\usepackage[english]{babel}

\usepackage{needspace}

\usepackage{xltxtra}

% === PAGE NUMBER STYLE ===
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\small\scshape BOOK TITLE HERE\textsuperscript{st} Century} % Left header on Even pages (Verso)
\fancyhead[RO]{\small\itshape \leftmark}                        % Right header on Odd pages (Recto)
\fancyfoot[LE]{\oldstylenums{\thepage}}
\fancyfoot[RO]{\oldstylenums{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\begin{document}

\chapterstyle{default} % reset to a basic style
\makechapterstyle{myplain}{
  \chapterstyle{default}
  \renewcommand*{\printchaptername}{} % no "Chapter"
  \renewcommand*{\printchapternum}{}  % no number
  \renewcommand*{\afterchapternum}{}  % no space
  \renewcommand*{\printchaptertitle}[1]{\centering\Huge\itshape ##1}
}
\chapterstyle{myplain}


% --------------------------
% Front Matter Section
% --------------------------
\frontmatter

% --- Title Page ---
\begin{titlingpage}
    \centering
    {\Huge\bfseries BOOK TITLE HERE\textsuperscript{st} Century \par}
    \vspace{2cm}
    {\Large by\par}
    \vspace{0.5cm}
    {\Large AUTHOR NAME HERE\par}
    \vfill
\end{titlingpage}

% --- Copyright ---
%\cleardoublepage
%\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
    \small
    Copyright © \the\year{} AUTHOR NAME HERE\\
    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, mechanical, photocopying, recording, or otherwise—without prior written permission from the publisher, except in the case of brief quotations used in critical articles or reviews.

    \vspace{1em}

    \noindent{ISBNs:} \\
\quad EBOOK ISBN HERE (eBook) \\
\quad PAPERBACK ISBN HERE (Paperback) \\
\quad HARDCOVER ISBN HERE (Hardcover)

  \vspace{1em}

    \noindent{Library of Congress Control Number:} \\
\quad CONTROL NUMBER HERE


    \vspace{1em}

    Published by PUBLISHER NAME HERE\\
    CITY, STATE\\

    \vspace{1em}

    The information is provided in this work is for general interest and is not intended as professional advice. The author and publisher disclaim liability for any loss or injury resulting from the use of the information in this book.


\end{center}
\vspace*{\fill}

\cleardoublepage
%\thispagestyle{empty}
%\vspace*{\fill}



%\vspace*{\fill}

%\cleardoublepage

% --- Epigraph ---
\cleardoublepage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Lorem ipsum in dolor sit amet.
\end{center}
\vspace*{\fill}

\cleardoublepage

\tableofcontents

\mainmatter

And then place your body text after this, using the following code to indicate and name each chapter:

\chapter{Chapter Name}

Note that if you choose to differ from the dimensions I went with for my book, you’ll need to add your own measurements and such. ChatGPT is not a bad tool for this, or your print service should have a guide of their own to set up your page based on the trim size.

If you are only printing a hardcover or only printing a paperback (I don’t know why you would only do one of the other, but you do you), then of course you can just delete the irrelevant section of code and not worry about commenting anything out.

Converting to eBook in Linux

To convert a .tex file to an .epub, you need to use the package tex4ebook. Again, this is available on the AUR for Arch Linux-based systems.

In the terminal navigate to your working directory and run the command:

tex4ebook -f epub3 -x target-file.tex

You will then see the .epub sitting in your working directory.

I had a lot of issues getting this tool to run neatly on my .tex file for some reason, but the above is the solution that worked for me, and should work for you if you set your preamble up in the exact same way.

Once you have your .epub file, you need to import that into something like Calibre.

Once you’ve imported your .epub into Calibre, add your cover image and metadata, and then export the whole thing into one file. This is then what you upload as an eBook to KDP, advance readers (BookSirens is probably the best ARC service), wherever.

If you’re using an OS that doesn’t have access to these packages, I have no idea what to tell you.

Conclusion

With the barrier to entry for self-publishers or small/vanity publishing companies so low now, there are tons of ugly books that were clearly formatted in Microsoft Word floating around on Amazon and wherever else.

Technology is so advanced now that there is no excuse for this, and while it seems advanced at first glance, once you get your .tex document and editor set up, getting a professionally-formatted print work is really as easy as pie. Of course, once you are set up, it becomes even easier for subsequent works.

For troubleshooting or general tweaks? Use ChatGPT.

A lot of the way this document is set up will irritate LaTeX nerds and possibly throw some warnings when you compile, but the printed page won’t know.

There’s no need to pay a ridiculous amount of money for proprietary software when the open-source community supports this workflow perfectly. You give up nothing here in terms of capability, and society gains by not having to pretend to like a book that looks like it was layed out by a kindergartner.

If this article was helpful to you, consider picking up a copy of Fly Fishing in the 21st Century at Amazon or Barnes & Noble so you can see for yourself just how much independent publishing is capable of now.

Also, on a related note, if you are a serious hunting, fishing, or shooting sports writer with a story to tell, send us a query letter using the form here.

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Previous Article
Photo: Matthew Shane Brown
  • Hunting & Fishing

The Marble and the Sculptor

  • July 2, 2025
View Post
You May Also Like

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Input your search keywords and press Enter.