in Coding, Samples, Writing tips

Formatting a novel using LaTex

latex-sample

If you’ve ever wondered how to typeset a novel properly, arguably the only way for the amateur novelist to do this correctly is to use LaTeX. You could use expensive software to do it, but not everyone has hundreds of pounds to spend on software that they might only use a handful of times. Most word processing packages such as Microsoft Word or LibreOffice can get somewhere close to typesetting, but they’re really only any good for a rough guide. I had written an article on how to do drop-caps in OpenOffice, but after I typeset my novel using LaTeX I realised it was a big mistake and should never be used for a novel in production. Word processors lack the refinement of dynamic justification and seem to have very poor handling of scene breaks, to say the least.

LaTeX can take a long time to master, so I opted for a slightly more user-friendly approach and used Lyx. If you’ve gone ahead and installed this, don’t be fooled into thinking that it’s a word processor – it’s not! You won’t see what you get until you export a pdf (all mine are exported using pdflatex) so be prepared for a lot of experimentation.

This page isn’t really intended as a full tutorial – there is plenty of documentation out there for both writing directly in LaTeX and for using Lyx. Instead, I have provided the source files for a sample project based off my own novel, Synthesis:Weave. The first four chapters are included as reference to see how the formatting actually works in a novel when using Lyx. The exported LaTeX file is also included, along with the reference materials such as svg graphics and bitmap images for title, publisher logo and biographical photo. The later sections have a little more explanation on how to format features that may not be in the sample chapters, such as how to add back matter such as acknowledgements.

Several modules are used (noted below in the screenshots of Lyx’s document settings panels) and have various functions, such as modifying justification, setting up page headers, and allowing drop-caps. I would suggest downloading the zip file below, extracting it, and then, depending on your workflow, studying the LaTeX or Lyx project whilst comparing it to the reference PDF included – this should give you a good idea of how everything works. I regret that since this was all performed on Linux, I can’t give anyone any help on how to use this with Windows or other operating systems.

The resulting PDF generated by Lyx (using export > pdf (pdflatex) option) I then uploaded to IngramSpark to use as the interior for the book – no changes required!

 

Preference panels for Lyx:

Here the document type is set to memoir, this enables us to have indented first-line paragraphs, as per standard novel layout.

latex-prefs-1

latex-prefs-2

latex-prefs-3

latex-prefs-4

latex-prefs-5

Here I set the page size to 8.5 inches by 5.5 inches, which is the format for both the hardcover and paperback versions of my book. The same generated pdf file is used for both, but with different ISBN numbers (hence there being two of them in the sample file).

latex-prefs-6

The margins are based on inner/outer dimensions – ordinarily the inner margin will be a bit larger than the outer, to allow for the inflexibility of the spine. If you did a very thin book that was stapled, you could get away with less space.

latex-prefs-7

latex-prefs-8

latex-prefs-9

latex-prefs-10

latex-prefs-11

latex-prefs-12

latex-prefs-13

latex-prefs-14

latex-prefs-15

latex-prefs-16

latex-prefs-17

latex-prefs-18

latex-prefs-19

Most important of all is this panel – the latex preamble. Here I have specified which modules to use: fancyhdr, lettrine, and microtype. fancyhdr enables the use of custom styled header text. The rules in fancyhead are set up with different page classes. For the class fancyfacing, its used to set the RO (right, odd), LE (left, even) to have the page title in those slots. My name is in the centre on even pages (CE), and the book title in the centre on odd pages (CO). For plain pages there is no information, as this is where the chapter heading appears. Check the latex/lyx file to see where this is implemented.

The lettrine module sets up the big initial for each chapter, though there’s still a fair bit of manual implementation to be done on each.

Finally, microtype adds an extra filter to justification and allows some of the spacing between words to be modified dynamically. Without this you sometimes get horrible hyphenation breaks on words, or text that ends up too widely spaced. Microtype makes tiny adjustments to this so that it looks attractive.

latex-prefs-20