You are on page 1of 21

Beginners

LaTeX Workshop
Andrew Conant & Abdalla Abou Jaoude
January 26th, 2015

What is LaTeX?
Document preparation system for publication of scientific
documents
TeX language
Not a word processor, but can be used in place of
Microsoft Word
Philosophy is to leave formatting to the compiler and
content to the user

How does it work?

TeX input

LaTeX editor

LaTeX compiler

PDF Output

LaTeX Implementation System


(Compiler)
Provides the tools necessary to prepare a TeX document
Can install missing packages automatically
Most popular is MikTeX

Only for Windows


TeX Live for Linux
MacTeX for Mac
Download here

LaTeX Editors
Popular LaTeX Editors
TeXmaker
TeXstudio
TeXworks
AUCTex
TeXnicCenter
Notepadd ++
Comparison of editors

TeXmaker

Starting a LaTeX document


\documentclass[options]{class}
{class} = {article}, {report}, {book}, {letter}
[options] = [10pt] [11pt] [12pt], [a4paper] [letterpaper],
[twocolumn]

\usepackage[option]{package1}
\begin{document}

\end{document}

Installing Packages
\usepackage{package name}
Should do it automatically with MikTeX
But if not

Commonly Used Packages (more


here)
Package
Description
Name
abstract

must have to include abstract

amsmath

advanced math extensions

array

fixes some bugs and allows you can create very complicated and
customized tables

booktabs

provides extra commands as well as behind-the-scenes optimisation


for producing tables

geometry

easy management of document margins and the document page


size

graphicx

allows you to insert graphic files within a document

multicol

provides the multicols environment which typesets text into


multiple columns

secsty

help change the style of any or all sectional headers

Title and Abstract

\title{Fun with LaTeX}


\author{Andrew Conant}
\date{put date here} or \date{\today}
\maketitle

\begin{abstract}

\end{abstract}

Sectioning

\section{}
\subsection{}
\subsubsection{}
\tableofcontents
Can use \hrule and \bigskip to separate it with horizontal lines

Text Formatting

Blank line between paragraphs will indent second paragraph


\\ at the end of a line will not indent next paragraph
\textbf{bolded text}
\textit{italicized text}
\textcolor{declared-color}{text}
Predefined colors: white, black, red, green, blue, cyan, magenta, yellow
% denotes comments
You are allowed to use tabs

Numbered Lists

\begin{enumerate}
\item First item here
\item Second item here
\end{enumerate}
Can nest in each other for outlining
\begin{itemize} for bulleted lists

Figures

\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{file_name.png}
\caption{Insert caption here}
\end{figure}
**Must be in the same directory as your .tex file**
\label{fig:coolgraph}
\ref{fig:coolgraph} will grab the figure number and put it in the text

Tables
\begin{table}[position specifier]
[h] = here, [t] = top of page, [b] = bottom of page, [!] = places it where you
want it

\begin{tabular}{| l | c | c | r |}
Left justified (l), center justified (c), right justified (r)
| makes a vertical line that separates the columns
1 & 2 & 3 \\

5 & 6 & 7 \\
\hline inserts a horizontal line in between rows

Tables (continued)

\multicolumn{number}{*,l,c,r}{text}
\multirow{number} {*,l,c,r}{text}
Excel2LaTeX will convert Excel data to TeX table
\caption{name of table}
\label{tab:cooltable}
\ref{tab:cooltable} will grab the figure number and put it in the
text

Equations
$ x + y = z $ places equation inline
$$ a + b = c $$ places equation in new line, automatically
centered
\begin{eqnarray}
Places equation in new line and numbers it
Can put multiple equations but only reference the first one

Equations (continued)
Exponents (^) and subscripts (_)
x^2 is x2 but x^10 will read as x10 you must use x^{10}
\sigma_{abs}
\frac{numerator}{denominator}

\left( this will be inside parentheses \right)

Multiple Columns
\usepackage{multicols}
\begin{multicols}{2}
\setlength{\columnsep}{1cm}

Miscellaneous Commands
Equations

Text

Sectioning

\pm = plus-minus

\&, \$, \#, \%

\begin{titlepage}

\leftarrow, \rightarrow

\begin{quote}

\pageref{marker}

\sqrt{}, \sqrt[n]{}

\uppercase{}

\pagebreak

\overrightarrow{} (vector)

\tiny, \small,
\large, \huge

\int_{low bound}^{high bound} \indent, \noindent

Useful Links

Unofficial Reference Manual


Essential LaTeX
Wikibooks
Google!

Questions?