LaTeX and Novel Formatting

blog-image

Completing a book is the main goal for all authors and writers alike, but that certainly isn’t the end of the hard work, especially if you are an independent author who needs to look at editing, typesetting, cover art, formatting for ebook and print(two very different things), and everyone’s least favorite – advertising. It’s one thing to finish writing a project but as one starts to look at the challenges to put that manuscript in front of your audiences eyes it can become overwhelming. I am writing today to offer some advise on how one can go from manuscript to print read pdf/epub with FREE and opensource tools. Mainly using the framework that is LaTeX.

What is LaTeX?

LaTeX is a free and opensource, formatting and typesetting framework that is normally used with mathematical and scientific text books, due to its flexible nature and ability to render equations in a precise and repeatable fashion. In short, LaTeX is to book formatting as HTML is to web formatting. It simply describes how to render the document, given specific instructions.

With all that said LaTeX is almost perfectly built for formatting novels, short stories, poems, collective works, however you want your work to look, LaTeX can be tweaked to make that happen.

Why LaTeX?

  1. I am an advocate for open source solutions, so I will always try them out even if that means spending a little more time learning them. It took me ~ 1 week to go from vague idea of LaTeX to happy with my final product.
  2. Scrivener only works on Windows/Mac. I use a Linux operating system for everything and my only reason for Windows is recording music and previously formatting with Scrivener. My laptop with Windows was running out of steam, and I am impatient, so I would rather take the time and learn something new, instead of waiting for my laptop to load. LaTeX presented itself as a cross-system compatibly solution.
  3. Couldn’t find anything as powerful. I searched the web for online tools that would help with formatting, and to be honest they all felt like gimmicks instead of just providing a good tool. I wanted to be able to insert images at certain places, take care of front matter, etc, but all the online tools would restrict what I was able to do.
  4. Learn a new skill.

How to LaTeX?

If you are technically inclined I have created a GitHub with all the information and sample files to show a sample of what I have been able to create with LaTeX.

https://github.com/NaughtPressOrg/Novel_formatting

For those that are not, I will break it down a bit more. All my instructions will be geared towards Linux users, but fear not because all programs discussed are compatible with Windows, Mac OS and Linux.

Install texlive and TexWorks. The full install of texlive will include pretty much every package you could ever dream of in the TeX ecosystem, so it is nice to have everything so that you can quickly try different things and not have to spend time finding and downloading new plugins. TexWorks is a light weight editor/compiler that I find easy to use, there are many different ones out there, with a ton more features but this is what I like.

Use Memoir, as the main document class. This package is made for novels and fiction writing and has a lot of pre-built tools that will help you get to finished much faster.

The below section is from the README on the github page:

main.tex – everything for setup and formatting should go in this document. This includes scripts, macros, includes, font selection, header/footer formatting, etc.

main.tex is the skeleton and brain of your document, with the content in seperate sub documents that will make it much easier for organizing and once you get used to the syntax much clearer where things should be changed and how that effects the document as a whole. One should rename main.tex to be the title of the book for simplification and organization.

frontmatter.tex – This includes title page, dedication, copyright info, and anything that should preceed the novel. With all of these files it is important to visualize and understand how the viewer will see each page (front page, back page, even pages, odd pages) in relation to where content goes. I recommend comparing with other books in your home to see which pages are commonly included.

prologue.tex and chapter-one.tex – These files will hold your novel seperated by chapter. I’ve set them up to auto fill with Lorem Ipsum. which you can see in the included main.pdf

backmatter.tex – this inculdes any extra information at the end of your book.

main.pdf – this is the result of all the above files compiled together and published to a pdf.

Latex to epub

By default, LaTeX is designed to produce a print ready pdf. This is great for those who want to print on demand with CreateSpace or Lulu, but if one tries to convert a pdf directly to an epub one losses a lot of the great formatting as pdfs do not contain structural information so all converters have to guess at what you mean, and most of the times they fail.

Remember as I said above, LaTeX is a formatting/description language much like html, so the goal is to convert tex to html, and use the html version to generate an epub file that can be further refined.

Switch documentclass in main.tex to \documentclass[10pt,ebook,oneside,openany]{memoir} %ebook format. Save.

Install sudo apt install tex4ht for html latex support.

$ htlatex main.tex to produce main.html an html version of the final product. This will also produce a crapton of other support files.

Use Calibre to import the main.html and add metadata, book cover, and convert to .epub. Save .epub to disk.

Import .epub into Sigil and smooth out converting issues to make the document look as you wish. You can also edit metadata and add content at this stage. Save and publish!

Again, all of these tools are available for Linux, Mac OS, and Windows.


If all of the above is overly complicated and you would like help with formatting your book. I would be happy to provide consultation services for a flat fee of $100 per book/setup. I find this work highly satisfying and would love to work with you to make your product stand out and appear as professional as a traditionally published book. I can format your book and/or help get you setup so that you can do the same and continue to do so for all of your books future and past.

STAR CX

Putting all of the above into practice, I have used LaTeX and this series of tools to create the ebook and paperback versions of STAR CX: VS. 1 – A Saga of Starcrossed Souls and STAR CX: VS. 1.5 – I/O. I will continue to use it and perfect it in future stories as well.