Chapter 3 Poject Report Format

3.1 What is LATEX?

LATEX (pronounced LAY-tek or LAH-tek) is a tool used to create professional-looking documents. It is based on the WYSIWYM (what you see is what you mean) idea, meaning you only have focus on the contents of your document and the computer will take care of the formatting. Instead of spacing out text on a page to control formatting, as with Microsoft Word or LibreOffice Writer, users can enter plain text and let LATEX take care of the rest.

3.2 Why learn LATEX?

LATEX is used all over the world for scientific documents, books, as well as many other forms of publishing. Not only can it create beautifully typeset documents, but it allows users to very quickly tackle the more complicated parts of typesetting, such as inputting mathematics, creating tables of contents, referencing and creating bibliographies, and having a consistent layout across all sections. Due to the huge number of open source packages available (more on this later), the possibilities with LATEX are endless. These packages allow users to do even more with LATEX, such as add footnotes, draw schematics, create tables etc.

One of the most important reasons people use LATEX is that it separates the content of the document from the style. This means that once you have written the content of your document, we can change its appearance with ease. Similarly, you can create one style of document which can be used to standardise the appearance of many different documents. This allows scientific journals to create templates for submissions. These templates have a pre-made layout meaning that only the content needs to be added. In fact there are hundreds of templates available for everything from CVs to slideshows.

3.3 Writing your first piece of LATEX

The first step is to create a new LATEX project. You can do this on your own computer by creating a new .tex file, or else you can start a new project in Overleaf. Let’s start with the simplest working example:

\documentclass{article}

\begin{document}
First document. This is a simple example, with no
extra parameters or packages included.
\end{document}

The first line of code declares the type of document, known as the class. The class controls the overall appearance of the document. Different types of documents will require different classes i.e. a CV/resume will require a different class than a scientific paper. In this case, the class is article, the simplest and most common LATEX class. Other types of documents you may be working on may require different classes such as book or report.

After this, you write the content of our document, enclosed inside the \begin{document} and \end{document} tags. This is known as the body of the document. You can start writing here and make changes to the text if you wish. To see the result of these changes in the PDF you have to compile the document. To do this in Overleaf, simply hit Recompile. (You can also set your project to automatically recompile when you edit your files, by clicking on the small arrow next to the ’Recompile button and set ’Auto Compile to ’On.)

In the previous example the text was entered after the \begin{document} command. Everything in your .tex file before this point is called the preamble. In the preamble you define the type of document you are writing, the language you are writing in, the packages you would like to use (more on this later) and several other elements. For instance, a normal document preamble would look like this:

\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc}

As said before, this defines the type of document. Some additional parameters included in the square brackets can be passed to the command. These parameters must be comma-separated. In the example, the extra parameters set the font size (12pt) and the paper size (letterpaper). Of course other font sizes (9pt, 11pt, 12pt) can be used, but if none is specified, the default size is 10pt. As for the paper size other possible values are a4paper and legalpaper.

3.4 Adding a title, author and date

To add a title, author and date to our document, you must add three lines to the preamble (NOT the main body of the document). These lines are

\title{First document}

This is the title.

\author{Hubert Farnsworth}

Here you put the name of the Author(s) and, as an optional addition, you can add the next command within the curly braces:

\thanks{funded by the Overleaf team}

This can be added after the name of the author, inside the braces of the author command. It will add a superscript and a footnote with the text inside the braces. Useful if you need to thank an institution in your article.

\date{February 2014}

You can enter the date manually or use the command \today so the date will be updated automatically at the time you compile your document With these lines added, your preamble should look something like this:

\documentclass[12pt, letterpaper, twoside]{article}
\usepackage[utf8]{inputenc}

\title{First document}
\author{Hubert Farnsworth \thanks{funded by the Overleaf team}}
\date{\today}

Now that you have given your document a title, author and date, you can print this information on the document with the \maketitle command. This should be included in the body of the document at the place you want the title to be printed.

\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

\end{document}

3.5 Bold, italics and underlining

We will now look at some simple text formatting commands.

• Bold: Bold text in LaTeX is written with the \textbf{...} command.

• Italics: Italicised text in LaTeX is written with the \textit{...} command.

• Underline: Underlined text in LaTeX is written with the \underline{...} command.

We will now look at how to add images to a LATEX document. On Overleaf, you will first have to upload the images.

Below is a example on how to include a picture.

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {images/} }

\begin{document}
The universe is immense and it seems to be homogeneous,
in a large scale, everywhere we look at.

\includegraphics{universe}

There's a picture of a galaxy above
\end{document}

LATEX can not manage images by itself, so you will need to use a package. Packages can be used to change the default look of your LATEX document, or to allow more functionalities. In this case, you need to include an image in our document, so you should use the graphicx package. This package gives new commands, \includegraphics{...} and \graphicspath{...}. To use the graphicx package, include the following line in you preamble: \usepackage{graphicx}

The command \graphicspath{ {images/} } tells LATEX that the images are kept in a folder named images under the current directory.

The \includegraphics{universe} command is the one that actually included the image in the document. Here universe is the name of the file containing the image without the extension, then universe.PNG becomes universe. The file name of the image should not contain white spaces nor multiple dots.

3.7 Captions, labels and references

Images can be captioned, labelled and referenced by means of the figure environment as shown below:

\begin{figure}[h]
\centering
\includegraphics[width=0.25\textwidth]{mesh}
\caption{a nice plot}
\label{fig:mesh1}
\end{figure}

As you can see in the figure \ref{fig:mesh1}, the
function grows near 0. Also, in the page \pageref{fig:mesh1}
is the same example.

There are three important commands in the example:

• \caption{a nice plot}: As you may expect this command sets the caption for the figure. If you create a list of figures this caption will be used there. You can place it above or below the figure.

• \label{fig:mesh1}: If you need to refer the image within your document, set a label with this command. The label will number the image, and combined with the next command will allow you to reference it.

• \ref{fig:mesh1}: This code will be substituted by the number corresponding to the referenced figure.

When placing images in a LATEX document, we should always put them inside a figure environment or similar so that LATEX will position the image in a way that fits in with the rest of your text.

3.8 Creating lists in LATEX

Lists are very simple to create in LATEX. You can create lists using different list environments. Environments are sections of our document that you want to present in a different way to the rest of the document. They start with a \begin{...} command and end with an \end{...} command.

There are two main different types of lists, ordered lists and unordered lists. Each will use a different environment.

3.8.1 Unordered lists

Unordered lists are produced by the itemize environment. Each entry must be preceded by the control sequence \item as shown below.

\begin{itemize}
\item The individual entries are indicated with a black dot, a so-called bullet.
\item The text in the entries may be of any length.
\end{itemize}

By default the individual entries are indicated with a black dot, so-called bullet. The text in the entries may be of any length.

3.8.2 Ordered lists

Ordered list have the same syntax inside a different environment. We make ordered lists using the enumerate environment:

\begin{enumerate}
\item This is the first entry in our list
\item The list numbers increase with each entry we add
\end{enumerate}

As with unordered lists, each entry must be preceded by the control sequence \item, which will automatically generate the number labelling the item. The enumerate labels consists of sequential numbers starting at one.

3.9 Basic Formatting

We will now look at how to write abstracts, as well as how to format a LATEX document into different chapters, sections and paragraphs.

3.9.1 Abstracts

In scientific documents it’s a common practice to include a brief overview of the main subject of the paper. In LATEX there’s the abstract environment for this. The abstract environment will put the text in a special format at the top of your document.

\begin{document}

\begin{abstract}
This is a simple paragraph at the beginning of the
document. A brief introduction about the main subject.
\end{abstract}
\end{document}

3.9.2 Paragraphs and newlines

\begin{document}

\begin{abstract}
This is a simple paragraph at the beginning of the
document. A brief introduction about the main subject.
\end{abstract}

Now that we have written our abstract, we can begin writing our first paragraph.

This line will start a second Paragraph.
\end{document}

When writing the contents of your document, if you need to start a new paragraph you must hit the “Enter” key twice (to insert a double blank line). Notice that LATEX automatically indents paragraphs.

To start a new line without actually starting a new paragraph insert a break line point, this can be done by \\ (a double backslash as in the example) or the \newline command.

3.9.3 Chapters and Sections

Commands to organize a document vary depending on the document type, the simplest form of organization is the sectioning, available in all formats.

\chapter{First Chapter}

\section{Introduction}

This is the first section.

Lorem  ipsum  dolor  sit  amet,  consectetuer  adipiscing
elit.   Etiam  lobortisfacilisis sem.  Nullam nec mi et
neque pharetra sollicitudin.  Praesent imperdietmi nec ante.
Donec ullamcorper, felis non sodales...

\section{Second Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisissem.  Nullam nec mi et neque pharetra
sollicitudin.  Praesent imperdiet mi necante...

\subsection{First Subsection}
Praesent imperdietmi nec ante. Donec ullamcorper, felis non sodales...

\section*{Unnumbered Section}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisissem

The command \section{} marks the beginning of a new section, inside the braces is set the title. Section numbering is automatic and can be disabled by including a * in the section command as \section*{}. We can also have \subsection{}s, and indeed \subsubsection{}s. Note that \part and \chapter are only available in report and book document classes.

To create the table of contents is straightforward, the command \tableofcontents does all the work for you.