How to write a book in LaTeX

Well, from my own experience I would suggest that you first focus on the content, then again on the content and after that, on the content. At the very end, you might play around with different styles and packages to modify the appearance of your text. With a long term project like a book it is very important to get not too much distracted by unimportant things.

In the end, there might be a publisher who insists on a particular style/class anyway. Many publishers in science have their own classes which one is obliged to use. But unless you have a complete manuscript, it is very unlikely that a publisher will agree on publishing your text. So first: just write the stuff with some standard class (the ordinary book class...) and finish the text.

EDIT: OK, maybe this was not too helpful, so here is some more addition:

  1. In a first step you should ask yourself what kind of audience you would like to address. This will determine the way you write very much. In math you want a textbook with exercises and detailed proofs or more a monograph with extended bibliography, etc.

  2. Structure and order your thoughts. Make a table of contents with preliminary summaries of all the sections/subsections. I used to do this in a separate tex-file "plan.tex" or so, which was also subject to change (quite a lot) during the writing.

  3. Be consistent with notation. Before you write, you should fix some notational issues: in particular in math, it is very important that you use the same symbols throughout, use symbols familiar to others, etc.

  4. Making a main.tex with inputs/includes of the chapters which input the sections etc. Here the style/class is not yet essential, it should just support a command like "\chapter". Note that input is a quicker, yet simpler and even limited, command. mwe:

    \documentclass[a4paper,10pt]{book}
    \input{packages} %\usepackage[utf8]{inputenc}
    \begin{document}
    \include{chapter1}
    \include{chapter2}
    \input{etc}
    \end{document}
    
  5. Fill your files with content. This will take 99% of your time.

  6. Check with some publisher etc where you want to place your work. They will provide a style-file or tell you which one of the standard ones is traditionally used with them. If they want to publish it at all.

  7. Then, and this takes not much work at all compared to the rest, adapt your sources to the class/style needed, fix the hboxes, massage the bibliography, scale the pictures appropriately etc.

So I hope that this is a reasonable workflow. It will be point 5 which really requires the most attention and work, the rest is cosmetics.


If you're already familiar with (LaTeX), then I would heartily recommend just starting to write (as Yiannis says), but with the memoir class (which you can read up on in parallel as the work evolves), rather than book.

Memoir includes two really good manuals: The Memoir Class for Configurable Typesetting is a combination of good typography and how-to-do-it, and A Few Notes on Book Design which goes into a bit of history and underlying principles.

I've been a memoir user for around seven years now. There was an initial learning curve (but only because I was already demanding more tweaks than might be proper!), but it has repaid the investment many times over, and, today, apart from books, the only thing I don't use memoir for is presentations.

The only other recommendations I would make are these: as it's a "new project", go with LuaLaTeX, BibLaTeX, fontspec for font tweaking, and 100% unicode.


Separation of presentation and content

LaTeX is based on the idea that authors should be able to focus on the content of what they are writing without being distracted by its visual presentation. In preparing a LaTeX document, the author specifies the logical structure using familiar concepts such as chapter, section, table, figure, etc., and lets the LaTeX system worry about the presentation of these structures. It therefore encourages the separation of layout from content while still allowing manual typesetting adjustments where needed.

(from wikipedia)

I agree with a lot of things described by other contributors but I think if you want to avoid a waste of time, you need to prepare the separation of presentation and content.

All the good classes give sectioning tools. So you can start working with chapter, section etc. but if you want write a math book, you need theorem, definition, remark , examples, etc.

Some classes give you these tools but it's easy to create them. In a first time, these environments can do nothing : for example

 \newenvironment{theo}{My theorem :}{\par} 

 \begin{theo}
      All I have to do it's to use fake environment
  \end{theo} 

Then you need to create some macros (fake or empty macros) \newword \GreatPerson \ImportantWord or FirstDef you can define these macros like this:

\newcommand{\ImportantWord}[1]{#1}
 \newcommand{\GreatPerson}[1]{#1} 

 \ImportantWord{Geometry}
 \GreatPerson{Pythagore}

I forgot two important macros : \number and \unit. It's not important to choice directly "sinunitx" or "numprint" but you need to prepare the formatting of the numbers and unities. If you don't do that immediately, it's a waste of time to format the numbers at the end.

And you need to prepare the index and the bibliography. I think is very useful to prepare the index. In a first time you can use \index{thisword} but it can be useful to have some specific macros. You can look at the file Mathmode.ltx of Herbert Voss to get some ideas. You can find something like

  \def\tIndex#1{\index{#1@{\UrlFont\texttt{#1}}}}
  \def\cIndex#1{\index{#1@\CMD{#1}}} 

But in a first time, fake macros are fine !

Now you can start writing "immediately", using the standard book class and not worrying too much about presentation.

With environments and macros you are ready to finish the presentation like you want. Without these environments and macros, it's difficult to find something in your text.

Tags:

Books