Tutorial Letter 103/0/2015: Research Support Tools DSC4810 Year Module
Tutorial Letter 103/0/2015: Research Support Tools DSC4810 Year Module
Year module
Bar code
university
Learn without limits. of south africa
DSC4810/103/0
Contents
1 Introduction 3
2 Essential commands 3
3 Page layout 4
4 Title page 5
6 Lists 7
7 Mathematics 8
9 Final remarks 9
2
DSC4810/103/0
1 Introduction
This tutorial letter consists of a hands-on tutorial for students who have never work in LATEX before. The
aim is to give step-by-step instructions in order to build up the necessary basics needed to type documents
using this software.
To benefit from this tutorial, I suggest that you follow the instructions carefully and type the inputs in
TEXStudio as you go along. Type the necessary inputs in your own document, while creating appropriate
sections and adding suggested packages in the preamble. In the end you will have a working document
outline that you can use for typing your assignments.
2 Essential commands
No LATEX document will ever compile without the following basic commands:
\documentclass{article} %It can also be book, thesis, etc.
(PREAMBLE)
\begin{document} %Here your text begins
(TEXT)
\end{document} %Here you text ends
In the preamble (between the \documentclass{} and \begin{document} commands) information needed
to format the document correctly is entered. The body of the document (text) is typed between
\begin{document} and \end{document}.
Start a new document TEXStudio1 , type these three commands and some text in the document part. Save
it in an appropriate folder as something like FirstDocument.tex.
The following is an example of such input in TEXStudio:
Now click on the Build and View icon to compile this code. You should get the following PDF2 output:
This shows LATEX’s default style for paragraphs, namely to indent the first line and entering no space between
the paragraphs. For technical reports that contain mathematics, figures and tables, this style may produce
untidiness around such objects. We therefore prefer the style with no indentation and an open line between
paragraphs.
Luckily the style package parskip does exactly that. To activate this package, we specify it in the preamble
with the command \usepackage{parskip}, so our input source code becomes the following:
1
Other text editors like TEXmaker, TEXnicCenter, etc can also be used, but since you received instructions to install
TEXStudio, we will show detail regarding it.
2
Please see TL102 for instructions to configure TEXStudio correctly.
3
DSC4810/103/0
Note that there is no linebreak (\\) after the first paragraph — only an open line. An extra linebreak would
result in too large a space between the paragraphs.
This source code results in the following output (showing the left margin):
As you can see, the width of the text is narrower than we would expect and the margin is quite wide. This
is due to the default page size, namely the letter size that is used in the USA. We will address this problem
in the following section.
3 Page layout
In SA we use A4 sized paper which is different from the default letter size that is used in the USA. We
therefore need to specify our paper size as a4paper as an option of the \documentclass{} command, That
is \documentclass[a4paper]{article}.
The a4paper option only specifies the physical paper size that is used and has no effect on the layout of the
text. The smaller layout dimensions of letter size paper will be used by default and we need to set the width
of margins and/or the width and height of the text by using some appropriate package, like geometry.
The geometry package enables the user to set page layout details for a document, like margins, position of
headers and footers, text height and width, etc. For example, if we want our pages to have margins of 2.5 cm
all round, we can add the command
\usepackage[margins=2.5cm]{geometry}
to the preamble. The input source code is now the following:
4
DSC4810/103/0
Note: The paper and font size options can also be specified as options with the geometry command. For
instance, the command \usepackage[a4paper,fontsize=11pt,margins=2.5cm]{geometry} specifies A4
paper size, 11pt font size and margins of 2,5 cm.
4 Title page
The first page of a report or assignment should be a title page showing information about the work, such as
details of the author (name, student number, etc.), the title of the project, the module name and code, the
department and the date that the document was compiled.
For this module, we require a simple title page showing this information centred on the first page. This
is created by using the \maketitle command, which must be preceded by the commands \title{...},
\author{...}. In the article document style the current date will be added automatically.
We do not want the page number to show on this page and omit it by using the command
\thispagestyle{empty} directly before or after the \maketitle command (before the page break).
To create a title page for your document, an example of the source code is the following:
Note that we show only the relevant part of the source code in figures to come.
When this is compiled, the title page will contain (only) the following:
5
DSC4810/103/0
4. The \newpage command after \maketitle ensures that only the title appears on the first page.
5. The front page is part of the document (page 1) and numbering should continue normally from here.
In a report or dissertation one should always organise the document in a logical way by using sections and
subsections. This enhances the flow of such a document and the section numbers and headings, as well as the
page numbers where they appear, are shown in the table of contents when the \tableofcontents command
is entered.
In the following source code a table of contents is created and sections are added.
6
DSC4810/103/0
6 Lists
Many packages have been created to enhance basic LATEX. One such package is paralist that provides
alternative options for creating lists using the enumerate and itemize environments. When you insert
\usepackage{paralist} in your preamble, you can change the style of bullets or numbering and elimi-
nate space between items by using the compactenum or compactitem environments.
The following source code creates the enumerated lists with different numbering shown in the output next
to it.
Note:
1. The numbering style is specified only once after the \begin{enumerate} command.
2. No linebreaks (\\) are inserted after items. LATEX controls the spacing and it should not be altered.
3. The brackets around the roman numbers and the letters represent one style that may be chosen. One
may also choose to use only a right bracket to number as i) ii) . . . or a) b) . . . , as long as the chosen
style is used consistently throughout the document.
The following source code creates bulleted lists with different bullet styles shown in the output next to it.
Note: You can change the default style for first order bullets in your document by inserting the command
\defaultitem{$\triangleright$}{}{}{} (for triangles) or \defaultitem{$\star$}{}{}{} (for stars) di-
rectly after \begin{document}.
To create lists with no space between the items, we use the compactenum and compactitem environments.
7
DSC4810/103/0
The following source code creates such compact lists, as shown in the output next to it:
7 Mathematics
Since TEX was designed for typing mathematics, the default commands for creating mathematical expressions
and symbols are adequate for typing most mathematical documents. However, when mathematics becomes
more complicated, containing unusual symbols, etc, it may be helpful to know where to find it.
For this purpose we use packages developed by the American Mathematical Association, namely the amsmath
and amssymbol packages. Documentation on these packages are available on myUnisa under Additional
Resources.
For instance, amsmath provides the align environment where \begin{align}...\end{align} is used to
create aligned, numbered arrays and \begin{align*}...\end{align*} to omit the numbers.
Furthermore, the intertext{} command is used to insert text at the left margin, while the alignment stays
intact. Also, reference to equations is in the correct format with the use of \eqref{}.
For example, the following source code using the align environment and the intertext command:
produces the following output, which is the correct way to write mathematics:
The third equation has been labelled with \label{eq3} and to refer to it, we simply type \eqref{eq3} to
get the reference as equation (3).
One can also use the align* environment to type groups of equations. For instance, the source code
\begin{align*}
x&=y & X &=Y & a&=b+c\\
x’&=y’ & X’&=Y’ & a’&=b\\
x+x’&=y+y’ & X+X’&=Y+Y’ & a’b&=c’b
\end{align*}
8
DSC4810/103/0
Note: With cases one doesn’t need to type the large curly bracket, specify the number of columns or specify
the width of spaces.
It is customary to use double-struck capital letters for number systems. For example, R denotes the real num-
bers and we type it as $\mathbb{R}$. Likewise, Q denotes rational numbers which we type as $\mathbb{Q}$.
Such mathematical symbols and many others that one might need to type, like *, ≪, X, z, ≨, etc are
available in the amssymb package.
In TL102, Paragraph 5 on page 28, the creation of tables and figures are discussed in detail and we will not
repeat it here. It is, however, important to activate the packages mdwtab for tables and graphicx for figures.
9 Final remarks
After having completed this tutorial, you should now have the following basic preamble available to use for
your assignments in this and other honours modules in the department:
This contains the required elements that you need, which can be extended by adding more packages or
creating your own newcommands (see TL102, page 10).
May you enjoy typing beautiful documents in LATEX!