### Writing a thesis with LaTeX

##### [ Monday, 21 January 2008, TLu ]

A dissertation is composed of two elements: the content and the form. The author is certainly the person best qualified to speak about the content. We, however, will focus on the form. We are going to see how to get a fine composition with low time expenditure using LaTeX.

Author: Tomasz Łuczak

### Is writing in LaTeX really worth it?

Certain universities, faculties or departments ventured to formalize the typesetting requirements of a thesis. Writing a dissertation in LaTeX enables us to adjust the graphical composition to the requirements irrespective of the content. The separation of form and content notably facilitates the task of working on the matter of the thesis. The graphical composition can be defined immediately with a shipped class (there are premade dissertation classes available) or chosen at the end.

The table of contents, figures or literature will all be created by the computer. The automatic numbering of annotations and quotations or sorting the references is also a task for the program. All that is left for us is to write the content since we will satisfy the remaining requirements at the end.

### Structure

Every dissertation has a similar layout:

Title page
Acknowledgments and dedications
Statement of authorship
Table of contents
Introduction with the following chapters
Table of figures
Table of charts
Bibliography

The first few pages are usually precisely defined and that is where we shall need to adjust the composition to the requirements.

As we have mentioned before, we do not have to bother with creating the indexes. We just need to choose or define our own style sheet to be used to generate the bibliography.

LaTeX provides us with some ready-made commands to divide the text into logical structures like chapters, sections, paragraphs, enumerations or footnotes. Taking advantage of these commands enables us to change the form of each structure globally, in the entire document.

### Let’s start writing

Our advisors usually expect us to present the progress of our work in the subsequent chapters. Let’s begin with the content.

For our convenience it is advisable to divide the text into several separate files: the title page and preliminary pages, the introduction, chapters and conclusion. Consequently, we will be working on a smaller part of the text at a time. If our chapters are voluminous we may want to divide them into subchapters as well.

The resulting main document includes the above files via the \include{file} command. A change in any of the separate files will be reflected in the main document every time it is compiled.

If, however, our text is not especially long or if we do not find working on a large file particularly troublesome we may decide to keep it as a single file.

### The main document

The thesis will presumably contain several chapters and therefore the most suitable class for our case will be ‘book’. The title page and preliminary pages will be left for the dessert in the title.tex file.

For a start all we need is a table of contents, which can be inserted with the \tableofcontents command.

If we use charts in the text and a list of tables is required then we can insert it with the \listoftables command.

The main document will have the following structure:

% set sans-serif headings, paper format,
% font size and the main class
\\documentclass{sfheadings,a4paper,11pt}{book}
% set encoding
\\usepackage{latin1}{inputenc}
\\begin{document} % Let's go!
\\include{title}
\\tableofcontents
% \\lisoftables
\\include{introduction}
\\include{chapter1}
\\include{chapter2}
\\include{conclusion}


### Introduction and the following chapters

Introduction is the part that is being read the most often, so obviously it should be well written. As for the typesetting, it is one of the easiest sections, since it usually contains just plain text without charts or figures.

Sections and chapters can be numbered or not numbered. The default is numbered, so if we want to exclude a section from the numbering we need to add an asterisk to the command.

For example, the introduction is an un-numbered chapter comprised of one or more paragraphs. We can insert it with the \chapter*{Introduction} command.

The chapters of our thesis, on the other hand, should be numbered, so we should begin our chapter’s file with, for example, the \chapter{Mathematical Model}command

The text in chapters can be divided into sections and subsections with the \section, \subsection and \subsubsection commands respectively, for example: \section{Process Identification}.

### Spacing

Monosyllable conjunctions at the end of a line are generally not desired and should be gotten rid of. LaTeX does not move them to the next line automatically so we need to instruct it by inserting non-braking spaces between the conjunction and the following word. A non-braking space is simply a tilde “~”, for example “so~it”.

Double spaces are not particularly appealing, either. In this case, however, TeX knows what to do and no matter how many spaces we type it will render just one. A mark ending a line is also considered to be a space.

The feature of adding a comment is also remarkable. A line beginning with “%” is treated as a comment and is not being processed. Therefore

We can write	as we like
no matter what TeX will
compile the text %look! a comment!
the right way
with~one character   spacing between the words.


An empty line — that is, two newline characters — marks an ending of a paragraph and a beginning of a new one.

### Enumerations

LaTeX supports three kinds of enumerations: numbered, not numbered and description. The first two are the ‘enumerate’ and ‘itemize’ environments which we know already. The last one is a variant of the not numbered enumeration. In this case, a description is used instead of a symbol. Each enumeration begins with the item command.

Numbered enumeration:
\\begin{enumerate}
\\item One
\\item Two
\\item Three
\\end{enumerate}

Not numbered enumeration:
\\begin{itemize}
\\item One
\\item Two
\\item Three
\\end{itemize}

Description enumeration:
\\begin{description}
\\item[Iron] -- an element
\\item[Steel] -- an alloy
\\item[Caffe latte] -- a mixture
\\end{description}


### Horizontal lines.

The keyboard allows us to enter only two types of dashes directly — a hyphen and an underscore. LaTeX, however, delivers the following horizontal lines:

hyphen: "-" to join words, i.e daughter-in-law
en-dash: "--" to join digits, i.e 1937--2007
em-dash: "---" to denote a pause, i.e yes --- or no?
underscore to join file names: "_"


In practice, we use just the hyphen and en-dash; mathematical expressions are a good material for a separate article.

### Fonts and sizes

To write in bold font we need to use the \textbf{text-in-bold} command; to write in sans-serif font there is the \textsf{sans-serif-text} command; italics can be enabled with the \textit{text-in-italics} command, and finally \textsl{caps} renders the text in small caps.

A word of advice: underlining text should be avoided because it makes the text more difficult to read by crossing the parts of glyphs descending below the baseline. The custom of underlining text dates back to the times of typewriters which had just one typeface. Likewise, the text should not be highlighted with bald font since a black element in a grey rectangle of text draws readers’ attention and disturbs the rhythm of reading.

### References in the text

Frequently in a thesis we refer to some other part of it, for example a chart or a figure. In order to refer to any place, we need to label it. In labels’ names, spaces and diacritical marks should not be used. Preferably, a label should contain only Latin letters, digits and dashes. A label can be inserted with the \label{fig_1} command.

A label inherits the information from the environment that precedes it. Placing a label just behind the name of a section or chapter will show its number in the reference. Analogically, placing it behind a caption of a figure will show the figure’s number in the reference. A reference to a label can be inserted with the \ref{fig_1} command.

TeX processes our file sequentially, so in order to get the references rendered properly we need to compile the document twice. During the first processing TeX will generate the numbers of all the chapters and captions; in the second one it will place correct references where necessary. Rendering a table of contents also requires double compilation.

### Footnotes

Frequently we need to place a footnote under the main flow of text or at the end of the document. In that case, we need to place a footnote with \footnote{footnote-content} command.

### Summary

The number of “spells” needed to write a thesis, excluding figures, charts, bibliography and mathematical expressions, is just a few commands. It is not much work, considering that a text created with LaTeX can be given directly to our advisor and the time expenditure to create a visually appealing composition is minimal.

In the next article we will finish writing the dissertation and we will describe how to insert tables, figures, a bibliography and how to prepare the preliminary pages of our work.

You can download an example dummy thesis from our server: Thesis in LaTeX [examples, tar.gz]. It is properly divided into small tex files for better granularity.

This text is based on the article published in Dragonia Magazine, a Polish online magazine about Free and Open-Source Software. You can download the latest Dragonia issue (first one in English from our mirror). The article has been slightly modified compared with the original version by the PolishLinux team.

Translated by Jan Misiak, Proof-read by Jake Conroy

## About the Author

#### Tomasz Łuczak

TeaM-TL developer, Dragonia Magazine's editor, TeX and Tcl/Tk enthusiast. Lives in Katowice, Poland.

## RSS: Comments

You can follow the comments to this article through a special channel RSS 2.0 .

more »