Making Books with Latex…

A while ago I took a course and the vast majority of the useful information was presented in powerpoints and source code comments (via Jupyter notebooks). With all the spare time that covid has provided me, I have been trying to revisit that course and with the help of some normal formal textbooks, make a set of ‘course’ notes for myself. I believe that writing information out in your own voice really solidifies a lot of information for yourself.

The most important thing is to capture the information in a document that can be printed out. Hence, one of the main goals is trying to have the minimal amount of Latex class and package settings and parameters as possible, while still producing a document with some cool visual embellishments. The big thing is to learn and keep track of the information as a PDF, and not worry that much about formating.

To keep thing simple with all the examples, the lipsum package was used to generate some random text. Also the math was related to a previous Fourier series project. Again, things are being kept simple so we only want a screenful of additional code in the tex’s file preamble section, not multiple additional separate external files.

Basic Book…

Using Latex with no special packages or setting produces a pretty boring looking book. It is functional, however the style it brings back bad memories of from university course notes, hence some styling needs to be done.

All that needs to be done to produce the most basic of books is:




\chapter{First Chapter}
Some text...

\section{First Section}
More text...


Here is an example of such a basic book:

A More Advanced Book…

By adding a few things to the preamble and using a few packages, the produced book can be improved a fair bit nicer. Some of the key changes are:

The margins were adjusted so that a nice wide margin is on each page. There are a few purposes of this margin: 1) according to some, a narrower text block is easier to read, specifically if the ratio of the height to the width result in the golden ratio; 2) if this document is printed out, one can make notes in the extra space; 3) and finally, certain details are better suited in the margin rather than the main text block. Note that Latex switches the margins are switched back and forth for the left (verso) and right (recto) pages.


Use to the Palatino font…


Use the titlesec package to change the title format so that chapter titles are written out a little nicer and also some lines are drawn as well.


Any code is written out in the verbatim environment. Also it is placed within a tcolorbox:


The changebar package was used to draw bars beside ‘math stuff’. Note that the this package sometimes has some issues when compiling the document. The solution is to re-run the compilation and the problem does go away.

   {\cbcolor{black}\par \vspace{8pt} \cbstart \vspace{-15pt} \begin{enumerate} \item[]}
   {\end{enumerate} \vspace{-5pt} \cbend \par \vspace{7pt} }

Also to note that since I am the primary audience of documents that I write, then I choose some style elements that make me happy even though I know that they are incorrect or bad. This includes block paragraphs (paragraphs with no leading indentation). These are made with the following settings:


Finally, an example of this more advanced book is shown below:

Using the Memoir Class…

The advanced book example shows that a nicer book can be made with a few additional items thrown into the preamble. However, instead of figuring out the necessary items to slowly add or tweak over the course of writing a large document, using the Memoir class makes life a lot easier.

Memoir comes with a few macros to set the page layout sizes. They make some complex issues such as dealing with trim marks (when multiple pages are printed on a single sheet), folded pages, and allowing an extra space for the spine. For an 8.5 x 11 inch page, the following was used:


The memoir class comes with some predefined page styles. Perhaps the most useful of all of them are the chapter page styles which make the chapter’s first page a little more visually appealing and looking more like a real book instead of like bad course notes. Some example chapter styles can be found here (also that is where the following code was taken from).

\definecolor{medblue}{rgb}{0.161, 0.322, 0.639}

With the rest of the settings we are using the defaults provided by the memoir class. An example of the output is seen below:

Other Stuff…

From the internet it seems that the Koma-script book package is a very popular solution. First I have to admit that I have some incompatibility issues with my old install of Latex and the current version of the package, so in the future with a fresh install of everything I would give it a try.

It seems that Koma-script documents involve a little more overhead in terms of settings and parameters than Memoir. However, they provide a higher amount of customization and therefore one is able to produce some very nice documents. Some nice koma-script book examples include Kaobook class or this Phd thesis template.


All of the code and output is available here.


No Comments

Add your comment