Auburn University Libraries LibGuides

# Introduction to LaTeX

## Getting Started

To use LaTex, you'll need a LaTeX editor. For this workshop, we'll use Overleaf, a free online editor.

Register with Overleaf to get started:

1. Go to www.overleaf.com.

2. Login, or register in one of the methods available.

3. Click on the green button 'New Project'.

4. Choose 'Blank Project' and give your project a name.

## Document Structure

LaTeX allows the writer to focus on content, not format. Formatting decisions are controlled by commands at the beginning of the document. In Overleaf, you see the content and commands on the left side of the screen and the output on the right side of the screen. To see changes in the content, click the green 'Recompile' button.

In your new project, Overleaf has provided the beginnings of a document:

\documentclass{article}
\usepackage[utf8]{inputenc}

\title{A LaTeX Practice Article}
\author{weisbel }
\date{November 2018}

\begin{document}

\maketitle

\section{Introduction}

\end{document}

The first line of code is known as the class and determines the formatting. Here are a few different types of classes:

 article For articles in scientific journals, presentations, short reports, program documentation, invitations, ... IEEEtran For articles with the IEEE Transactions format. proc A class for proceedings based on the article class. report For longer reports containing several chapters, small books, thesis, ... book For real books. slides For slides. The class uses big sans serif letters. letter For writing letters. beamer For writing presentations.

Try changing the parameter in \documentclass{ ... } to see different formats.

The first part of your document (everything before \begin{document}) is known as the preamble. This is where the document is formatted and information such as author, title, and date about the document is recorded. Try changing the author and date:

\author{John Doe}

\date{\today}

Packages give users access to formatting for advanced features such as mathematical expressions, graphics, bibliographies, and tables. Packages should be added in the preamble before the \begin{document} command:

For example:

\usepackage{xcolor}

(This package allows users to add colors to documents.)

## Basic Commands

A command in LaTeX tells the compiler what to do. The structure of a LaTeX command is

\command[optional parameter]{parameter}

For example:

\begin{block}

\includegraphics[height=1.4cm]{AUL.jpg}

This text is in \textbf{bold face}.

In Overleaf, commands are green, so they're easy to distinguish from plain text.

## Math Mode

LaTeX was originally created to facilitate typesetting mathematical expressions and it is still one of the strengths of LaTeX. If you are planning to use write any sort of mathematical expressions, consider adding the AMS (American Mathematical Society)-LaTeX package to the preamble of your document. It will give you access to additional commands and more advanced formatting:

\usepackage{amsmath}

Math mode begins and ends with a backslash, followed by a parenthesis:

$$x + y = z$$

You will sometimes see a dollar sign used in place of the backslash-parenthesis combination but the dollar sign is an older construction:

$x + y = z$

LaTeX formats mathematical expressions in standard math formatting; for instance, variables are italicized and spacing is appropriate for math. As a rule, switch to math mode when you come to something that is not a word and stay in math mode until you encounter the next word (or punctuation). For example:

The value of $$x$$ is $$n + 7.$$

For common mathematical constructions, see the documentation at Overleaf: https://www.overleaf.com/learn/latex/Mathematical_expressions