LaTex commands

LaTex commands.

Introduction

I started my 2,5 months summer holiday a couple of weeks ago (I love to work and live in Finland). This holiday I decided to make my about 30 years dream come true: to write a science fiction novel.

I have never written a novel. But who cares. I read Stephen King’s excellent short book: On Writing: A Memoir of the Craft. Stephen King said to me that I could write a scifi book. Come on! If one of the greatest names of contemporary horror and fantasy writers says to me that I can do it - I should not wait one summer more.

I’ll write another blog post about the actual writing later. But in this blog post, let’s focus on some technicalities: what tools should you use when writing a novel?

Raw Text or Not?

I guess most writers nowadays just use Microsoft Word or possibly an OSS version like LibreOffice Writer. I’m pretty sure these are good tools. But I, as a software craftsman, want to use a version control system to store my writing, of course. I.e., nowadays, Git.

One of the pros of using Word or LibreOffice is that the editor is pretty much WYSIWYG and really easy to use. You can do basic layout visually, write your novel and then dump a PDF export easily.

The major con of Word and LibreOffice is that they use horrific file formats. The file format is not raw text.

I’m a programmer. The source code I write is raw text. You can store raw text in a version control system very easily and see the complete version history of your source code. Or your novel, like in our case in this blog post.

Therefore, my first decision was to write the novel using raw text.

Editor and Mode

I was considering my options. Do I write ,e.g., a markdown file and convert the file to PDF? Quite soon, I decided I would use Emacs as my editor. Emacs is my life-long friend, and though I’m not an Emacs guru, I’m pretty fluent in using Emacs. And Emacs is a programmable editor (elisp).

With Emacs, I had once tried Org Mode for writing technical documentation for a software project. I really liked org mode; how powerful it was compared to markdown.

Layout, Fonts, and Stuff Like That

Ok. How about the layout? The book needs to have a cover, a back cover, a table of contents, possibly various fonts to emphasize specific texts in the novel, footnotes, numbering, etc.

I knew already that I was going to use Tex and LaTex. Tex is a typesetting system - you can create precise scientific articles with mathematical formulas using Tex. LaTex is a software system for document preparation, built on top of Tex. With Tex/LaTex, you write your novel, but inside the text, you give various LaTex commands for layout, fonts, etc. Example:

...
\newpage

\bigskip
\noindent
*COVERING NOTE*

\begin{sloppypar}

\medskip
\noindent
This book has been self-published in electronic format using PDF.

\bigskip
\noindent
You can find the latest version of the book in:

\medskip
\noindent
\begin{footnotesize}
...

PDF output

PDF output.

There are tons of various LaTex packages to make your life easy when creating the visual layout for your novel.

What?

What? I want to focus on writing a novel and not some computer commands. Yep. I understand that for a non-IT-professional, it is better just to use Word. Use it. Be happy. But for a software professional, combining raw text with LaTex commands and having a complete version history of your text and layout commands in your Git repository is just superb. I would not do it in any other way.

I have now, in two weeks, figured out all the major stuff like the basic layout, fonts, table of contents, front cover, back cover, etc. Now I just write the story. It is straightforward to have a template for a chapter: start the new chapter with these LaTex commands and then just write your stuff. Soon you do not see the LaTex commands - you just write the story.

Conclusions

Tex/LaTex is excellent not just for writing scientific articles, but also for writing scifi novels!

Later on, when I have written a bit more my first scifi novel, I will write a blog post about writing scifi! Stay tuned!

The writer is working at Metosin using Clojure in cloud projects. In his free time, he writes scifi novels (well, at least nowadays).

Kari Marttila

Kari Marttila’s Home Page in LinkedIn: https://www.linkedin.com/in/karimarttila/