# Wiki: LaTex

Basic LaTex Syntax Reference
by Oliver; Jan. 13, 2014

## Introduction

Microsoft Word sucks. LaTex, a markup language, is a more programmatic way of typesetting documents. It produces pretty results and it's free to download here. There's a great introduction to LaTex at: One thing to note about LaTex: it's rather finicky, at least for beginners like me. As markup languages go, I find it a lot harder to use than, say, HTML. If you're using it for the first time, writing something will involve scouring lots of chat forums.

This wiki is a collection of miscellaneous LaTex syntax I want to remember—so you know what to expect, it's more a reminder to myself than a carefully crafted article. I'm a firm believer in the basics and that's what you'll find here.

## Document Classes

The documentclass command sets a template for your document. Quoting directly from http://en.wikibooks.org/wiki/LaTeX/Document_Structure, some document classes are:
 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. minimal Is as small as it can get. It only sets a page size and a base font. It is mainly used for debugging purposes. report For longer reports containing several chapters, small books, thesis, ... book For real books. slides For slides. The class uses big sans serif letters. memoir For changing sensibly the output of the document. It is based on the book class, but you can create any kind of document with it [1] letter For writing letters. beamer For writing presentations (see LaTeX/Presentations).

## Example Document: Hello World

This is a bare bones first document:
\documentclass[letterpaper,10pt]{report}
\usepackage[margin=0.75in]{geometry}
\begin{document}

Hello Word

\end{document}


This is a comment in LaTex:
% comment


## Font Size

Font size from https://engineering.purdue.edu/ECN/Support/KB/Docs/LaTeXChangingTheFont:
• \tiny
• \scriptsize
• \footnotesize
• \small
• \normalsize
• \large
• \Large
• \LARGE
• \huge
• \Huge

## Font Styling

To style fonts in bold and italic:
\textbf{This is bold}
\textit{This is italic}


## Making Lists

To make a list:
\begin{itemize}
\itemsep -1.5em
\item first\\
\item second\\
\item third\\
\end{itemize}


## Indentation

Turn indentation on or off:
\noindent
\indent


## Horizontal Line

Draw a horizontal line:
\noindent\rule{17cm}{0.4pt}\\


## Page Numbering

Remove page numbers:
\pagenumbering{gobble}


## Linking to URLs on the Web

\usepackage{hyperref}
\urlstyle{same} % keeps link style same as rest of document

\begin{document}

\url{http://www.nytimes.com}
\href{http://www.nytimes.com}{New York Times}

\end{document}


## Compiling LaTex Documents from the Command Line

Compile a .tex file from the command line to produce a .pdf:
\begin{itemize}
\itemsep -1.5em
\item Fluent in the present tense\\
\end{itemize}

\end{document}

It produces:

## Example Document: A Book of Lyrics

Here's some partial code for a book of musical lyrics typeset in LaTex:
\documentclass[letterpaper,10pt,twocolumn]{report}
\usepackage[margin=0.75in]{geometry}
\usepackage{multicol}
\usepackage{graphicx}
\setlength{\columnsep}{1in}
\begin{document}
\noindent
\title{Lyrics}
\maketitle
\newpage
\tableofcontents
\clearpage

\raggedright

\subsection*{Someone Like You}

\textbf{Chords G G/F\# Em C}\\

I heard that you're settled down\\
That you found a girl and you're married now.\\
I heard that your dreams came true.\\
Guess she gave you things I didn't give to you.\linebreak

...\newpage

\section*{Etta James}