Using LaTeX for typesetting short story anthologies and novels

Nearly every year since 2009, the Writing Journey has had groups of people hard at work at writing, revising and self-publishing collections of short stories and poems. The anthologies have been one of my personal favorite Paths. They take us from idea to draft through critiques and editing (at least three rounds of that) to the joy of final publication.

Each year we have mostly relied upon Google docs for writing, editing and critiquing; and on Microsoft Word for the final publication. Unfortunately, MS Word is not the best tool for typesetting and can frequently produce sub-standard results. Getting things to look great (as Steve White did with Drops of Midnight (2012) and as Roger Lubeck did with The Day Before the End of the World (2012), Stories from Other Worlds (2014), and Voices from the Dark (2015)) takes a tremendous amount of work.

There is a better way: LaTeX. LaTeX is a typesetting system based on the harder-to-use TeX system. LaTeX was created by Leslie Lamport in 1985. It comprises a set of simple mark-up characterized by backslash commands that are interspersed throughout plain ASCII text. LaTeX is still widely used in academia in part because of its powerful ability to handle typesetting of mathematical and scientific equations. It arguably produces more beautiful results than competing solutions.

I confess that I tried LaTeX back in grad school, but it was a very brief fling. We had Interleaf that was, to my mind back then, far superior because of its WYSIWYG interface.

Recently, however, I decided to take another look at LaTeX. I’ve been writing my novels and short stories using vim, markdown and pandoc. ViM is a moded text editor, something that lets you do everything without your hands leaving the keyboard (no mouse required). Touch typists can be extremely efficient in writing with vim. Markdown is a minimal mark-up language that one can apply to ASCII text documents so they can be converted to other formats. pandoc is the tool that does the conversion. You can use pandoc to turn markdown marked-up text files into .docx or .html or into LaTeX.

It occurred to me that one could take the google docs that we use, download them as .docx files, use pandoc to convert them and then simply \input the converted LaTeX files into a LaTeX template, allowing us to produce nicely typeset PDF files with much greater ease and much less manual fiddling than had been required with Microsoft Word. I did some research and discovered that LaTeX is indeed very powerful and, once the template has been set up, it is relatively little work compared to the Microsoft Word workflow. Others have noted LaTeX’s superiority when it comes to aesthetics of the finished product.

Ryan Schuetzler notes: “The benefit of the separation of content and formatting is that changing the formatting can be done independent of the content of the document.” This especially comes to play when you are deciding to make fairly sweeping changes in presentation. E.g., how do you want the chapter titles to appear? With LaTeX, these can be set up with a macro. To make the change, just change the macro in one place and recompile the PDF. To do the same thing in Word would require not only changes to Word styles (which remains a dicey proposition–you are never sure whether you’ve changed every instance of a given style in a document) but might also require changes in layout in each individual chapter.

So the steps are:

  1. Download google docs (in .docx format)
  2. pandoc -f docx file.docx -t html -o file.html # Use pandoc to convert the .docx to .html
  3. pandoc -f html file.html -t markdown -o file.md # Use pandoc to convert .html to markdown
  4. pandoc -f markdown file.md -t latex -o file.tex # Use pandoc to convert markdown to LaTeX
  5. \input{file.tex} inside your template
  6. edit the template to add author, title, date and chapter (and chapter-author) names
  7. lualatex template.tex # You will need to run this twice the first time to generate the table of contents; it also generates the PDF file

I used lualatex, which is one of the distributions of LaTeX. Some websites recommended xetex. I used lualatex in ubuntu Linux, but it should also be possible to use it in Windows (perhaps as part of the MikTeX or TeX-live distributions).

Here’s the template (you can also see the resulting PDF). Yes, it may look scary, but there are only a small handful of lines that would need to be changed to link in your content. The rest are parameters that can be tweaked (e.g., what font you use).

Everything on a line after a % is ignored (comment).

% ============================================================================
% SIMPLE NOVEL TEMPLATE for LaTeX
% Also good for short story anthologies
% 6" x 9" book through CreateSpace or Lulu
% Built by NewMexicoKid 2017-08-05
% Based on the answer by https://tex.stackexchange.com/users/30640/user12711
% Ref: https://tex.stackexchange.com/questions/66902/latex-template-for-typesetting-a-novel
% ============================================================================
\documentclass[ebook,11pt,twoside,openright]{memoir}
\usepackage[paperwidth=6.125in,paperheight=9.25in,top=69.0pt,bottom=66.0pt,headsep=21pt,headheight=66.0pt,outer=36pt,inner=53pt,heightrounded=true]{geometry}
% Use this to debug: showframe

%------------------------------------------------------------------------------
% Widows and orphans
% \usepackage[defaultlines=4,all]{nowidow} % get rid of widow lines - but bottom becomes ragged
\emergencystretch 3em
\widowpenalty=4500
\clubpenalty=4500
\setlength{\parskip}{3ex plus 2ex minus 2ex}
%------------------------------------------------------------------------------

\usepackage{textcomp} % Not sure what this does
\usepackage{verse} % for poetry, but you need to end each line with \\
\usepackage{alltt} % for PRE-formatted poetry

%------------------------------------------------------------------------------
% FONTS:
\usepackage[no-math]{fontspec} % Lets one use system fonts (but with no math)

% Enabling drop caps
\begin{filecontents}{Zallman.sty}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Zallman}[2007/11/24 v1.0 Zallman CFR]

\input Zallman.fd

\DeclareRobustCommand{\Zallmanfamily}{%
\fontencoding{U}%
\fontseries{xl}%
\fontshape{n}%
\fontfamily{Zallman}%
\selectfont}
\DeclareTextFontCommand{\zall}{\Zallmanfamily}

\endinput
%% end Zallman.sty
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{lettrine,Zallman}
\renewcommand{\LettrineFontHook}{\Zallmanfamily}

%------------------------------------------------------------
% Enabling black out for blacking out/censoring text with the \blackout command
\newlength{\blackoutwidth}
\newcommand{\blackout}[1]
{%necessary comment
\settowidth{\blackoutwidth}{#1}%necessary comment
\rule[-0.3em]{\blackoutwidth}{1.125em}%necessary comment
}
%------------------------------------------------------------

\setmainfont{Cardo} % Cardo font; https://www.fontsquirrel.com/fonts/cardo
% --- Supports bolding
% \setmainfont{EBGaramond} % EBGaramond font; this is the free Garamond clone
% You can get EBGaramond from https://www.fontsquirrel.com/fonts/eb-garamond
% --- Bolding doesn't show up well
% \setmainfont{Rosarivo} % Rosarivo font; see https://www.fontsquirrel.com/fonts/rosarivo
% --- Didn't seem as complete
% \setmainfont{Crimson} % Crimson font; https://github.com/skosch/Crimson
% --- Supports bolding
%------------------------------------------------------------------------------

\let\footruleskip\undefined
\usepackage{fancyhdr} % fancy headers
\usepackage{microtype} % use this to improve typography
\usepackage{hyphenat}\hyphenation{my-word, hyphen-ate, never, hyphen}

%------------------------------------------------------------------------------
% bottom margin consistency
\usepackage{setspace}
\frenchspacing\flushbottom % fairly consistent bottom margin
\OnehalfSpacing % line spacing set to 1.5 instead of 1
%
% \usepackage{setspace}\onehalfspacing\frenchspacing\flushbottom
% \usepackage{setspace}\onehalfspacing\frenchspacing\raggedbottom
% https://tex.stackexchange.com/questions/65355/flushbottom-vs-raggedbottom
% \setstretch{1.15}
% \setlength{\dimen0}{\textheight}
% \addtolength{\dimen0}{-\topskip}
% \divide\dimen0\baselineskip
% \setlength{\textheight}{\number\dimen0 \baselineskip}
% \addtolength{\textheight}{\topskip}
%------------------------------------------------------------------------------

\usepackage[normalem]{ulem} % Needed for \sout (strikeout)
\usepackage{suffix} % Needed for different chapter headings
\usepackage[english]{babel}

%------------------------------------------------------------------------------
% Table of Contents
\usepackage{etoc}% only so far to enable multiple uses of "\tableofcontents"
% maybe the document class already allows it.

\usepackage[newparttoc]{titlesec}
% Originally \usepackage{titlesec}; not sure what newparttoc does
% remove chapter name and number: http://blog.chapagain.com.np/latex-remove-chapter-name-and-number/
\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{0pt}{\Huge}
\usepackage{titletoc} %

\titleformat{\part}[display]
{\Huge\scshape\filright\centering}
{}
{20pt}
{\thispagestyle{empty}}
\titlecontents{part}[0pt]{\addvspace{2pc}\centering\large\bfseries}{}{}{}%
%------------------------------------------------------------------------------

\usepackage{emptypage} % No headers on empty pages

\DeclareRobustCommand*\AUTHOR [1]{}
\newcommand\SHOWAUTHORS {%
\DeclareRobustCommand*\AUTHOR [1]{{\normalfont\small\itshape ##1}}}

%===================================================================================
% https://tex.stackexchange.com/questions/156862/displaying-author-for-each-chapter-in-book
% The following code not only displays chaptername and author in the TOC but also at the
% start of each chapter.
\makeatletter
\newcommand\newchapter[2] {\gdef\@chaptertitle{#1}\gdef\@chapterauthor{#2}\chapter[#1 / \AUTHOR{#2}]{#1}\printchapterauthor{#2}}
\newcommand\@chapterauthor{}
\newcommand\@chaptertitle{}
\fancypagestyle{mystyle}{%
\fancyhf{}%
\fancyhead[LE]{\thepage\quad\textsc{\@chaptertitle}}%
\fancyhead[RO]{\textsc{\@chapterauthor}\quad\thepage}%}
\renewcommand{\chaptermark}[1]{\markboth{##1}{}}%
}
\makeatother

\setcounter{secnumdepth}{0}
\renewcommand{\chaptername}{}
\renewcommand{\thechapter}{}

\makeatletter
\newcommand{\printchapterauthor}[1]{%
{\parindent0pt\vspace*{-25pt}%
\linespread{1.1}\large\scshape#1%
\par\nobreak\vspace*{35pt}}
\@afterheading%
}
\makeatother
%===================================================================================

% ---------------------------------------------
% Fancy headers with story name and author
% Refers back to mystyle defined above
% ---------------------------------------------
\pagestyle{mystyle} %fancy
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
% ---------------------------------------------
% bold, no-indent Inspiration with \medbreak
% ---------------------------------------------
\makeatletter
\newcommand{\inspire}[1]{
\medbreak
{\parindent0pt % no indentation for this section
\textbf{#1}
}
}
\makeatother
% -----------------------------------------------
% authorsc - small caps and bold the author name
% -----------------------------------------------
\makeatletter
\newcommand\authorsc[1]{\textbf{\textsc{#1}}}
\makeatother

% ========================================================================
% Needed for scene breaks with a "flowerleft" flourish
\usepackage{adforn}

% \Scene macro is used for scene breaks * * * * *
%%% \makeatletter
%%% \newcommand{\Scene}{%
%%% \par\nobreak\@afterheading
%%% \vspace{\topsep}
%%% \addvspace{\topsep\relax}
%%% \noindent\hfil%
%%% \adfflourishleftdouble\quad\adfflowerleft\quad\adfflourishrightdouble%
%%% \hfil\par%
%%% \vspace{\topsep}
%%% \@afterindentfalse\@afterheading%
%%% }
%%% \makeatother

\makeatletter
\newcommand{\Scene}{%
\par\nobreak\@afterheading
\bgroup
\begin{center}%
\addvspace{\topsep}
{{\adfflourishleftdouble\quad\adfflowerleft\quad\adfflourishrightdouble}}%
\end{center}
\egroup\@afterindentfalse\@afterheading}
\makeatother
% ========================================================================

% ---------------------------------------------------------------------------
% use begin{itpars} ... end{itpars} around blocks of text to be italicized
% https://tex.stackexchange.com/questions/258394/make-block-of-text-italicized
\newenvironment{itpars}
{\par\itshape}
{\par}
% ---------------------------------------------------------------------------
% --------------------------------------------------------------------------
% hyperlinks for the e-book and PDF
\usepackage{hyperref}
\usepackage{color}
\definecolor{Blue}{RGB}{4, 6, 145}
\hypersetup{colorlinks,linktocpage,linkcolor=Blue,urlcolor=Blue} % linktoc=all,
% --------------------------------------------------------------------------

% ===============================================================
% Provide the author, title and date for the title page
\author{A Bunch of Authors} \title{Our Little Short Story Anthology} \date{2017-08-15}
% ===============================================================

\usepackage{babel} % - for lorem ipsum
\usepackage{blindtext} % -- just for lorem ipsum

\begin{document}
\setlength{\parskip}{0pt}

\frontmatter % the front of the book has (lowercase) roman numerals
\SHOWAUTHORS
% \tableofcontents
% -------------------------------------
% Import the front matter pages
\input{Front_Matter.tex}\clearpage
% -------------------------------------

\mainmatter % the main part of the book will have standard pages
%
% ======================================================================
%
% Import the chapters; specify chapter title and author with \newchapter
\part{Book One}
\newchapter{Story One}{Author One}
% \input{Story_One}
\Blindtext\clearpage
\Blindtext\clearpage
\Blindtext\clearpage
\clearpage
\newchapter{Story Two}{Author Two}
% \input{Story_Two}
\Blindtext\clearpage
\Blindtext\clearpage
\Blindtext\clearpage
\clearpage
\part{Book Two}
\newchapter{Story Three}{Author One}
% \input{Story_One}
\Blindtext\clearpage
\Blindtext\clearpage
\Blindtext\clearpage
\clearpage
\newchapter{Story Four}{Author Three}
% \input{Story_Two}
\Blindtext\clearpage
\Blindtext\clearpage
\Blindtext\clearpage
\clearpage
% ======================================================================
\end{document}

 

\Blindtext is just to put some sample text in. Normally you would replace that with the \input{file} command.

 Here’s the code for the front matter

% \begin{figure}[htbp]
% \centering
% \includegraphics[width=3.2in]{title_image.png}
% \end{figure}

\thispagestyle{empty}
\vspace*{1.5in}
\begin{center}
\fontsize{50}{60}\selectfont ANTHOLOGY TITLE
\end{center}

\vspace{1.0in}

\begin{center}
\Huge Author Name
\end{center}

% \vspace{1.1in}
\vfill

\begin{center}
\emph{\large{06 August 2017}}
\end{center}

\clearpage

\vspace*{4.5cm}

\begin{center}
\Huge \textsc{Interior Book Title}
\end{center}

\vspace{2em}

{\parindent0pt % no indentation for this section
Written by Author Name

\vspace{2em}

Copyright \textcopyright 2017 by Author Name

All rights reserved. Printed in the United States of America. No part of
this book may be used or reproduced in any manner whatsoever without
written permission except in the case of brief quotations embodied in
critical articles and reviews.

\vspace{2em}

ISBN XXX TO BE FILLED IN

% \vspace{2em}
\vfill
Cover Design by A Book Cover Designer
} %end no indent

\clearpage

\emph{This page constitutes a continuation of the copyright page.}

\begin{center}

\emph{Story One} copyright \textcopyright 2017 by Author Name

\emph{Story Two} copyright \textcopyright 2017 by Other Author

\end{center}

\clearpage

\tableofcontents*

\clearpage

\section{Acknowledgements}\label{acknowledgements}

The Editors of this anthology would like to thank folks.

\section{Introduction}\label{introduction}

\Blindtext
\Blindtext

% -------------------------------------

 

Tim is a founding member of the Journey, co-Municipal Liaison for the Naperville region of National Novel Writing Month, and the author of several short stories.

Facebook Twitter 

Leave a Reply to Fidel H Viegas Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 comments

  1. Haroun Bounthi says:

    Hi Tim,
    This is really helpful. Thank you for working on this and sharing!

    I ran into an error with the hyphenation command. The error said there is something in the \hyphenation{ } part that is not supposed to be there. I’m not an expert in LaTeX, but I’m wondering what the material inside the \hyphenation{ } is supposed to do.

    Thanks,
    Haroun

  2. Hi, Tim!

    Thanks for sharing your experience with LaTeX. I have been using it on and off since the late 90s, early 2000s, but never actually got that deep.

    I was wondering why you convert from .docx to .html and then from .html to .md. Why not go straight from .docx to .md? Any particular reason?

    • adminnmk says:

      This is a good question. I went from docx to html first with one of the anthologies because I wanted to make some html edits before the markdown conversion. Your mileage may vary (I’ve kept the same workflow but haven’t really needed the intermediate step; one of these years, I should try the direct conversion from docx to markdown).