Introduction to LaTeX
Research Methodologies
March 29th, 2021
Dr. Kamran Usman
What is LaTeX?
• LaTeX is pronounced “lay-tech” or “lah-tech,”
not “la-teks.”
• LaTeX is a document preparation system for
high-quality typesetting.
• LaTeX is most often used to produce technical
or scientific documents, but it can be used for
almost any form of publishing.
Why Use LaTeX?
• Designed by academics and easily accommodates academic
use.
• Mathematical symbols and equations are easily integrated.
• Even complex structures such as footnotes, references, table
of contents, and bibliographies can be generated easily.
• Creates more beautiful documents.
• Portable, compatible, flexible, versatile, and cheap (and free)!
Installing LaTeX
• In Windows
• MiKTeX
– MiKTeX is a typesetting system for the Windows.
– Download from www.miktex.org for free
– It is generally recommended to install MiKTeX first,
then an editor of your own choice.
• A text editor
– Such as Texmaker, Winshell, WinEdit (Not free).
– A text editor creates the source file (.tex and others).
– I use Texmaker www.xm1math.net/texmaker/ which
is free.
– WinEdt costs $30 www.winedt.com.
Basic Document Structure
• The format of a document is pretty simple.
– In the preamble
• Documentclass
• Packages
– In the front matter
• Title/author
– In the body
• Contents
– In the back matter
• bibliography
In the Preamble
• You specify your document class.
– Document classes: letter, article, report, book,
slides(beamer, poster)
• \documentclass[12pt]{article}
– Packages: numerous packages are available
• \usepackage[margin=1in]{geometry}
• \usepackage{setspace}
• \usepackage{harvard}
• \usepackage{amsmath, amsfonts,amssymb}
• \usepackage{graphicx}
In the Front Matter
• \begin{document}
• \title{}
• \author{}
• \maketitle
• \begin{abstract}
• \end{abstract}
• \pagebreak
In the Body
• To begin a new section
• \section{}
– Similarly, \subsection{}, \subsubsection{},
\subsubsubsection{}
– LaTeX does automatic numbering. If you don’t like it,
use section*{}
• \emph{}, \textbf{}
• \singlespacing, \doublespacing, \onehalfspacing
• \centering or \begin{centering} & \end{centering}
Footnotes/Quotes/Equations
• \footnote{}
• \begin{quote} & \end{quote}
• ` ’, `` ’’ for quotations
• Mathematical Equations
– Math always in between $ & $
• Alternatively, \begin{equation} & \end{equation}
– $ 1+4=5 $
– \frac{}{}, \sqrt{}, \sum_{k=1}^{n}
– ^{}, _{}
– \greek letters (e.g. \alpha or \Alpha)
Citations
• \cite{bibtexkey}, citeyear{bibtexkey}
• It is more convenient to create a bibliography
file, called bibtex file(.bib) and use it as
needed.
• Most text editors are capable of creating a bib
file, but there are more convenient tools out
there.
• JabRef (http://jabref.sourceforge.net/)
Creating Graphics / Figures
• Including a figure
\begin{figure}[htbp] %[Here Top Bottom Page(of floats)]
\centering %center the Figure
\includegraphics[width=3.0in]{HeNeSetup} %Width and Filename
\caption{Diagram of equipment setup used for the HeNe laser test
experiments} %Caption for the figure
\label{fg:lasertest} %Label name for the figure, use this to reference it later.
\end{figure}
Including Equations
• Including equations
\begin{align}
n_i \sin \theta _i = n_t \sin \theta _t \label{eq:snell}
\end{align}
TABLES
• The code looks complicated
• End result looks very nice
• Very customizable you know the right
commands
TABLES
\begin{table}[htbp]
\centering
\begin{tabular}{||l|cr|}
\hline
col 1 & col 2 & col 3 \\
\hline
\hline
1 & 3 & 5 \\
2 & 4 & 6 \\
\hline
\end{tabular}
\caption{Table Caption}
\label{tab:table_label}
\end{table}
In the Back Matter
• Don’t forget bibliography{filename}
– Make sure that the bibtex file is saved in the same
location where the main tex file is saved.
• Don’t forget end{document}
Common Mistakes
• Often times, you make a mistake when
creating a document. You will notice the log
file reporting a problem.
• There are some common mistakes:
– “end” doesn’t follow “begin”
– $ doesn’t follow $
– Using commands from packages lot defined in the
preamble
– Don’t forget “\”s.
Other Resources
• Books
– Leslie Lampert. 1994. LaTeX: A Document Preparation
System.
– Helmut Kopta and Patrick W. Daly. 2004.Guide to
LaTex
– Frank Mittelbach et al. 2004. The LaTeX Companion
• Online Guides
– http://en.wikibooks.org/wiki/LaTeX
– CV and dissertation templates are available on line
Plotting in Matlab
Research Methodologies
March 15th, 2021
Dr. Kamran Usman
Basic Overview
Legends
Subplots
Subplots
Loading data files