[an error occurred while processing this directive] Thicker Than Blood
(C)2005,(C)2006,(C)2007,(C)2008. Some rights reserved.
First Creative Commons, community edited, fiction novel.

How do I make my novel/book into a nice PDF?

Using the TeX typesetting language in a fiction novel.

So you have written a fiction novel you want to make available online. You are staring at 300 hundred pages of you deepest thoughts formated 20 different ways in word document that will barely load.

Who am I kidding, you think. I should leave the formatting to the professionals

Never to fear, there are whole languages written specifically for publishing!

TeX (pronounced tek) is a typesetting language with minimal tagging and formatting needed for a typical popular fiction book. Text files with simple changes can be made into a book length PDF with uniform formatting.

The best part is, if you book is strange with all kinds of weird formatting, alternative languages (including the language of mathematics) and graphics galore, TeX can do that to. It's just a little harder.

I use LaTeX, which like TeX is free software. So there is no charges or strange license issues involved. Latex is very versatile and usable with a little guidance. Unfortunately I found the guidance out there, well weak, and I and I work with open source software for my day job!

Uh huh. Yeah sure you used this stuff.

What better than a document shared under a creative commons license, to share a few tricks. Well fine then here is the finished products and the source file.

Public format

Submission format

Single source .tex file.

build-book.sh to build three different .pdf files in one shot.

Go ahead and copy, paste, modify and share this page to your hearts content. This document is shared under the Creative Commons Attribution, Share Alike License, but all formats and versions of "Thicker Than Blood" are licensed under a different Creative Commons License.

What tool should I use to write the book?

LaTeX is so easy to format that I can give you the basics in one line! Here it comes...

Write your book in a text editor with no indentation, with a blank line representing each paragraph break.

Yup that's it. All the indentation, line wrapping, spacing, page breaks, and page numbers are taken care of when the .tex file is converted (or compiled) into a .pdf. This is what TeX is built for. Taking a ruleset and a large amount of text, and automatically typesetting it for you. Page 200 will look similar to page 3.

Just blank lines for paragraphs? What about chapters?

OK I fibbed just a bit. There a few tags you need to know for the body of the book. Tags more or less always follow the \somecommand{input} format. Don't worry you don't need to use them that often.

  • You should put a \chapter{} in where you want each chapter break. If you want to name a chapter, simply put the name inside the curly braces like this. \chapter{The Finale}
  • You may want to emphasize a particular word or words with italics. This is done with the \emph{} tag. For example: Doing anything with computers can become \emph{really} hard.
  • In addition if you use the sffms class, you can use a special \emph{} tag called \thought{}. This way you can more easily tell why you emphasized something later. For example: She thought, \thought{who told her to wear horizontal stripes?}
  • A warning, a hyphen or '-' is special to TeX, so you need to double them up, like '--' This may be the most annoying about formatting your book this way, since lots of things use hyphens.

Why did you trick me into thinking no tags were needed?

It was for your own good, sorry. You can write an entire book using separate text files to represent each chapter and spaces for paragraphs and join and tag all the files later. That is exactly how I wrote Thicker Than Blood. The nice advantage to that is that you can focus exclusively on the literature and deal with the rest later. In fact if technicals don't interest you and your book is nowhere near done you can bookmark this page and forget it until you need it later. You have all the advice you need.

LaTeX seems to be a vast relm, where do I start?

It is. That's why I'm here. It runs on many (all?) operating systems and has a plethora of classes at your disposal. You don't need most of them, just a few.

I am going to assume you have at least a little Unix or Linux background, and make these examples specific to Debian Linux. This may not require any changes when you switch to say the easier Ubuntu Linux, but may require different package installation procedures for BSD, Solaris, or OS X. (Yes Apple really is Unix underneath.) Your .tex document might have been exactly the same under Windows, just the tools would be different.

Core Software
Operating systems; The vast bulk of my experiences with TeX have been on assorted versions of Linux. I use Debian Linux, but most of the newest versions of Linux with the "Publishing" suite installed should work fine. I would like to add both Mac and Windows specific notes, but that will have to be later.
Class files; If you installed LaTeX as an all-in-one package, but a class you want to use is missing, you can usually go to their site for instructions and files to get the class working. Frequently, dropping the appropriate .cls file in your working directory is sufficient.
Helpful Classes
Book Class; While LaTeX does have a "book" class built in you may not want to use it. There is a class written specifically for popular fiction novels. Sffms is designed to create publisher submission friendly formats. You can turn 'submission' on and off by changing a word in the beginning of the book. So you can use the same source document for the pretty public creative commons version and submissions to publishers, contests, editors, etc.
Graphics Class;You may want to include some simple graphics for covers, start of new chapters etc. There seem to be many graphics packages available for LaTeX. I used the graphicx package.
Hyperlink Class; I wanted to set up some nice PDF features, at least for my non submission format. Specifically I wanted to set up table of contents in the index view in the side panel. Under some circumstances, this can be auto-generated by including a single tag. There were some unexpected results with the standard TOC and the above classes, particularly SFFMS. It seems only numerated chapters are real to SFFMS. I also wanted bookmarks to every chapter beginning with the cover page. Instead I set up my own hyperlinks to each chapter. I did this with the pdftex library. It also allowed me to set up hyperlinks. For instance to the thickerthanbloodthebook.com site.

How do I install LaTex?

Debian; In Debian unstable with apt properly configured you should be able to perform a apt-get install tetex-base texlive-latex-extra texinfo as the root user and install all the needed tools. If it is already installed, it will tell you.
Linux in General; Often installing the "publishing" suite when you install the operating system will install LaTeX as well.

I've installed the software, now what?

Go back up your files. Don't give me that look. Go copy them onto another computer right now... You're back? Good. Now we can continue.

Step One: Make a big text file.

Next you need the text file you have been meticulously building. If it is pile of text files like I did you will need to concatenate them into one. This could be done with a command like cat chapter*.txt > mybook.tex If you use separate files to indicate a new chapter like I did, you may want to add \chapter{} tags at the beginning of each file before joining them.

You should now have one big text file like mybook.tex. Paragraphs should be separated by blank lines and chapters by the \chapter{} tag.

Step Two: Create test file with basic header and footer information.

Next you have to add directives to tell latex how you want your book to look. I'll give them all at once, and I'll go over the non obvious ones.

At the top of the file...

\author{M. A. Newhall}
\title{Thicker Than Blood}
\runningtitle{Thicker Than Blood}
% Copyright 2005,2006,2007 Some Rights Reserved
% http://creativecommons.org/licenses/by-nc-nd/2.5/

And at the bottom...


Here is a link to a prey typed sample 'hello world.' It should compile. It worked for me.

\documentclass[12pt,novel,nonsubmission,notitle]{sffms} - This tells latex to use the sffms library, and tells it to format the document with courier 12 pt font. It is to print in nonsubmission format (single spaced), and should not print a title page. You probably want a title page, at least until you have a graphical cover. 'smart' tells it to use smart quotes, transforming simple double quotes that are straight lines into quotes that curl inward toward your text (assuming your quotes are all matched) People will complain about the graininess of the default font when read from computer screens. This is one good reason not to distribute your book for reading online in submission format.

\runningtitle{} - Is only used in submission format. It puts the name of the book in the top right hand corner of the page.

\thirty{} - Tells it to replace the end hash marks with the contents of the curly braces. This is used in submission mode.

% Any comment - Percent signs identify comments that are not to be included.

Similar sections should be at the top and bottom of your big .tex file. Take care not to insert any strange or hidden characters while cutting and pasting or some such thing. In fact just to be clear, we will compile a test file "hello-world.tex" first.

Step Three: Compile test file into a .pdf.

As I mentioned Tex is super sensitive to every character it reads and will choke if things are out of order. In fact it is very sensitive even to non-special characters that are out of place. More so than some computer language compilers. I consider this it weakest aspect by far. It can be quite bewildering to a novice or expert alike.

Fortunately we can plan for this weakness. The best thing to do when adding or removing directives is to compile early and compile often. You are much more likely to track down an error after three changes than twenty. You may even want to adjust the above directives in a separate file with a simple message like "hello world" in the body. That way you can be sure it is not an unfortunate sequence of typos in your book body.

To compile your hello-world.tex simply type texi2pdf hello-world.tex. If all goes well a plethora of stuff will fly by your screen and you will have a .pdf file at the end. Open up the .pdf file. Does it look normal? Then it's time to try it with your mybook.tex.

Step Four: Add tested directives from test file to mybook.tex, normalize, and complile.

You probably already guessed how this works if you have gotten this far, but here is one way to do it. cat hello-world.tex > tmp.tex; cat mybook.tex >> tmp.tex; cat tmp.tex > mybook.tex Then all you need to do is remove the "hello world" and move the \end{document} to... well... the end.

Before trying to compile it you may want to consider if you have any strange symbols or dashes in your text, find the directive to indicate them and replace them. For example, remember percent sign means a comment. You may want to do a search and replace for % with \%. Also, strangely, dashes are reserved. so replace every instance of - with -- Look out for #$%&~_^\{}

So now run a texi2pdf mybook.tex and presto chango you should be able squeeze out a .pdf file. Unfortunately, the error messages are bizarre, so you may need to identify where a problem is coming from one chapter at a time (at least for a couple of runs.)

Impressed? If you are you will need to hold on to that enthusiasm. You have to go through every line of text containing a thought or emphasized and surround the effected text with a \thought{Why me!} and a \emph{Damn!}. Sorry, shortcuts here would be as effective as a poetry generator. This is one piece of tex that is making into my next book that was not in the first run of the rough draft. It's just easier to add as you go. On the bright side when you actually plan to italicize thoughts, it frees up your writing a bit.

Congratulations, you now a working .tex that is probably within an inch of whatever acceptable submission format, and looks pretty good in non-submission mode too. This is where I leave off and point you to the SFFMS manual. You have a working file, which is needed to overcome (ignore) LaTex's debug mode.

Hello! The How-To is over. Why are still here? Ohhh that other stuff in my .tex file.

So you want to know about graphics and .pdf bookmarks and the \nosubmit{%This text is non traditional}{Not the original sex scene.} OK here is a brief tour of the highlights.

\usepackage{graphicx} - This loads the the graphicx class.
\usepackage{float} - This is needed by graphicx.
pdfauthor={M. A. Newhall},
pdftitle={Thicker Than Blood},
pdfsubject={A Creative Commons, nanoterra, scifi thriller},
pdfkeywords={nanotech,scifi,copyright,patents,military,war,nanite,camera,hud,terrorist,United States,terror,president,USA,NSA,Allah,prescription,drugs,doctor,nda,supersoldier,hacking,hacker,robotics},
Everything above from \usepackage[pdftex to here is one big class load. pdftex likes to take arguments at initialization. You can create .pdf files without the pdflatex tools, but I needed this so I could make the book marks look nice.
\nosubmit{ %Begin nosubmit pre cover}{Lots of stuff} - The whole .tex file is chunked into \nosubmit or \submit. Some things are displayed or not, depending on the submission mode variable in \documentclass.
\pdfbookmark[0]{Cover}{Cover} - This sets a bookmark in a table on the left for .pdfs named "Cover".
\includegraphics[width=30 em]{TTB-Cover2.png} - This inserts a graphic into the document. In this case the cover. The "width" part tells it I want the graphic to be as wide as 30 lower case "m"s.
\newpage - I force a new page here since I didn't declare the cover a chapter for aesthetic reasons.
\pdfbookmark[0]{Title Page}{Title Page} - Another one of those bookmarks on the left.
\chapter*{} - This means start a new chapter. The star means don't give it a number, the blank space inside the quotes means don't give it a name.
} - The end of the first nosubmission block.
\submit{%Single space and add contact info to title page for submission mode}{ - only include this content in submission mode.
\begin{singlespace} - I wanted this part to be singlespace. Submission mode is double spaced by default to leave room on the paper for corrections.
\begin{center}\LARGE{\textbf{\href{http://www.thickerthanbloodthebook.com/}{Thicker Than Blood}}}\end{center} - The begin{center}, and end{center}, center the enclosed text, \LARGE{} Makes the enclosed text large, \textbf{} makes the enclosed text bold, and \href{}{} creates a hyperlink through the PDF library.

The rest of the document is more or less more of the same, so I stopped here. Later on there is a \chapter*{Chapter 0} because the automatic chapter numbering starts at one. This is moot in nonsubmission mode however as this was done when I was using the TOC option to generate the bookmarks, and now the pdf bookmarks are now used instead.

The end. aka: # # # # #

If you found the last section confusing, don't sweat it. It took me many months to get this format to where I wanted it, and there was much trial and error with each element/class/section/technique. It's here as a reference so you know how to find something that actually works with a little work. My goal was to create a document that could look it's best when following submission guidelines or not.

I hope this helped you to understand why word processors are inferior to publishing systems like latex. Taking the time to understand the basics of latex may seem senseless when you write four page papers, but when you are formating a whole book that is being revised often, your sanity may be on the line.

Happy writing, M. A. Newhall

Valid HTML 4.01 Strict
Valid CSS! [an error occurred while processing this directive]
Extras Research View Covers Links Downloads Contact Me