Categories

## Bibliography and Citations in LaTeX

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Science is a collaborative enterprise spanning the generations. When it allows us to see the far side of some new horizon, we remember those who prepared the way.

Carl Sagan, Cosmos: Blues for a Red Planet

Books build upon other books, just like scientific experiments build on other scientific experiments. Be it out of scientific accuracy, as a service to the interested reader, or out of gratitude, you should include references to your sources. Personally, I love to know the source of an author’s ideas.

In Word, there is no built-in way of managing a bibliography (other than manually writing each entry and referencing it in the text). You can check out plugins like Zotero (https://www.zotero.org).

Zotero ⋅  Zotero is a plugin for Word (see https://www.zotero.org) which integrates into Word and your browser so you can fetch bibliographical information from the web and import it via a menu in Word.

In LaTeX, the support for a bibliography is inbuilt. All entries are saved in the file bibliography/english.bib. The file is structured as a list of entries of the format TYPE{id, title={ title }, author={ author }, year={year of release}, …}. While LaTeX allows special characters like colons to be used in the id field, I recommend using only lowercase characters and numbers. Besides the title and release year, an entry can have a number of different parameters depending on its type. The main types are:

• @BOOK If the entry references a book, use this type. Additional entries are isbn, and publisher.
• @ARTICLE Articles published in scientific journals have this type. Additional entries are journalpages, and publisher.
• @MISC Any other source (for example, websites or movies) falls under this category. Additional entries are url, and note. If you are referencing a website, add a note that contains something like “note = { [online; last accessed March 3rd, 2018] }” as the website’s contents might change. Ideally, keep a local copy of the website for yourself in case it vanishes. Please note that for the url field, include “http://” or “https://” at the front to make it a valid field.

Please note that Amazon prohibits the use of Amazon affiliate links within e-books.

The template is already set up to load the entries of bibliography/english.bib. With the following commands, you have access to all bibliographical entries within this file:

• \citetitle{id} This command prints out the title specified in the corresponding entry in the bibliography. For example, \citetitle{BBWLtAW} writes the title of this book in italics: Better Books with LaTeX the Agile Way. In addition, it adds the title to the index of the book.
• \cite{id} This command prints out the reference to the media and creates a link to the bibliography in the back matter.
• \citep{id} This command is the same as above but puts parentheses around the reference.
• \footcite{id} This command is the same as above but puts the citation into a footnote.

Concerning the citation itself, many different formats include a combination of year, title, and author. If you want to use a different format, check out the documentation at https://ctan.org/pkg/bibtex and make the corresponding changes in lib/bibliography.tex.

## Bibliographical Information

To fill the bibliography with media you cite from, the most straightforward approach is to go to Amazon, search for the book or movie title, and copy the information (author, publisher, ISBN, etc.) manually into a new entry. If you are citing scientific articles, look for a button on a website that says something about exporting or downloading a citation in BibTeX. This way, you can download an already filled-out bibliographical entry and copy and paste it into your bibliography/english.bib library.

As an example, the BibTex entry for this book is:


@BOOK{ BBWLtAW,     author = { Lode, Clemens },     title = { Better Books with LaTeX the Agile Way},     keywords = { },     isbn = { 978-3-945586-48-8  },     publisher = { Clemens Lode Verlag e.K. },     year = { 2019 },     type = { Book },     subjects = { Publishing; Marketing; Project Management } }



This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## LaTeX Basics

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

## Basic Formatting

• Comments. If you want to just add a comment to a file without it being printed, add a % (percentage) sign in front of it. In Overleaf, the text in the affected line will be displayed in a different color. In the template files, you will find several such comments as well as deactivated commands (for example, in lib/bookformat.tex the different options for the book size).
• Bold formatting. You can make your text bold by either selecting it and pressing CTRL + b (in Overleaf), or by surrounding it with the command \textbf{Your Text}.
• Italics formatting. You can italicize your text by either selecting it and pressing CTRL + i (in Overleaf), or by surrounding it with the command \textit{Your Text}.
• Small caps. You can change your text into small capitals by surrounding it with the command \textsc{Your Text}.
• Em dashes. Em dashes are used to connect two related sentences and can also be used instead of parentheses or commas. There is no space before or after the em dash. Within the template, use the command \emdash{} instead of using the dash you copied over from your text file—this will also take care of issues relating to line breaks.
• Paragraphs. Paragraphs are handled automatically by leaving an empty line between each paragraph. Adding more than one empty line will not change anything—remember Overleaf is not a “what you see is what you get” editor.
• Empty line. If you want to force an empty line (recommended only in exceptional cases), you can use ˜\\ (tilde followed by two backslashes). Possible applications are in the front matter; for example, in this book, I have used it for the title and half-title page, as well as the publisher page, and the preface and foreword (for the signature at the bottom).
• New page. Pages are handled automatically by LaTeX. It tries to be smart in terms of positioning paragraphs and pictures. Sometimes, (ideally, at the very end when polishing the final text), it is necessary to add a page break. For that, simply add a \newpage. If you want to insert a page break in your e-book version, too (for example, after chapters or special pages like the title or publisher page), use \nextpage instead.
• Quotation marks. In the standard computer character set, there are several types of quotation marks. It is required to change all quotation marks into  (two back ticks at the beginning and two single ticks at the end). Refrain from using ”…” (or “…”) to prevent issues with the LaTeX compilation.
• Horizontal line. For a horizontal line, simply use \hrule:_____________________________________________
• Underlined text. It is generally not recommended to use underlined text in books.
• URLs. For URLs, you need a special monospaced font. Also, for URLs in e-books, you want to make them clickable. Both can be accomplished by putting the URL in the \url environment, for example, \url{https://www.lode.de}https://www.lode.de
• Special characters. If you need special characters or mathematical formulas, there is a whole body of work on that subject. Check out tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf for a comprehensive list.

## Lists

Itemized list. To create a bullet point list (like the list in this section), use the following construct:


\begin{itemize}   \item Your first item.   \item Your second item.   \item Your third item. \end{itemize}



The result will look like this:

Numbered list. To create a numbered list, replace itemize with enumerate:


\begin{enumerate}   \item Your first item.   \item Your second item.   \item Your third item. \end{enumerate}



## Verbatim Text

Sometimes, you may want to simply use text in a verbatim way (including special characters and LaTeX commands). For this, simply use the lstlisting environment: \begin{lstlisting} …\end{lstlisting}. For example, I put the itemize and enumerate listings above into a lstlisting block. If I did not, LaTeX would have displayed the list as a list, instead of displaying the code.

## Chapters and Sections

LaTeX uses a hierarchy of chapters, sections, and subsections. There are also sub-subsections, but for the sake of the reader, it is best to not go that deep. If you come across a situation where it looks like you need it anyway, I recommend thinking over the structure of your book rather than using sub-subsections.

In terms of their use in the code, they are all similar:

• \chapter{Title}\label{c1_chaptername:cha}
• \section{Title}\label{c1_sectionname:sec}
• \subsection{Title}\label{c1_subsectionname:sec}

When using these commands, obviously replace the title, but also the label. For the label, I recommend beginning the label with c, followed with the current chapter number, an underscore, and the chapter, section, or subsection in one word and lowercase, followed by either “:cha” or “:sec” to specify what kind of label it is. These labels can then be used for references which will show the correct chapter and section number even after making changes. For example, if you have defined a section \section{Chapters and Sections}\label{c14_chaptersandsections:sec}, you could write We will discuss chapters and sections in Section \ref{c14_chaptersandsections:sec} which results in the document as “We will discuss chapters and sections in Section 14.4.”

## Tables

In LaTeX, tables are like images and put into the figure environment (\begin{figure}…\end{figure}). As such, they have a caption, label, and positioning. Drawing a table like Table 11.3 requires a bit of coding:


\begin{figure}[H]\centering \ifxetex \resizebox{\textwidth}{!}{% \begin{tabular}{p{3cm}|p{6cm}|p{6.5cm}} \else {\begin{tabular}{c|c|c} \fi \hline &\textbf{Word}&\textbf{LaTeX}\\\hline Editor&‘‘what you see is what you get’’&source file is compiled\\\hline Compatibility&dependent on editor&independent of editor\\\hline Graphics&simple inbuilt editor, mouse-based&powerful but complex editor, text-based\\\hline Typography&optimized for speed&optimized for quality\\\hline Style&inbuilt style&separate style document\\\hline Multi-platform&only via export&possible with scripting\\\hline Refresh&some elements need manual refresh&everything is refreshed with each compile\\\hline Formulas&basic support needs external tools&complete support\\\hline  \end{tabular}} \caption{Comparison of Word and LaTeX} \label{c1_comparisonwordlatex:fig} \end{figure}



This table has the familiar figure, label, caption, and centering commands. The actual table is configured with the tabular environment. Following the tabular command, you configure the columns in curly braces. Each column is separated with a vertical line and the p{…} entry specifies the width of the column. With {p{3cm}|p{6cm}|p{6.5cm}}, you would have three columns with 3cm width for the first column and 6cm and 6.5cm width for the two others. Alternatively, you can use c instead of p{…} and leave out the curly braces with the width. Then, LaTeX simply calculates the required widths automatically (this is the preferred method for an e-book).

Then, for each line of the table, simply write content of the first cell&content of the second cell&content of the third cell\\\hline. Please be sure to use \hline in tabular environments, and \hrule outside of them.

## E-Book / PDF Specific Content

To activate content only for either HTML output (e-book) or for PDF output (print), simply surround the code with a \ifxetex{} …\else{}…\fi{} construction. Having this compatibility allows you to generate PDF files with XeLaTeX, and also produce HTML documents with pdfLaTeX when you switch compiler settings.

For example, when generating an HTML file, you cannot include PDF files or vector graphics. Instead, you have to rely on JPG and PNG image files. Another application would be if you want to minimize the size of an existing image file for an e-book. A code might look like this:


\begin{figure}[H]\centering \ifxetex \adjustbox{max width=.95\columnwidth, max height=.4\textheight}{ \input{images/philosophy-hierarchy.tex} } \else \includegraphics{images/philosophy-hierarchy.png} \fi \label{c1_ontology-epistemology:fig} \end{figure}



This includes a vector graphic (images/philosophy-hierarchy.tex for the PDF output, and a PNG image file for the HTML output.

Yet another example is using different texts for the PDF (designed for print) and the HTML output (designed for an e-book release). The conditional clause allows you to show medium-specific text, dates, or formatting:


\ifxetex{} 2016, First Edition \textsc{ISBN} 978-3-945586-21-1 Printed on acid\hyp{}free, unbleached paper. \else{} E-book created \today \textit{PS: If you want to rate this book, please always add a short text comment. Did you like it? What can be improved? Who would you recommend it to? Without a text comment, your star rating will not be counted on the Amazon website!} \fi{}



This shows the edition number, ISBN, and paper quality for the PDF output, and the creation date and a note about how to rate the book for the HTML output.

A further example is footnotes. As e-books do not have pages in the traditional sense, your footnotes would end up in the appendix of the book at the end. Given that we do not want the reader to jump back and forth, one approach is to simply include the footnote in parentheses if the output is not set to XeLaTeX (print):


A popular assumption is that the same words convey the same meanings. This is generally only correct if both conversation partners belong to a common \textit{language network}, i.e., that they define their terms either among themselves or through close acquaintance\ifxetex{}.\footnote{Interesting\else{} (interesting\fi{} to note here is the theory that every person in the world is connected to every other person by approximately seven intermediate connections\ifxetex{} \citep[cf.][]{Travers69anexperimental}.}\else, \cite[cf.][]{Travers69anexperimental}).\fi{}



This shows “Interesting to note here is the theory that every person in the world is connected to every other person by approximately seven intermediate connections [cf. Travers and Milgram1969].” as a footnote for the PDF output, and “[…] close acquaintance (interesting to note here is the theory that every person in the world is connected to every other person by approximately seven intermediate connections, [cf. Travers and Milgram1969]).” for the HTML output.

The last example is handling references. In a printed book, you can add a quotation page at the end to list the sources of individual quotes. This is possible because you can quickly jump to the end of the book and back using a page number, while in an e-book, you have no fixed page numbers and have to rely on links:


\ifxetex{}\label{epicurus-philosophy-quote}\else{}\citep[p.~53]{epicurus}\fi{}



## Footnotes

Finally, for footnotes, there is the command \footnote. You can place it anywhere you like; LaTeX will then automatically add the number of the footnote at that place and put the footnote text into the footer area. For e-books, it is recommended to just use regular parentheses. This can be accomplished with the \ifxetex{} command. In the generated book, it looks like this (this is a footnote).


\ifxetex{}     .\footnote{This is a footnote.} \else{}     (this is a footnote). \fi{}



## Images

As in Word, in LaTeX, images are separate from the text. Images are usually packaged together with a caption and a label to reference the image from the text. These three entities are packaged together into a figure. The figure itself configures the size of the image as well as where it should be put. Let us look at a code sample:


\begin{figure}[H]   \centering   \ifxetex{}     \adjustbox{max width=.95\columnwidth, max height=.4\textheight}{       \includegraphics{images/ebookLatex_Cover.png}     }   \else{}     \includegraphics{images/ebookLatex_Cover.jpg}   \fi{}   \caption{The cover of this book.}   \label{c1_cover1:fig} \end{figure}


• At the core is the image, included with \includegraphics{filename}. It inserts the image specified by the “filename.”
• In the example, there are two versions of \includegraphics, one for the print output (\ifxetex{}), one for the e-book. This way, we include either the larger, lossless PNG version or a smaller, lossy JPG version of the cover.
• For the e-book, we do not need to provide any image size as the first output will be an HTML file with no boundaries.
• For the print edition, we have a clear boundary, namely the page width.
• With the \adjustbox command, we can adjust the image size according to the page width (\columnwidth) and page height (\textheight).
• In this case, in order to align with the caption and be able to show two images on one page, we want an image to be generally at most 95% of the page width and 40% of the page height.
• Below this \ifxetex{}…\else{}…\fi{} construct, there is the caption with its label.
• LaTeX automatically numbers each figure, so in the text, we can later refer to it with \ref{c1_cover1:fig}, which prints out the number of the figure.
• Finally, all these commands are centered with the \centering command and surrounded with the figure environment.
• The [H] instructs LaTeX to try to place the image exactly where it is in the LaTeX code.

## TikZ Graphics

For graphics, you can also include other TeX files that contain graphics or commands that use the inbuilt TikZ graphics generator. Due to its flexibility, I even recommend using TikZ to replace any of your existing diagrams that are PNG or JPG images, because:

• TikZ graphics can very easily be changed (for example, in translations or for making corrections).
• TikZ graphics are small and flexible. They can be easily scaled to any size and are directly integrated into your project (no time-consuming editing in an external graphics program necessary).
• TikZ graphics look better. As vector graphics, they are sent directly to the printer, so we need not worry about readability.

If you want to create a TikZ graphic, simply create a new LaTeX file in the tex-images folder and include it with \input (replacing \includegraphics) where you want to. Then, do a Recompile to regenerate the TikZ file. If this does not work for some reason, you can also force their re-creation by deleting the tikz-cache directory and then recreating it by clicking on the second icon at the top left (New Folder). This removes the generated cached image files that do not show up in Overleaf itself.

For the format of the file itself, it is a series of TikZ commands surrounded by the \begin{tikzpicture}…\end{tikzpicture} environment. Discussing all the commands is beyond the scope of this book, so I recommend three options:

• Check out the PGF manual at https://www.ctan.org/pkg/pgf. It has more than 1,100 pages of documentation of each command and corresponding examples.
• Check out the example TikZ pictures from my two books Philosophy for Heroes: Knowledge and Philosophy for Heroes: Continuum in the tex-images directory of the template.
• Send us descriptions/drafts of the graphics you need. We can help you to create any graphic at affordable rates. Contact us at [email protected]

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## Filling the Template

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

A simple way of writing books in LaTeX is using Overleaf and our template. In previous articles, we have walked through the whole “build chain” of creating documents. In this article, we go through each file of the template and give you a “to do” list of items you can work on one by one—from the title to the appendix.

One way to understand the structure of a book is to imagine how books were created before the digital age. Imagine different groups of people working on the book and handing over the results to the next group. At the beginning of this process, there is the core material that makes up most of the book: the individual chapters and sections. Those are surrounded by the front and back matter, which consist of several layers. The author hands the text of the chapters over to the editor, together with a note introducing his or her work (the preface). The editor adds the table of contents, the indexbibliographyquotation sources, and maybe an appendix (containing summaries from throughout the book), and hands the book over to the publisher.

The publisher adds information to the book, too. That is, first the publisher page itself with the year of publication, ISBN number, copyright note, and publisher name, and then a description of how the book was created and, for example, how the reader can contact the publisher with any questions (the foreword). All the parts are then put into an envelope (consisting of the series title and half title), and handed over to the cover designer. The cover designer creates the cover, and packages it together with the book into another envelope (consisting of the title page including the cover picture) and hands it to the printer.

With the overall structure in mind, let us look at each of the elements one by one, starting with the project title. After having opened the template project, on the left side in the project file overview, you can find the file output.tex. This is the entry point of the template (hence it is displayed in bold). If you ever want to change the output language to another language, you can adapt the file accordingly by changing the parameter of the babel package. For example, replacing american with ngerman activates the babelDE script, as well as some language-related formatting and sorting. In addition, you could add language-specific hyphenation rules here. For now, let us continue with the English setting.

## Front Matter

In the left project window, click on the front folder. You will see a list of several files open. Here, select title.tex. This will be the first page of the document. Then, start editing the file and do the following tasks:

• Replace “The Title” with your book title.
• Replace “The Subtitle” with your book subtitle
• Replace “Publishing Company, Location” with your publishing company’s name and location.

About the last point, if you do not own a company, put in your own name and address. Note that from a legal standpoint, this depends on the country in which you are publishing the book. Writing all the information down puts you on the safe side; if you want privacy, you have to check what is required by law (and perhaps consider a P.O. box).

We also need two cover versions, one for the e-book (low resolution) and one for print (high resolution). The reason is that (at least on platforms like Amazon) your profits for each e-book shrink depending on the file size. In 2019, this download charge was around $.15 per MB, so a 10 MB e-book would reduce your profit by nearly$1.50. For print, file size can be ignored and thus the image quality can and should be as high as possible.

Rename both versions of your cover (PNG and JPG) cover_highres.png and cover.jpg and upload them into the images folder. Alternatively, just upload your cover files and replace the entries in the title.tex file.

If you do not have a cover file, skip this step. We discuss cover creation in another article and the book.

To upload a file, click on images in the left project window, click on the arrow, and select Upload File. If the file already exists, it gets overwritten. The most straightforward approach is to rename your cover file to fit the existing template; otherwise you have to change the corresponding entry in the title.tex file.

Next, open front/half-title.tex. In the print edition, this comes after the title on page 3 of the book. Complete the following tasks:

• Replace “The Title” with your book title.
• Replace “The Subtitle” with your book subtitle.

If your book is part of a series, add a page showing the title of the series and listing all the parts (see front/series-title.tex). We will ignore that for now and assume it is a standalone book.

Next, open front/publisher.tex. This page is usually reserved for information about the book as a product. You should enter here when it was produced, by whom, and how someone can reach you. If you just fill in the following information, your work in this file is done:

• Replace “Edition” with the edition number (e.g., First Edition).
• Replace “ISBN” with your ISBN.
• Again replace “Your website’s URL” with your website’s URL (using https://).

Next is the dedication page (see front/dedication.tex). Here, you can thank people who helped you create the book. This page stresses that books do not stand alone, but build on other people’s work. When writing it, think of it as a letter you would send out to those people. Some people just write, “To my husband/wife/parents.” If you see it as but a chore and want to express your gratitude to those people in person rather than in writing, you can safely leave out the dedication page. In another article or the book, we learn how to rearrange, add, or remove whole pages or sections.

Another optional page is the epigraph page (see front/epigraph.tex). This page sets the theme for the book. This can be a quote, a picture, or anything you think could fit here. Here you can be creative and put some emotion into your book, even if it might be a dry book about LaTeX and project management. In my book Philosophy for Heroes: Knowledge , I have used the epigraph to introduce the reader to the summary boxes—insights into philosophy and linguistics—that I have put at the end of every section. They tell a meta-story. They are the icing on the cake. For your epigraph, consider whether you want to add a particular plot or theme to your non-fiction book. The epigraph page is the perfect place to introduce this concept.

Next comes the foreword (see front/foreword.tex). This is written by the publisher, or by you, with your self-publisher hat on. It should focus less on the content of the book but rather on the book production process itself. Encourage the reader to give you feedback and advise how he or she can contact you with an issue with the book, such as an error. Alternatively, the foreword can be written by an expert in the field, as a type of endorsement.

After the foreword, it is now up to you, the author, to introduce the book in the preface (see front/preface.tex). This can include how you arrived at the decision to write it, a personal note to the readers, and an “elevator pitch,” a short introduction telling the reader why this book is an essential read. Try to be personal and try to stay away from sales talk or corporate speech. Add a quote by your favorite author as a finishing touch.

This concludes the front matter of the book.

## Main Matter

In the folder list in the project view on the left, you will see a folder named main. This is the place for the main content, with a separate file for each chapter. Inside the main folder, you will find firstchapter.texsecondchapter.tex, and thirdchapter.tex. Those are just example files which you can simply delete or rename after you have added your own text.

• If you are starting your book from scratch, simply open main/firstchapter.tex, remove the default template text below \end{chapterpage} and start writing.
• If you already have your whole book (or portions of it) ready in one big Word (or text) file, you need to separate the text by chapter and put each chapter into a separate file.
• If you have already separated your book into individual chapters, each in its own file, proceed as outlined below.

For each chapter, create a new file in the main directory in Overleaf. Instead of calling them firstchaptersecondchapter, etc., it is best to give them the chapter number plus the actual name of your chapter (for example, I named the file of this chapter main/13-filling-template.tex). This way, you can more easily refer to or rearrange them later.

Once you have identified all chapters and created the files, you need to copy the text into each chapter file. For this, simply select the text of your chapter (including the title), and copy and paste it into the corresponding .tex file. There is a chance that the project will no longer (or only partially) compile after inserting your text. This can happen if your text already contains what Overleaf interprets as LaTeX commands. The most frequent issues are:

• Percentage signs % They are interpreted as comments by LaTeX and are thus ignored. Replace them with “\%”
• Curly braces { } They are interpreted as special commands by LaTeX. Replace them with “\{” or “\}”
• Dollar signs $They are interpreted as starting or ending a mathematical formula. Replace them with “\${}”
• Underscores _ They are used in mathematical formulas. Replace them with “\_”

Please note that there is no simple way of copying the formatting (bold, italic, font size, lists, indentation, etc.) from Word to LaTeX. If you already have your text formatted in Word, check out Chapter 14 for how to format the text manually. For any future books, I recommended that you write them directly in Overleaf from scratch and use the LaTeX formatting as you write.

## Chapter Organization

Next, take a look into main/firstchapter.tex again. Here, you see additional formatting at the top that defines the chapter title page. For each of your chapter files, copy and paste the following code to the top of your file:


\begin{chapterpage}{Replace with First Chapter Name}{c1_firstchapter:cha}  \begin{myquotation} The perfect place for an introducing quotation.\par\vspace*{15mm} \mbox{}\hfill \emdash{}Famous Person\index{Person, Famous} , \citetitle{bibitem}\index{@\citetitle{bibitem}} \ifxetex\label{famousperson-bibitem-quote}\else\citep[p.~123]{bibitem}\fi \par\end{myquotation}  \end{chapterpage}



Then, you need to:

• Replace “Replace with First Chapter Name” with your chapter title.
• Replace “c1_firstchapter:cha” with your chapter title label (no spaces, only lower case letters).
• Replace the quotation text, add the person’s name, and (if you have it) the bibliography item. If you do not have the source, remove the following line:

\citetitle{bibitem}\index{@\citetitle{bibitem}} \ifxetex\label{famousperson2-bibitem-quote}\else\citep[p.~123]{bibitem}\fi

There are several approaches for how to organize the individual chapters and sections of your book. Personally, I prefer to divide my content into small (ideally independent) slices, with each slice providing the reader with some benefit (as discussed in Part I of the book).

## Back Matter

The back matter of a book typically consists of two elements: references and connecting with the author:

• By “references” I mean the glossaryquestions to reflect on about the book’s contents, a summary of the main points of the book, the index, a list of image and quotation sources, and the bibliography. Whether or not you want to include the glossary, the questions, and the summary of ideas depends on the book you are writing. The index is created automatically, but it will need some work within the text of the main matter of the book, which we also discuss in another article and the book. The same applies to the bibliography.
• By “connecting with the author” I mean the “About the Author” section, information about your (or your publisher’s) other books, an optional section about how the book was created, and a polite reminder to your readers to leave a written review online. If you want to give the book a finishing touch, end with a short quote on the last page.

Let us go through the files of the template one by one. Open the back/author.tex file and:

• Upload a high-resolution (author_highres.png) and a low-resolution picture (author.jpg) of the author into images folder.
• Replace the quotation text.
• Add a short text describing your motivation, your professional background, what you are currently doing, and how to contact you.

If you have other books published, the back/advertisement.tex is the place you can list them. In the template, replace “YOUR NAME” in the chapter title, replace or remove the pictures of the book covers, and replace or remove the descriptions of the individual book entries.

Next, you are free to use the text in back/amazon.tex if you like or adapt it to your own needs, depending on where you publish the book. This is a reminder for the reader to provide you (and potential future readers) feedback.

Beyond the cited works and your other books, you can also direct the reader to additional book recommendations to delve deeper into the subject. For this, use the command \nocite in the back/recommended.tex file and list the recommended books by their book id from your bibliography file.

If you want to tell a story about how you created your book (if you have not already done so in the preface), you can do so in the back/thebooksstory.tex. Use this chapter to summarize what you have learned while writing the book. This helps you to write better books in the future and might be interesting for the reader as well. Myself, I like to talk about what is going on in the background of what I do. It is up to you. The existing default text in the template describes to a reader how the book was created using the template and this book as a guide. Feel free to skip this one—we cover how to reorganize or remove individual sections in another article or check out the book for more details.

Finally, replace the quote in back/last.tex to leave the reader with something to think about.

That is it! Your book is finished and we can now move on to polishing.

Chances are that through the copying and writing process, a few issues have come up. That is normal! Remember, LaTeX takes a little bit of time to learn. But once you know it, it flows naturally like normal writing—like a normal language. All it takes is patience. If you hit a wall, you can always create a new copy of the template and progress in smaller steps. Even better, use the backup and restore feature (top menu entry, History, see the book for details).

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

So… how do we use LaTeX? What do we need to install, set up, etc.? And just how do we use LaTeX to create an e-book? For now, we will focus on getting you started generating a PDF and e-book. In another article and the book, we go step by step through the process of copying your book from your text source (e.g., Word) to the template.

## LaTeX Support

While we have tested the template that comes with this book several times, you will likely encounter an issue not discussed here. Creating a document in LaTeX is more complex than doing so in Word, but even in Word there are issues you might run into where the solution is not immediately apparent.

For general LaTeX questions, you can also check out the community at https://tex.stackexchange.com. If you post a brief (but working) example with LaTeX code with which you are having a problem, the community can usually provide high-quality advice.

Before we start, yes, setting up LaTeX the first time is more complicated than writing a letter in Word. But there are many solutions available that allow you to use LaTeX without much hassle. One of those solutions is Overleaf, which I am using for writing this very book (and all my other books). Overleaf is an online editor and project manager for LaTeX documents. It is available free for projects that do not require password protection. If you want to keep your LaTeX code private, I recommend the Pro upgrade which also adds full project history, access management, support for larger projects, and priority support.

Overleaf ⋅  Overleaf is an online editor and project manager for LaTeX documents. It manages your project with a versioning system and automatically compiles your LaTeX code into PDF and (with some help) HTML. It is free for public projects and does not require an installation or setup. You can get an account here: https://www.overleaf.com.

## Copy the Template

If you do not want to use the template, check out the appendix 24 for instructions to add TeX4ht to your existing project.

Once you have your account, copy the template either by visiting https://tinyurl.com/ltxtemplate or by going to https://www.overleaf.com/latex/templates, searching for Book Template for Amazon KDP, Google Play, and Leanpub, and opening Book Template for Amazon KDP, Google Play, and Leanpub (e-book and PDF) and pressing Open as Template.

Once copied, any changes to the template will be applied to your own copy. It is accessible via your Overleaf project view (go to https://www.overleaf.com and click on Projects or go directly to https://www.overleaf.com/project); your new project should be listed there.

The template itself needs to be adapted of course—after all, it is your book, not mine. But for now, let us focus first on how to get from the template to a book.

So, navigate to your project view (https://www.overleaf.comProjects) and click on the new project Book Template for Amazon KDP, Google Play, and Leanpub. In the opened window, you should see a menu bar at the top with the Menu button that opens the options for the project. On the right, you will see a preview of the PDF output. Remember what I mentioned at the beginning of the book: LaTeX is not a “what you see is what you get” editor. Instead, whatever you write first has to be compiled into a PDF. Hence, you have the actual editing window in the middle (horizontally), and the separate output window on the right side of the screen.

## Create a PDF

The template is set up to produce both HTML files and PDF files. The HTML files can later be converted into formats that can be read by, for example, a Kindle e-book reader. For now, let us first create a PDF output.

For now, click on the Menu button at the top left. A new panel shows up (see Figure 12.1). In the Settings section, click on the drop-down menu right of Compiler.

pdfLaTeX ⋅  pdfLaTeX is a basic LaTeX typesetting engine that translates LaTeX documents directly into PDFs or HTML files (with the help of TeX4ht).

XeLaTeX ⋅  XeLaTeX is a LaTeX typesetting engine with an extended font, as well as UTF-8 encoding (for special characters) support. It takes longer to compile with XeLaTeX than the more basic pdfLaTeX.

For now, we want the PDF output, so select XeLaTeX.

Switching here between pdfLaTeX and XeLaTeX allows you to switch between HTML output for e-books (pdfLaTeX) and PDF output for printed books (XeLaTeX) but requires you to recompile your project. For this, click on Recompile in the menu above the preview window on the right. If the compilation did not work, the document icon to the right of Recompile will show a red box with the number of errors and warnings. If no number is shown or if there are only warnings (yellow box), you can proceed with the download.

To download the PDF of the XeLaTeX output, simply click on the third symbol (Download PDF, the second symbol to the right of Recompile in the PDF view). You can also click on Menu on the top left, and click on PDF. Done! Your first PDF. This PDF could be used to upload to on-demand book services like Amazon’s KDP.

Please note that the PDF will need further polishing, such as configuring what content is shown on the left-side and on the right-side pages. We will discuss issues like this in Chapter 18.

## Create HTML Output

For now, let us try out the HTML generation. For this, click on the Menu button at the top left, and this time, select pdfLaTeX in the Settings section, in the drop-down menu to the right of Compiler. Then, press Recompile in the right panel. Before continuing, wait until the compilation is finished. If you encounter a problem here (and a little red box with a number appears on the document icon right beside Recompile), feel free to contact me at [email protected]

## Convert HTML to Kindle

Now we need one final tool, namely the Kindle Previewer. Go to https://www.amazon.com/gp/feature.html?docId=1000765261 and scroll down to the download links. If the link is not available or if it is broken, simply search for Amazon Kindle Previewer using a search engine.

Once downloaded, start the installation, and then start the Kindle Previewer. There, select File / Open Book (see Figure 12.3) and browse to the directory where you have unzipped the files of the book. Select output.html and press Open. This starts the conversion process.

Depending on the book size, this might take a moment (“Converting your book to Kindle format”). Once finished, a virtual Kindle reader should show up where you can browse through your book. If you are fine with how the contents look, press File / Export in the menu, and press Export. For the name of the exported file, I recommend including the current date to prevent confusion when uploading (for example, bbwltaw-09032019.mobi). A message box should pop up that reads “Book is successfully exported here.” You can safely ignore the warning message “Enhanced typesetting is enabled for the book being previewed, but it is not supported in the exported file.” This refers only to the fact that any fonts you are using in the HTML file are ignored and replaced by the respective fonts of the e-book reading device. Now you have a MOBI file that you can use later to upload to Amazon’s KDP platform and release it directly as an e-book on Amazon. We will discuss the details later (see Chapter 20), but in essence, that is the entire publishing process, at least from the technical side.

## Versioning

Before you continue: while you are learning LaTeX, you should create a backup whenever your project compiles successfully. You can click on History (top menu, see Figure 12.4), then on All history, then on View single version, then on Label this version, then enter a name for the backup.

It is best to name each backup by the milestone you have reached so that you later know at what point you have made the backup. For example, after polishing the files for an e-book release (but before polishing it for print), you could name it “e-book polishing complete.”

You can always go back to a previous version and compare the changes you have made. Click on History, then on Compare to another version, then on Labels, and then on a file in the list on the left side with a note “edited” right beside it. That being said, you do not have to save as you write. Your latest changes are always saved automatically.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## Word vs LaTeX

For which books is it better to use a word processor? What are the advantages of writing a complex book in LaTeX vs Word?

This is an excerpt from Better Books with LaTeX the Agile Way.

Having written seven books on topics including project management and philosophy, I have gained a great deal of respect for a well-written book. It is not enough to just have a stack of notes that you sort into chapters. It is not enough to spend a lot of time editing and organizing those notes. It will create a book, but is a book really what you wanted? It might sound a bit strange, but the goal of writing a book is not the book itself. It is that the book will be read.

Even the best technologies cannot save a unicorn—or make us better authors. They cannot tell us what to write. But they can help us to bring our imagination and ideas onto paper more quickly and efficiently. All you need to become a successful author are your mind, a pen, and paper. Everything you need to become a published author more quickly is in the Better Books with LaTeXthe Agile Way.

## Comparing Word and LaTeX

Everyone knows Word. However, “knowing” Word mostly refers to ease of use, as it is a “what you see is what you get” (WYSIWYG) text editor. But if I asked how, using Word, to refer to another document’s text block and add that as a citation in a footnote, most people would have to look on the Internet to find out how that could be done. While most of the functionality is available through icons, you still need to know where to look when something is not a standard command like those used in formatting, making lists, or choosing fonts.

Word ⋅  Word usually refers to Microsoft Word. Generally, it is used as an umbrella term for all word processors that directly show you what you will get as an end result (as opposed to first having to process the file). This approach is more intuitive, but it makes editing large projects very complicated.

In LaTeX (pronounced LAH-tekh or LAY-tekh), you instead create a text document which is then translated into an actual formatted document (your book). Formatting is done through commands you enter as text into the document. To write a LaTeX document, you never have to touch your mouse, as you can enter everything by keystrokes alone.

LaTeX ⋅  LaTeX is a typesetting system that works more like a compiler than a word processor. While initially complicated, LaTeX allows better management of larger projects like theses or books by splitting the document into sections: style, references, and text.

Word and LaTeX each have particular advantages:

If you know the commands, creating a LaTeX document will be quicker than writing a Word document. You never have to break your concentration to access a special command. Sure, there are shortcuts in Word, too, but those have to be learned as well.

Because all commands are part of a LaTeX document, you can edit your text on any device with any editor you like, while Word documents require an installed editor (well, Word) that does not show the formatting and control information.

The upside of Word is its automated grammar check. LaTeX online platforms like Overleaf provide spell checks, but no integrated grammar check. We will have to wait for future releases in that regard.

Word offers integrated basic graphic functionality for symbols while LaTeX has to rely on a rather complicated vector graphics engine.

Editing a Word document using different versions of the software might lead to compatibility problems and it will certainly not look the same in all versions. While there are collaborative online editors for Word, you are then on the same level as LaTeX online editors like Overleaf and you lose the ability to work on your document while on the road without Internet connectivity. Compatibility issues are especially problematic if you are co-authoring a book or working with an editor, or when relying on exact page numbers. Do not forget that books can exist for quite a long time. Will your Word file still work in 10 or 20 years when it’s time to release a new edition of your book or use parts of your book in a new book or article?

LaTeX’ more substantial post-processing of each change allows for much more complex algorithms, which provide you with better hyphenation and professional-looking typography—both features come out of the box and require little to no tweaking. In LaTeX, the document is processed in the background with a delay (a few seconds up to several minutes), while Word has to provide any change in real time, which requires that editing is optimized primarily for speed. While LaTeX updates the whole document with each committed change, you need to update some elements manually in Word (for example, the table of contents and the index).

In LaTeX, an element of the style of the entire document can be changed with a single line of code, while it takes 10 clicks in Word to change the style of a document. While Word does have a sophisticated versioning system, this applies only to the text itself. The style information (for example, the formatting of headers or footers) in Word is not part of the visible document. Hence, changes to the style are not directly visible in the document version history.

Versioning system ⋅  A versioning system is a tool to track changes to a document. That means you can go back and check what has been changed and by whom.

If your document contains graphics, processing Word files can become really slow, or the program might even crash. Why? Because while you are editing, all the images have to be cached somewhere, which takes a lot of memory. When editing LaTeX documents, images in the editor are visible only by their text reference and are only later—one by one—compiled into a PDF or e-book.

LaTeX is known for its beautiful typography. For example, it supports kerning and ligatures, giving a typeface its finishing touch. Improved hyphenation, proper small caps, and proper justification are other features LaTeX offers that Word cannot do as well or without additional work.

While Word has several tools inbuilt that support multiple languages (dictionary, basic grammar check, special characters, etc.), it is not designed to handle multiple languages at the same time. If you want to produce, for example, a German and an English version of your book, the best advice would be to use two separate documents and translate and compare them paragraph by paragraph. In LaTeX, a single document can contain multiple languages. To create a multi-language project, you can put each paragraph of the second (or third) language below the original language. This makes translation work more manageable and reduces work for synchronization when making revisions. This is possible by a simple switch command that uses all entries marked with either one language or with another.

In LaTeX, you can add functionality to switch between e-book and print output without having to manage two separate documents. For example, my Philosophy for Heroes: Knowledge project produces four output files: the German e-book, the English e-book, the German PDF, and the English PDF. Even if your ultimate goal is to focus on the printed version of your book, merely having a more affordable e-book version will help to increase sales as it gives your readers a choice. Those who do not have a preference about reading your book in print or as an e-book might opt for the cheaper version rather than not buying your book at all.

Because LaTeX documents are compiled, you have the option to build your document not as one huge file like in Word, but as a collection of many files. As mentioned above regarding images, you can also include text files at any part of the document (as opposed to copying the whole text into one huge file). This makes it easier to divide the work and proceed section by section, as opposed to having to locate the part you are currently working on each time you open the document. It also makes rearranging sections easier: you no longer have to copy and paste pages over pages (never being sure if you have successfully copied everything and nothing was lost). Instead, you just move the reference to a section to another place. For example, let us assume you write a book about dogs and cats and first discuss dogs, then cats. In LaTeX, you would put each discussion into a separate file, and include them into your main file like this:

\input{main/aboutdogs}
\input{main/aboutcats}

Moving your discussion about cats to the front is done by simply switching the position in the main file:


\input{main/aboutdogs}

If your document contains formulas, LaTeX provides an entire scientific library of functions to edit and display them directly in the document. While you can create basic formulas in Word, for any complex mathematics you need to use a separate program to create and embed an image. Likewise, especially non-fiction books rely heavily on citation. To manage your sources in Word, you need a separate plugin or third-party program (like Citavi), while LaTeX supports the most widely used standard BibTeX for free, with no plugins required.

Citavi ⋅  Citavi is a plugin for Word (see https://www.citavi.com) to manage your bibliography and citations.

LaTeX is open source and free (even the online editor Overleaf is free if you can do without password protection), while you have to pay license costs for Word.

Categories

## How to Get Early Feedback from Readers

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

While we have discussed how to include the reader by creating user stories and personas, we have not included actual readers in our publishing process. In this chapter, we will discuss how listening to your audience can help to improve the quality of a book.

## Learning from and Connecting with Your Audience

Learning from your audience can be done in various ways:

• Examine feedback from a previous similar book you have released. This is an especially relevant option if you are writing fiction books in the same genre, or if you are writing a new edition of a book on technology.
• Set up ads and examine the statistics. See Better Books with LaTeX the Agile Way.
• Send out copies to trusted reviewers and listen to their feedback. This is undoubtedly the gold standard of improving a book with the help of a reader. The most significant drawbacks are that the reviewer might have a lot of other books to read before yours and that the process of reviewing takes time.

First, there are niche books that required a lot of work and sell easily for more than $50. An example would be books about current technologies: they have a unique selling point given that there is not a lot of competition. In this case, you might want to limit the amount of work you publish on your website. Second, if you are writing your book to advertise professional services, people copying your work should be a welcome situation as a means of reaching a wider audience. Think of it as people copying your advertisement and showing it to other people for free. Third, if your book is your product—not your services—you need to weigh your options. On the one hand, if you release individual chapters on your website, people could combine them together and have a complete book to read and no longer see the need to buy the actual book. On the other hand, they might tell other people about your book, or they might not be inclined to spend the time compiling your articles and instead buy the compiled book. You could also put more advertising on your website, release only excerpts, or limit access to those articles to trusted reviewers. ## Amazon Ads and Market Research Ads are another way to connect with your readers. Start your first ads when your book is ready for pre-order—ideally, on day one! Amazon sets a maximum time limit of three months for pre-orders, so aim for releasing at least four books each year to get the most out of it. Alternatively, you can use Google Play or Leanpub (see Better Books with LaTeX the Agile Way) which have no time limit. Have a first draft of your cover and upload that, together with your user stories (minus the names) as a description. Even though this might take extra work, any information you can get from your readers before the actual book launch will be helpful. For example, you might notice that one keyword does exceptionally well. You could use that information to improve your book’s description, pointing out that this (the keyword) is something you write about, and you could add an additional or extend an existing chapter about this topic. On Amazon, you have the following options: • Product Display Ads: You can display your book as an ad by Interest (on Kindle), by Category (on Amazon.com), or by Product (on Amazon.com). The first type of ad is relevant to you if you write for a specific genre and have an audience using mainly Kindle to read books. The second type of ad is also recommended if you write for a specific genre but aim for people browsing on the Amazon website. The third type allows you to place your ad on the page of a specific product on Amazon. This should only be used if you know that people who are interested in that product will very likely also read your book. For example, you could advertise your gardening book on a product page of a popular gardening tool. • Sponsored Ads: Sponsored Ads show up when a customer searches for a product. You can either set automatic targeting or manual targeting. With the former, the keywords will depend on your existing product information. If you have put relevant keywords into your description, this might be the fastest way to get an ad up and running. For more fine-grained control, manual targeting is highly recommended. If you are (also) producing paperback editions of your book that include an index, you are at an advantage here. Creating an index for your (offline) readers is the same as creating a list of keywords for your online readers to search for. While it requires some extra formatting, you can basically copy your entire (!) index into the keyword field on Amazon. While most of the index keywords are irrelevant, you will quickly (depending on your traffic) see which keywords people click on and which they do not (Amazon provides a detailed analysis for each keyword). Over time, deactivate non-performing or low-performing keywords and increase spending on the high-performing keywords. Once you have found the core keywords that sell your book, you can then optimize your copy by setting up multiple ads with the same keyword, but different copy. While this evolutionary approach will not revolutionize your sales (give yourself at least six to 12 months to learn the trade), it will most likely reduce your unnecessary spending and will likely increase the conversion rates of your ads. But again, ads can only do so much. Ultimately, it is your cover, your ratings and reviews, and the topic you are writing about that sells the book. A valuable side effect of running ads is certainly that you will learn more about the market and what people are searching for—invaluable information for deciding the topic of your next book. Also, you could put your top seven performing ad keywords into the book description. Free advertising! Beyond optimizing your keywords and your ad copy, you can also optimize your product page. To accomplish this, you have to have ads running for a certain amount of time depending on your sale volume (for example, one month), then pause those ads, make changes to your product page, and create identical new ads. By comparing the conversion rate (number of sales divided by number of clicks), you can then compare both versions of your book’s product page. If you want to rely on third parties to advertise for you, make sure you can track the conversion rate and start small. For example, someone might offer to publish your book ad to Facebook groups of 25,000 people. But that might only help you to get maybe 10 clicks because many people in those groups never see the post on their timeline. Paying$10 for this service will actually cost you \$1 per click—more expensive than a Facebook ad you place.

A bestseller is properly defined as “a book for which demand, within a short time of that book’s initial publication, vastly exceeds what is then considered to be big sales.” But many authors falsely call their book a “bestseller” if it was for an hour at the top of an Amazon category instead of relying on a trusted bestseller list by an established authority (e.g., New York Times). Hence, one should be cautious with people promising to make your book a bestseller.

That is the reason why, for the copy (in the ad and the product page) itself, it is best to refrain from the usual marketing buzzwords that come to your head. Sure, adding “bestseller” will create the illusion that everyone else likes your book so something about it must be special. But if it is not truly a bestseller, calling it one is dishonest and will make you and your book look cheap.

If you want to advertise in forums, write an article about your book, or create a video. The best approach is to not simply tell your audience what the book is about, but to evoke an emotional reaction; whether they love or hate your approach, at least you will get them talking about it. Then you can begin to collect early feedback.

Whatever approach you choose, keep in mind that the idea is to lay the groundwork for a long-term relationship with your audience. A quick sell can always be made at the cost of your reputation. Set as your goal to deliver on your promises with a well-researched, well-written book.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## How to Optimize the Work Process

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Substitute “damn” every time you’re inclined to write “very;” your editor will delete it and the writing will be just as it should be.

Mark Twain

Once you have written and ordered all your user stories, put your writer’s hat on back again. With this different perspective, take another look at the list of user stories and ask yourself if you know exactly what you will write to implement each user story. Do you still need to do research that will distract you from writing? Is it still unclear how your characters would act in a particular situation? Are you unsure about the sequence of the arguments to make your point? If you find something that will block you, it is better to hold off on writing and put your idea hat on again, and do the required research or work on the concepts.

• Add a reminder whenever you know more work or research is needed (but would require you to switch to another hat) on the chapter you are currently writing.
• When finished with the chapter, have your editor read through it, and have him or her add reminders if necessary.
• When getting back the corrected version, work through all the reminders. If you make any changes, mark them with with a different reminder (e.g., “TODO EDITOR”) to make it clear to your editor that you have made changes that need a final check. Again, platforms like Overleaf or Google Docs can highlight your changes automatically.
• Work through issues identified by automated spelling and grammar checkers like Grammarly. Remember to review each suggestion, because some will improve your writing while others will not fit the context of your book.
• Finally, during your daily or weekly chat with your editor, review all reminders and clear them up one by one.

Grammarly ⋅  Grammarly is an automated spelling, grammar, and plagarism checker. It also checks for weak vocabulary, repetitions, and overly long sentences. You can get an account here: https://www.grammarly.com.

In terms of time organization, there is no single solution that works for everyone:

• Work on a single user story or chapter each day, no matter how long (or short) it takes.
• Set a fixed timebox (e.g., from 9 to 5), stop once you have reached it, and pick up where you left off on another day.
• Set a fixed timebox, and work on as many user stories as possible. Whenever you finish a user story, estimate whether you can finish the next story on the same day. If not, take an early break.

A successful writing day depends on whether you have prepared the user stories in advance so that you do not have to switch your hats all the time.

If you suffer from writer’s block or procrastination, another approach is to go not by time or user story, but by volume. If you set a word count goal, the danger of stopping to find the perfect words will be lower. And if you have a well-written outline, a complete description of your characters and their background, and a description of the world in which they are living, then there is little that can stop you from continuing writing. Even if you think you are writing uphill or it is going nowhere, just keep on writing: you can get back to it during editing. With non-fiction books, have your arguments and research texts prepared in advance and see the actual writing as an exercise to connect all the points you want to make.

Your goal should not be to create “perfect” paragraphs: what counts is the overall quality of your book. The reader will put your book away on the weakest page. If you have spent all your time perfecting one part and then run out of time or energy for the rest of the book, the entire project will suffer. The book need not (and indeed cannot) be “perfect.” What is important is that it gets finished and that the quality is consistent throughout the book.

### Project Planning

Beyond planning individual user stories, you also have to plan the whole project. In project management, there are usually three main factors to think about: time, cost, and quality (or content). The basic idea is that you usually can meet only two of those goals. If you want to publish faster and achieve better quality, hire more people. If you want to keep costs down, take more time or reduce quality. If your publication date is fixed, you can either hire more people or reduce quality.

For a book project, you probably cannot afford or make use of additional writers. It might be worthwhile to hire a freelancer for basic research or for writing a first draft, but ultimately, it is up to you, the author. This leaves you with either increasing time or with decreasing quality (or reducing content). With the user story approach where you build up your book step by step, you can stop at any time and release what you have so far, so it is best to timebox your book project. Even if you have chapters left to write, you can always move them to a second book and add a preview to your first book. Also, you are always free to re-release your first book’s contents later, working in any feedback you received. To decide when to divide a book, you might want to take a look at your competition and the book size your readers expect:

• 25,000 words: Short e-book. Strange Case of Dr Jekyll and Mr Hyde is an example of this at about 25,000 words.
• 40,000 – 50,000 words: Most non-fiction books/short novels. Better Books with LaTeX the Agile Way has around 50,000 words. Printed books for sale in book shops should have at least this length so that their spine is large enough for display.
• 70,000 words: Long non-fiction book/novel.
• 100,000+ words: Very long non-fiction book/long novel.

For more examples of lengths of famous novels, check out http://commonplacebook.com/art/books/word-count-for-famous-novels/. For counting words, you can simply use Word’s function (Review/Word Count), or copy your text into Google Docs (Tools/Word Count).

### Working with an Editor

My recommendation is to involve an editor to review your work regularly. Myself, I chat with my editor two times each week, during which time we discuss issues with past books, sales, newly written chapters, and her insights on chapters I wrote the previous week. This way, my memory is fresh and issues can be addressed right away. If I were to wait until the manuscript was done, I might no longer be able to implement some of the suggestions made by my editor.

Ideally, your editor also acts as a writer’s coach and helps you to reflect on your progress. Having someone to report to every week is using social pressure to your advantage. With all the processes outlined above, it is good to have someone look out for you so that you do not get sloppy and make excuses. Alternatively, create a blog where you force yourself to record your progress each week— similar to a diary, but for the public eye. Another possibility is to join a local writers’ group whose members report on their writing progress and motivate each other.

It is too easy to fall into the trap of writing as if you are writing a report and talking to the computer instead of a person. Your editor’s job is to ask you what you actually mean in questionable paragraphs. This puts you into the state of mind of having to explain it to an actual human being.

In terms of tools, there are many that can help you in the process of editing:

• For collaborative editing, it is vital that you see changes the other person made or is making during your chat meeting. I am using Overleaf (see the book for a detailed discussion) for this.
• For shorter books or documents, I use Google Docs, which you can also use collaboratively with your editor.
• For documenting ideas “on the spot” when you are traveling, you can also use these apps on your smartphone. Alternatively, track your ideas in your calendar (app) or make audio recordings.
• For automatically checking your texts, you might want to give Grammarly a try.

### Summary

To sum up the recommended steps to optimize your workflow:

• Prepare your work beforehand; do not switch too frequently between conceptualization/research and writing.
• Find the right tools to work with an editor collaboratively.
• Use automated tools for basic checking of your text.
• Answer your editor when he or she asks what exactly you want to express with a particular paragraph. This will help you to write as if you are talking to a person.
• On a daily basis, figure out what type of goal works best for you: writing for a fixed amount of time, reaching a certain word count, or finishing a user story.
• Finalize individual user stories or chapters, even if it means that details will still have to be added later.
• Commit to deliver completed chapters/sections in regular time intervals. An editor can help.
• Deliver the same level of quality throughout the book. Limiting yourself to regular deliveries will help you with this.
• Commit to a publishing date. Sticking to regular deliveries will make it easier to be prepared to publish your work at any time.
• If necessary, cut your work in half, publish what you have, and get early feedback.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## The Rules of Your Book

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

In non-fiction works, the rules of your book are simply the rules of reality. In order to have a consistent quality throughout your book, I recommend deciding early on how deeply you will be researching specific topics. For the reader, it might be odd to have one chapter full of references, while the others only scratch the surface. If you indeed need different rules for different chapters, make it clear. Ideally, write down these rules in a separate document and have your editor check whether you are following them. In Agile terms, this is called Definition of Done—conditions that have to be met in order for your editor to accept your work. This document could also include things like grammar rules, spelling, rules about usage (e.g., capital letters, lower case, contractions), formatting, citation styles, image resolutions (what prints well?), caption style, tone (formal, informal), or perspective (first person, third person, etc.). This document is typically referred to as a style guide.

In fiction works, after creating your world and characters, it is time to put them into a specific situation and think about how they would act. This ensures that they will come to life and that they really are the actors of your story—and do not seem like they are hanging from the strings of a puppeteer.

If your book follows the (fictional) world’s rules throughout (with very few exceptions), you keep your readers on edge, not knowing how the characters will come out on top. Breaking those rules is possible, but should be done only sparingly to put more emphasis on a scene, for example, “Sometimes, Superman can overcome even kryptonite.”

If you do not provide limitations for your fictional characters, a common mistake is to create “Mary Sue” characters who always do the right thing. This approach means that your characters are driven by the plot, rather than driving the plot. It leaves out internal development. You should handle characters as people who have gone through a series of defining experiences. In order for them to be believable, they had to discover their own strengths and limitations. Even if you want to portray an ideal, you need to explain how they became who they are—this is true even for superheroes. You cannot simply wish yourself to be a hero. Someone who thinks that he or she can do anything without effort is not a superhero but a Mary Sue.

Mary Sue ⋅  Mary Sue is the term for a seemingly perfect fictional character. It originated from a parody of Star Trek fan fiction stories where writers included new characters with a major role in the story, but without making an effort to describe how they reached their position.

Likewise, if you allow your characters to have superpowers when it is convenient, it reduces the relevance of the actual climax of the story. The reader would assume that your characters are unlimited and could overcome any challenge by breaking the rules.

This also applies to non-fiction works if you are discussing people and their achievements: do not forget to include their failures, and how they dealt with challenges privately, in order to paint a complete picture of internal and external development.

Your readers will notice when you are trying to play God within the book’s world. It will break the “fourth wall,” destroying the illusion that these are real characters acting, and not a writer making them act. If you want your characters to reach a certain place or situation, you can create events that shake things up, but those events have to be believable based on the rules you have set up for your world. If you want the reader to think that the person he or she is reading about is a conscious being reflecting on his or her actions, you must create and follow your world’s rules.

The fourth wall ⋅  The theater stage is usually surrounded by three walls, with the fourth wall facing the audience. In this context, breaking the fourth wall is a reference to the characters becoming aware that they are being watched and directly addressing the audience.

Before you define the rules of your book, though, you should have a clear picture of the reader for whom you are writing the book. Some writers advise using 8th-grade level language, especially when it comes to complex topics. This is the same level that, for example, Harry Potter was written in, and which around 80% of Americans can read. With tools like https://readable.io, you can get an idea of the quality of each chapter. With such a feedback tool, you can also train yourself to write at a lower language level than you naturally do. For example, I write (English) at an 11th-grade level, and my books are aimed at adults and professionals, but I am thinking about writing special editions for children.

Likewise, reading is a linear activity, and you do not want the reader to put away the book because he or she stumbled over a weak part of the story. A true page-turner requires the same quality throughout the book. One of the big advantages of using the Agile approach to writing is that (at least to a certain degree) you spend roughly the same amount of time on each part of the book. This maintains a certain level of quality throughout your book. If you catch yourself getting lost in details, it is often better to just finalize open ends (and remove half-finished texts) and prepare your book for a first print. After a break, do a complete read-through. This method helps you more than spending too much time on any one part of the book.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## How to Organize Your Ideas (Fiction Books)

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Don’t say the old lady screamed. Bring her on and let her scream.

Mark Twain

For fiction books, you cannot simply map your user stories directly into individual chapters of your book. Instead, you have to approach the project in several phases:

Second, you will be creating the characters of your world. Some characters you can immediately draw from your choice of genre. For example, in the “noir” genre, you often have a “femme fatale,” a woman protagonist who is rejecting societal expectations like marriage or motherhood. Another example is (a very early part of) the “Western” genre, often with a protagonist who fought on the Confederate side of the American Civil War and is basically portrayed as a “dead man walking.”

Using the template provided by a genre instead of coming up with your own can help you to get started. While it is true that choosing a genre will mean more competition for you, the only alternative would be to do a lot of market research and create and market your own genre. While there are authors who have defined a new genre, these instances are rare—think of William Shakespeare (drama), Homer (poetry), or J. R. R. Tolkien (fantasy).

In contrast to the previously discussed non-fiction books, in fiction books, you are not necessarily describing parts of the real world, you are instead building a new world and fresh characters. Here, your readers cannot tell you what they want to read about, except in a general way. They might want a “Western in space,” but it is up to you to describe how the characters in your world act and react.

As a writer, you set up the fictional world and its rules. If you have done a thorough job, at this point, you can let it play out and unfold on its own, with you just continuing from where you have started setting everything up. Your characterization of the individuals and the world they are living in become the main drivers of the story. A positive effect of applying rules to your fictional world is that it forces you to become more creative. For example, if your Western setting does not allow for magic or modern medicine, you have to come up with other ways your character survives a gunshot wound.

Please note that the general artistic argument is to not listen to what the market “wants” but to write what comes to your mind. I think this is a valid point, given that your mind, your experiences, and your ideas are by default unique in the market. So, whatever you write will automatically fill a niche. Even with this approach, selecting a fitting genre might be useful. You can put your story into a fantasy or science fiction setting without losing its core. If you know that, currently, science fiction stories are most sought after, you might want to give it a shot. The fundamental decision you have to make, though, is whether you are writing as an art form, with the goal of expressing and exploring your emotions and ideas, and learning the trade itself, or if you look at writing as a business, where you have to attract “likes” and “subscribes” to build external validation.

To summarize the difference between how to organize your writing for non-fiction and fiction books:

• Non-fiction: User stories are things your readers (personas) want to know. Group them into topics, then order them in a way so that they build upon the previous stories.
• Fiction: Select a genre based on the interest of your target audience. Create separate user stories for the elements of the world, for each character,and for each scene or event.

Finally, your book needs an overarching theme, moral, or philosophic view. Please note that even if you do not start out by defining it explicitly, you will still have one. We are all driven by a philosophy, consciously or unconsciously. So, whether you intend it or not, your book will have a viewpoint. It could be a whole system of philosophy, or it could be simplistic as in “crime is bad.” We always have some viewpoint. Either we follow the predominant views of the society we live in, or we consciously decide upon a specific theme, morality, or philosophy.

Similar to (physical) rules of your world, you also need ethical rules of your world. If those rules are contradictory or inconsistent, this can lessen the tension in your story and your world will be somewhat chaotic. If the reader can expect anything to happen, then nothing is at stake. An alternative is to maintain contradictory philosophies, but with characters representing them.

The issues are similar to those with non-fiction books: if you decide upfront on a theme or moral, you run into the danger of moralizing and breaking the rules of your “world” (the world within your book) just to prove your point. If you develop the moral while writing the story, you give up control over your world, and you have to adjust the world in a clever way to ultimately demonstrate the point you want to make.

My advice is to start with your views, but the tool to express those views should be the world you have created in your book (or the real world). If you cannot create a world where the scenes or events you have thought about can happen, it might be time to reconsider your ideas.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Categories

## How to Organize Your Ideas

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.

Previously, we have discussed the approach of creating personas and what various personas might want to read. If you are writing a non-fiction book, the next steps are straightforward. What the reader wants to read and what you will provide with user stories is very much aligned. A reader has a specific problem, need, or interest, and you are trying to solve it by providing instructions or information. For example, Better Books with LaTeX the Agile Way deals with topics relatively limited in scope: Part I discusses a project management method, Part II a technology and its application.

For simple non-fiction books, I recommend following these steps:

• Group your user stories by topic.
• Write the book based on the user stories.

But following this step-by-step approach, you get something like a how-to description, dictionary, or encyclopedia. By contrast, in my Philosophy for Heroes series, my goal was to provide a comprehensive discussion of philosophical and scientific concepts for the reader to figure out for himself or herself how to be a (better) hero in real life. As I also used the series as a way to form my own opinion of the topic while continuing to study it, my original approach to plan everything from the start failed.

If you are not already an expert on a topic, if it is not a simple how-to description of a proven method, you will have to go back to the start of your writing again and again to fix something you learn later. Split your project into a series; be open to telling the reader that you have changed your opinion on something discussed in an earlier part of the series to demonstrate that it is also a learning experience for you, the author.

If you want to write a book that takes the reader by the hand and guides him or her through the topic you are discussing, you need something more. You need a big picture, theme, vision, or an overarching story that you want to tell with your book.

For this, you have two options:

• Arrange and re-arrange the user stories and tell a story explaining why they are in this sequence. I recommend writing the user stories on stickers and putting them on a wall, making the whole scope of your book easily visible and easily changeable.
• Start with an overarching vision and then go back to arranging (and possibly modifying) the user stories in a way that supports that vision.

The challenge with the second approach is that you might curtail your creativity. If you start out with the conclusion, all your efforts are focused on proving it, instead of also looking left and right and investigating alternative views on the topic. So, when choosing the second approach, you should be careful to set only a general direction, not a fixed result.

For example, instead of writing a book about how “Word is the best software to write books,” set a more general theme for your book, such as “The advantages of using Word as an author.” This leaves the outcome of your research open but keeps you on track. You could gather a number of arguments, examine alternatives, and end up with clear advice for whom and what kind of book projects Word is the best software. This is also the more scientific approach, helping to prevent falling into the trap of confirmation bias.

Whichever option you choose, you will end up creating some kind of outline of your book, either as a starting point for your user stories or as a tool to connect them together into a consistent theme. This outline will be like a streamlined version of your book. Use it when you practice describing your book in a 30-second “elevator pitch.” If you cannot deliver the message of your book in that time, you could consider either splitting your book into two or more books or rewriting the outline. You could even use the outline as an article you release online (we will discuss releasing parts of your book early in another article and the book).

An additional or alternative approach is to start your book with the front cover. Having to limit the way you describe your book by a title, an image, and a short subtitle automatically helps you to focus on a single idea. It is also the cover, not your outline, that will ultimately sell your book. You can reuse your outline on the back cover or in an online description of your book, but the first contact point with your readers is the cover.

In summary, we have the following two approaches to start writing your book:

Option 1:

“Peter is a paleontology student.”
“Peter wants to know about dinosaurs in the Jurassic Age to study for an upcoming exam.”
• 3.Group your user stories by topic.
“Dinosaurs in the Jurassic Age.” “Dinosaurs in the Cretaceous Age.”
• 4.Arrange your groups of user stories into a sequence that fits into the narration of your book. One story or group of stories should build upon the previous one. When in doubt, put more important user stories before less important user stories.
“First Jurassic Age, then Cretaceous Age…”
• 5.Write a basic outline or come up with a theme or vision of the book that fits the written user stories.
“In this book, we will discuss the different Ages of life on Earth in chronological order.”
• 6.Write the book based on the user stories.
“Dinosaurs first appeared during the Triassic period, between 243 and 233 million years ago…”

Option 2:

• 1.Write a basic outline, come up with a theme or vision of the book, or create a book cover.
“In this book, we will discuss the different Ages of life on Earth in chronological order.”
“Peter is a paleontology student.”
“Peter wants to know about dinosaurs in the Jurassic Age to study for an upcoming exam.”
• 4.Group your user stories by topic.
“Dinosaurs in the Jurassic Age.” “Dinosaurs in the Cretaceous Age.”
• 5.Arrange your groups of user stories into a sequence that fits the outline, theme, or book cover. When in doubt, put more important user stories before less important user stories.
“First Jurassic Age, then Cretaceous Age…”
• 6.Write the book based on the user stories.
“Dinosaurs first appeared during the Triassic period, between 243 and 233 million years ago…”

For Part II, I decided on the second option. Market research has shown me that there is a demand for books about writing, but only a limited supply in terms of books discussing how to write books in LaTeX. While there are many introductory books about LaTeX, there are only few that focus on helping book authors. I want only what gets someone from A to B (in this case, writing a book) and nothing else.

But instead of asking people if LaTeX is what they actually want, I went for the niche simply because my objective of the book was to reflect upon and document my own writing process. The advantage of this approach was that I was able to write a well-rounded and focused book; the disadvantage of this approach was that I might not have taken the actual needs of readers into account. I simply present the proven solution I have found. Maybe the bigger market would have been the people writing books in Word?

For the elevator pitch for Part II, I used the following form:

• For: First-time authors, novel writers who want to write a first non-fiction book, writers who are looking for better tools, LaTeX experts, editors who want to expand their services, LaTeX beginners who are looking for an introductory book, self-publishers who are seeking insights, and professionals who want to add a book to their portfolio,
• The: “LaTeX” part
• Is an: introduction to building books with LaTeX
• That: takes readers through a variety of topics on publishing, from A to Z with the focus of using LaTeX as the central word processor.
• Unlike: pure LaTeX books that focus on the technology or pure publishing books that ignore the difficulties of managing more complex books with Word,
• We: provide a template and a tutorial that even beginners can use and professionals can refine for their purposes and embed this technical knowledge into a discussion of publishing, polishing, and editing.

For the user stories for Part II, I developed the following list (the “what” part is in bold for each user story):

• 1.Mary wants to know about the possible advantages of using LaTeX instead of Word to make an informed decision on whether to use LaTeX for her future books.
• 2.Mary wants to know how and where to insert the texts (foreword, preface, publisher information, TOC, glossary, etc.) into the template for an e-book / printable PDF.
• 3.John wants to learn the basics of LaTeX so that he can make small adjustments to the template and enjoy a head start when learning more complex commands.
• 4.John wants to know how to better manage bibliographical references to save time and reduce mistakes.
• 5.John wants to know how to better manage indexes to save time during index creation and after page changes.
• 6.John wants to know the reasoning behind the organization of the template in order to make informed adaptions.
• 7.George wants to know how to convert his LaTeX document into an HTML file to publish it as a website article.
• 8.George wants to know the special requirements of final polishing (which image quality to choose, what to do about blank spaces and page breaks, etc.) of the PDF to make a professional-looking printed book.
• 9.George wants to know how to tweak the HTML output (page breaks, table of contents, etc.) to improve conversion quality for mobi (KDP) in order to have an e-book of high quality.
• 10.Clara wants to know how to publish her books and e-books on Amazon KDP, so that she will have a central place to manage and sell them.
• 11.Peter wants to know about how to create a book cover, LaTeX graphics, etc. and how Lode Publishing can help to create an appealing book.12.George wants to know how to reuse glossary items and other text blocks to save time when writing a series.

For the user stories of this book, I developed the following list:

• 1.Peter needs a pep talk to prepare him for possible disappointments when starting a book project.
• 2.Peter wants to know about the potential sales of his book in order to better plan his expenses (and manage his own expectations).
• 3.Clara wants to know the general approach to investing money so that she doesn’t waste any.
• 4.Clara wants to know how she can incorporate her book into her professional career and benefit from it more than just through book sales.
• 5.Peter wants to know where to start with a fresh book project so that he will not get lost in endless edits that prevent him from completing and releasing the book.
• 6.Peter wants to know how to better decide what to include in the book and what to leave out to create a better book more efficiently.
• 7.Tina wants to know how to use personas so that she can write for her target audience.
• 8.Mary wants to know how to have the same quality of language and content throughout the book to keep the reader engaged.
• 9.Clara wants to learn a method for organizing her ideas and how not to get lost in details so that she can write a comprehensive but to-the-point book.
• 10.Tina wants to know and stay in contact with her audience as a means of increasing future sales.
• 11.Mary wants to know how to conduct market research for books and how to include that into the writing process so that she can sell more books.
• 12.Peter wants to understand what working with a professional editor or coach looks like and how it could help him in order to make an informed decision about whether to hire someone and whom to hire.
• 13.Mary wants to know how to work more efficiently with her editor to speed up the writing and editing processes.
• 14.John wants to know how to better organize his communication with an author in order to reduce overhead and better deliver what the author expects.
• 15.Mary wants to know how to create better ads on Amazon to increase sales.
• 16.Peter wants to know how to properly cite so that he will respect the work of others.
• 17.Mary wants to get earlier feedback for her book so that she can incorporate market demand and readers’ wishes into her book.

This is an excerpt from Better Books with LaTeX the Agile Way. You can get a copy here.