Writing a Series

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

LaTeX documents are projects consisting of an entire folder of files, as opposed to everything being in a single file such as with Word documents. While this initially requires more time to set up, this manner of creating documents shines once your project gets larger—or when you work on multiple books. For example, in my philosophy book series, each book can stand on its own. This means I have to repeat some of the definitions, examples, or explanations from previous books. Sure, you can copy and paste and you are done with it. But managing books over a lifetime requires working in updates. Will you be able to keep the texts identical? Or even for novels, you might want to bring out a new edition of a particular book. Will you manage several different author pages, publisher information pages, advertisement pages, and so on?

As you produce more work, you will have to advance one level and manage your content. LaTeX projects offer the solution for this: you can simply link files of another project to yours and insert them seamlessly. To do this in Overleaf:

  • Select the folder to which you want the file to be linked.
  • Click on the arrow to the right of the folder name and select Upload File and From Another Project.
  • Select the project, and then the file you want to link.

Once linked, you can use the file like a regular file in your project. Linked files show a different icon (a small chain) and you can access them via \input{folder/file}. Of course, you can also link images or any other type of file and use them with the corresponding commands (e.g., \includegraphics{folder/file}).

What are possible candidates for linking? Let us take a look at the template:

  • Whole sections if you create a new version of your book with a different focus.
  • The bibliography—imagine having a single library for all your projects.
  • Individual glossary, idea, or question items.
  • Images.
  • Template style files (all files in the lib directory).
  • The htlatex tools (latexmkrchtlatex.cfg, and main.css).

For the latter two items (the template style files, and the htlatex tools), you might have to be careful when linking them and making changes as it might change the pagination of all your projects that use the file. On the other hand, if you plan to create new editions with a new layout anyway, it is easier and less likely to cause errors if you have all your style files in one place and make each change only once.

For example, let us assume you have five LaTeX projects and want to change the book size from 5.25”x8” to 6”x9.” If the style files are linked, you would need to make only one change in the lib/bookformat.tex file, recompile the connected projects, re-polish the output files, and you are done.

So, ultimately, the benefit depends on your situation. I advise keeping this feature in mind as you write your first few books. Once you can see a possible benefit of reorganizing your books, start by creating a main project in Overleaf which houses your shared bibliography, glossary items, and so on, and link to them from the individual projects.

Whenever you make changes to your general template settings, you no longer have to make changes in each project individually. Instead, you can apply changes to the main project, and then just refresh all the linked files in each of your book projects for the changes to take effect. For example, let us say you have found a spelling error in your bibliography. You can fix this issue in the main project and refresh the file in other projects, instead of having to apply the fix to every single bibliography file of each project. All my projects share the “thank you” page, the “about the author” page, the main.css file, the htlatex.cfg, all the files in the lib folder, the bibliography folder, and the latexmkrc file.

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