Creating chapters


By the end of the chapter you will be able to:

  • create chapters with subheadings
  • reference chapters or sections in the text
  • link tex documents into one main document

Creating chapters and subheadings

New chapters are created using:

\chapter{Chapter Name}

They are automatically added to the Table of Contents and the PDF bookmarks. New chapters are also put onto a new page. Remember that un-numbered chapters are created using \chapter*{Chapter Name}. These do need to manually added to the Contents and PDF bookmarks.

To split the chapters into sections and subsections we use:

\section{Section Name}
\subsection{Subsection Name}

You can even use \subsubsection{Subsubsection Name}

Activity - Set up your chapters but not the subheadings.


	Text about physics
\section{Quantum Mechanics}
	Text on Quantum Mechanics
\subsection{Schrodingers Cat}
	Text on Schrodingers Cat
	Text on entanglement

Linking tex documents

If you put the entire content of your Thesis in one file, it will be a very large file! It is better to put each chapter in a separate tex document and then link each document to the main file. Each of these separate files need to be in the same folder as the main file (to put them in a different folder, see the advanced slide at the end of this chapter). The chapter file names cannot include spaces but they can include underscores.

To link a tex file use:


Notice that I did not include .tex at the end of the filename. Here is an example, one of my chapter files is called experimental_setup. To link it to my main file I use:

\chapter{Experimental Setup}

The main document is then compiled to create the PDF. The chapter files themselves are never compiled.

Activity - Set up a file for each of your chapters and link it to your main document. Put your subheadings in your chapter files.

Don't forget to save your chapter files with the .tex file extension.

linking tex files

Referencing Chapters

There are times when you wish to reference one of your own chapters in another chapter. For example, 'I will discuss this in more detail in chapter 4.' To do this in LaTeX each chapter or section must have a unique label. In a large document this can become difficult. A helpful hint is to prefix your chosen label with the shorthand of the object that you are referencing as tables and figures can be referenced in the same way. For example:


Where the reference is required in the text you need to place \ref{label name}. So my above example becomes, 'I will discuss this topic in more detail in Chapter \ref{chp:electro}.' This ensures that if you change the order of your chapters, the numbers will be automatically updated. Very useful!

The references will also be hyperlinked in the PDF allowing readers to jump to that section immediately.

Activity - Give each chapter and section a unique label.

When you compile the document it will need to be compiled twice for all the references to be shown correctly.

referencing chapters

Advanced - Linking from other folders

If you wish to include chapter files from a separate folder then you can input the relative path to the file before its filename.

For example, my chapter files are saved in a folder called Chapters. To include my experimental chapter I now use:


The . says that the Chapters folder is in the same directory as my main tex document. If it is in the directory above use ...