0% found this document useful (0 votes)
101 views35 pages

Introduction To Latex

The document provides an introduction to LaTeX, covering what LaTeX is, how to install it, the basic structure of LaTeX documents, common document classes and packages, and how to include titles, sections, lists, labels, references, tables and more.

Uploaded by

grnc0d3r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views35 pages

Introduction To Latex

The document provides an introduction to LaTeX, covering what LaTeX is, how to install it, the basic structure of LaTeX documents, common document classes and packages, and how to include titles, sections, lists, labels, references, tables and more.

Uploaded by

grnc0d3r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Introduction to LaTeX

Eleni Akrida
 A typesetting system used to produce
professional looking documents.

 Particularly good at handling mathematically


oriented manuscripts.
What is Latex?
 Can be used to produce a variety of document
types, including presentations, articles and
reports.

 LaTeX is also good for management of a


bibliography.

2/35
 The machines in the university already have various
LaTeX editors and compilers installed on them.

 For installation on your own machine you should


Installation consult the following links:
 MiKTEX Website: http://miktex.org/

 TeXworks Website: http://www.tug.org/texworks/

 TeXnicCenter Website: http://www.texniccenter.org/

3/35
 The area between
\documentclass{...} and
\begin{document} is called
the preamble. It normally
contains commands that
affect the entire document.
Structure
 After the preamble, the text
of your document is enclosed
between two commands
which identify the beginning
and end of the actual
document.

4/35
 LaTeX needs to know the
type of document the author
wants to create.

Document  class specifies the type of


document to be created.
Classes
 The options parameter
customizes the behaviour of
the document class

5/35
 LaTeX allows the user to
specify a range of different
document classes, these are
some of the more common
Document ones you will most likely use.

Classes
 The most common options
for the standard document
classes are listed on the next
slide.

6/35
Document
Classes

7/35
 You can enhance the
capabilities of LaTeX using
packages.

 These packages are defined


in the preamble section of
the document.
Packages
 Package is the name of the
package.

 Options are a list of keywords


that trigger special features
in the package (options are
not always necessary).

8/35
A comprehensive list of packages and documentation for them can be
found: http://www.ctan.org/

Here are some of the more commonly used packages that you may find
useful:

 \usepackage{amsmath} – most important for math environments


(\align)
Packages  \usepackage{graphicx} – essential for inserting figures
(\includegraphics)

 \usepackage[a4paper]{geometry} – adjust margins of a certain page

 \usepackage{hyperref} – makes citations “clickable” in the .pdf


document

9/35
 The double backslash (\\) is
the command for a forced
\title{Title Here} line break.
\author{Eleni Akrida\\
Department of Computer  The \texttt command
Science,\\
formats the e-mail address
University of Liverpool\\ using a mono-spaced font.
Title Page \texttt{akridel@Liverpool.
ac.uk}
}  The \today command is used
to insert the current date.
\date{\today}
\maketitle
 To omit the date simply leave
the braces empty.

10/35
 Appears at the top of the
\documentclass{article} main body of the document,
but before the other sections.
\begin{document}
\begin{abstract}
Abstract Here is where you would
write some nice abstract.
 Available for the article and
report document classes, not
\end{abstract} the book class.
\end{document}

11/35
 Sections can be used to help
structure a document to
make it more readable.
\documentclass{article}
\begin{document}
\section{Introduction}  Think of these like chapters
or section headings.
Some text here…
\section{PhD aims}
Sections \subsection{The model we
study}
 Text placed in the brackets
will appear as headings on
\subsubsection{Model the document.
Variations}
\subsection{Preliminary
results}  Sections are also useful when
\end{document}
creating a contents page.

12/35
Once you have your sections set up correctly you can then include a
table of contents in your work. To do this simply insert the following
command where you would like your contents to appear in the
document.
\tableofcontents

TOC, LOF, LOT You are also able to include a list of figures or tables that you have
specified in the document in a similar way using the following
commands.

\listoffigures
\listoftables

13/35
Bulleted List Description List
\begin{itemize} \begin{description}
\item Item 1 \item[First] Item 1
\item[Second] Item 2
\item Item 2 \item[Second] Item 3
\end{description}
\end{itemize}

Lists Numbered List Nested Lists


\begin{enumerate} \begin{enumerate}
\item Item 1
\item Item 1 \begin{enumerate}
\item Nested item 1
\item Item 2
\item Nested item 2
\end{enumerate} \end{enumerate}
\item Item 2
\end{enumerate}

14/35
 You can label and reference
your sections and pretty
\section{Hello} much any object in your
\label{sec:hello}
document using the \label
Labels and Hello! command.
Referencing \section{Referencing}
Now we can refer to
section~\ref{sec:hello}.  You can give a page reference
in a similar way by using the
~\pageref{marker} command.

15/35
 The table spec argument tells LaTeX
the alignment to be used in each
column and the vertical lines to
\begin{tabular}[pos]{table spec} insert.

Tables …table here…

\end{tabular}  The optional parameter pos can be


used to specify the vertical position
of the table relative to the baseline
of the surrounding text.

16/35
Here is a list of basic commands that can be
used in the tabular environment:
The following symbols are available to
describe the table columns (some of them
require that the package array has been
loaded):

Tables
You can use the following letters for the
pos option:

17/35
Tables Basic table example 1:

18/35
Tables Basic table example 2:

19/35
Tables Basic table example 3:

20/35
Tables Basic table example 4:

21/35
 Make sure to enable the
amsthm package.

\usepackage{amsthm}  Define the theorem in the


preamble.
\newtheorem{name}{printed output}
 The first argument is what you
…title, begin main body…
will use to reference your
theorem.
Theorems \begin{name}
…some text…
\end{name}
 The second argument is the
output LaTeX will print
…end main body whenever you use it.

 For more information on


Theorems in LaTeX visit:
http://en.wikibooks.org/wiki/La
TeX/Theorems

22/35
There are a number of different methods used to define pseudo code in
LaTeX, below is an example using the algorithm2e package but more can be
found at http://en.wikibooks.org/wiki/LaTeX/Algorithms
To use the algorithm2e package you must declare it in the preamble with
the following command:
\usepackage{options}{algorithm2e}

Algorithms

23/35
There are two basic types of
formulas that can used in LaTeX.

For more complicated formulas The first is inline formulas. These


you should use the following types of formulas are the
package: simplest to include are defined
and displayed in the text you
\usepackage{amsmath}
type.

Maths Inline example:


The second are displayed
$a + b = c$ formulas. These are separate
from the main text.

Displayed example:
$$a + b = c$$ For greater depth on either of
these visit
http://en.wikibooks.org/wiki/LaT
eX/Mathematics

24/35
Basic symbols:
+ - = ! / ( ) [ ] < > | ' :

Beyond these special


commands must be used in the
form of \command where you
want to display the symbols or
functions.
Maths
There are many different
commands, a comprehensive
list can be found at
http://en.wikibooks.org/wiki/La
TeX/Mathematics#List_of_Mat
hematical_Symbols

25/35
Using the double $ symbol to create displayed style equations
sometimes produces issues when compiling. Therefore it is best to
use the \equation environment.

This environment will automatically number your equation so that it


is easier to refer to it in your main body of text where someequation
is the name you would give your equation and then refer to it that
Advanced way in the text as shown below.

Maths

26/35
Sometimes you may need to use the cases environment is you want
to write piecewise functions as shown below.

Advanced If you want to add sub- or superscript in summation style symbols with
both prime and a limit to a symbol, one have to use the \sideset
Maths command as shown here.

There is virtually an unlimited number of combinations that you can put


together. More on this can be found here:
http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics

27/35
 Must use the graphicx
package to import
images.

\usepackage{graphicx}  Use \includegraphics


command in your text
to import the image.
\includegraphics{image.png}

Graphics  Many customisation


\includegraphics[scale=0.5]{image.png}
options available.
\includegraphics[width=2.5cm]{image.png}

 For more customisation


visit
http://en.wikibooks.org/
wiki/LaTeX/Importing_G
raphics

28/35
If you want to draw your own diagrams directly in LaTeX you will need to
use a specialist drawing package like TikZ.

More on this can be found here


http://en.wikibooks.org/wiki/LaTeX/PGF/TikZ
Or http://paws.wcu.edu/tsfoguel/tikzpgfmanual.pdf
Or http://www.texample.net/tikz/examples/
Graphics

29/35
\begin{figure}[placement specifier]
... figure contents ...  To create a figure that
\end{figure} floats, use the figure
environment.

 The placement specifier


Figures parameter exists as a
compromise, and its
purpose is to give the
author a greater degree
of control over where
certain floats are placed.

30/35
 You can create captions for
your figures using the
\caption command.
\begin{figure}[h!]

Figures … figure here …


\caption{caption here}
\end{figure}  For more on figures visit
http://en.wikibooks.org/wiki/
LaTeX/Floats,_Figures_and_
Captions

31/35
 There are two main ways to include a bibliography in your work.

 You can store them in an external BibTeX file and then link to them
via a command to your current document. This way you can create
Bibliography a file of your references that you can simply link to them when you
need. For more information on this method visit www.bibtex.org

 However for single documents it is much simpler to embed the


references in the file itself.

32/35
 Place all of your references in
separate \bibitems.
\begin{thebibliography}
{99}
 Then place all of these inside
\bibitem{Akrida16}
of thebibliography
Eleni Akrida. environment.
Bibliography Introduction to LaTeX.
\emph{Doctoral Training  Usually placed at the bottom
Seminar Series}, 2016. of the main body of your
document.
\end{thebibliography}

 Refer to the item in your text


by typing ~\cite{Gorry13}

33/35
When writing a document for publication either in conference proceedings
or a journal it is important to make sure your document is formatted
according to the publishers standards.

Each publisher has their own set of rules and templates that you must use, a
few of the more common ones can be found here:
Formats  http://www.ieee.org/conferences_events/conferences/publishing/templat
es.html
 https://www.acm.org/publications/submissions/latex_style
 http://www.acm.org/sigs/publications/proceedings-templates

34/35
 Learning LaTeX is best achieved through doing.

 Google is very useful when using LaTeX

 Compile your PDF frequently as this will help debug any


errors that may occur.

Tips  If you can, let LaTeX position things like tables and figures
automatically.

 Error messages are easy to understand, you just need to


take the time to read them.

 Templates: http://www.latextemplates.com/

35/35

You might also like