## Creating Your First PDF with LaTeX and Atom

This tutorial will walk you through the steps of creating your first PDF with LaTeX and Atom. This guide focuses on installing LaTeX and Atom on a Mac, but since Atom is a cross-platform editor, most of the instructions should work on Windows and Linux as well. You will need about an hour to download everything and to produce your first PDF.

See our previous tutorials on creating PDFs with LaTeX and SublimeText:

Making your first PDF with LaTeX and Sublime Text 2

Making your first PDF with LaTeX and Sublime Text 2 for Mac

## Install MacTex

Download MacTeX. MacTeX installs everything you need to compile tex files into PDFs. This will take a while, so grab a coffee.

## Install Atom

If you haven’t already, download the awesome Atom text editor Atom text editor. Atom is awesome because it is open source and supported by GitHub.

On my MacBook Pro running Yosemite, I clicked on the “Download For Mac” buttun, then openned the downloaded atom-mac.zip. In Finder, just drag “Atom” to your Applications folder. You can then find Atom in your Applications folder or launch it from Spotlight. The first time you open Atom, press the “Open” button to trust Atom if prompted.

## Install Skim (for previewing PDFs)

LatexTools makes use of Skim for previewing works-in-progress. Download and install Skim. On OS X Yosemite, I installed version 1.4.17.

To make Skim trusted so that the preview will work, open Skim by holding down the control key while clicking on the Skim icon in the “Applications” folder in Finder. Click “Open” at the prompt.

## Install LatexTools

Open the “Settings” tab by pressing Command+ or using the menu “Atom > Preferences…”.

Click on the “Install” tab on the left. Type in language-latex and click the “Install” button in the language-latex package box. I installed version 0.6.1. This package provides syntax highlighting that will make working with TeX much more enjoyable.

Next Type in latextools and install the latextools package.

## Create a tex source file

Create a new file if you don’t already have one up (you should see a tab titled “untitled” if you already have a new file open). To create a new file go to “File > New File” in the menu or use the keyboard shortcut Command+N.

In the new file paste the following TeX sample:

\documentclass{article}
\title{Title}
\begin{document}
\maketitle{}
\section{Introduction}
This is where you will write your content.
\end{document}


Save this file as sample.tex. You should now see that the content is now recognized by the syntax highlighter (see all the pretty colors?).

## Build and view your PDF

To build this PDF, use the following keyboard shortcut: Command+Alt+B (i.e., all three of those keys at the same time). If that doesn’t work, check your keybindings in the “Settings” tab, in the “Keybindings” tab on the left. Type in latextools:build to see what the command for your system is. On a Mac (i.e., “Darwin”) the keybinding should read alt-cmd-b, for Windowss and Linux the default is probably ctrl-alt-b.

## Conclusion

Hopefully now you have your first PDF ready to show off to all your neighbors. If not, let me know in the comments below so I can update the tutorial.

## First Beamer Presentation with LaTeX and Sublime Text 2

This tutorial will walk you through the creation of your first beamer presentation using LaTeX and Sublime Text 2. I will assume you have at least made your first PDF with LaTeX in Sublime Text 2 (Mac-specific setup instructions).

## Create beamer_test.tex

Start by opening Sublime Text 2, and saving a new document as “beamer_test.tex“. On the first line we’ll set the document class to “beamer“:

\documentclass{beamer}

On the next line, type “begin“, then press the TAB key. This should paste the following snippet and place cursors selecting “env” in both the begin and end tags:

\begin{env} \end{env}

Now type “document” so that environment tags look as follows:

\begin{document} \end{document}

## Adding slides (um,… I mean frames)

Frames in beamer presentations are (for our purposes) the equivalent of slides in PowerPoint presentations. To add a frame inside of our document environment, simply type “frame” and press the TAB key (this and the last snippet assumes you have LaTeXTools installed). Go ahead and change “title” to “My First Slide“. Add some content inside the frame (I’m going to add a bulleted list). Your new slide should look similar to the following:

\begin{frame}[t]\frametitle{My First Slide} \begin{itemize} \item My first point \item My second point \item My third point \end{itemize} \end{frame}

Here I added an itemized list, but inside of these frames you can place figures, tables, equations and anything else defined in LaTeX. Ok, now that we have one of the most basic presentations known to man, let’s hit CTRL+B (or COMMAND+B on OS X) to build this presentation (if you get a few font warnings, don’t worry, fixing these is not important). Your finished slide should look like this: Now, I admit, this is a little underwhelming. So, let’s add a title page, make it so the frame content is not top-aligned, and play around with some themes while we’re at it.

What presentation would be complete without a title page. First we need to define the elements of the title page. Paste the following commands between the document class statement and before the beginning of the document environment.

\title[Short Presentation]{The shortest presentation in \LaTeX} \subtitle[title edition]{Now with a title} \author[F. Lastname]{Firstname Lastname} \institute[UIR]{ The University of Irreproducible Results }

Making the title page is pretty easy. Just paste the following frame above the first one we made earlier.

\begin{frame}[plain] \titlepage \end{frame}

Here we replace the frame title and the t (top-align) option with the plain option. Go ahead and build the PDF. Here’s what the first slide should look like:

## Changing alignment

So let’s say you don’t want the frame content vertically aligned to the top. Simply change the “[t]” to “” (or “[b]” if you want it bottom-aligned). You can also remove “[t]” entirely to use the default which is centered.

Time to spice up our rather bland presentation. Hop on over to the Beamer Theme Matrix and pick out a theme. The city names along the side are beamer themes which will go inside a usetheme command and the animal names along the top are color themes which will go inside a usecolortheme command. I’ve chosen beamer theme “Szeged“, and color theme “dove.” Add the next commands between the document class command and the title info we inserted earlier (replace Szeged and dove for themes you chose).

\usetheme{Szeged} \usecolortheme{dove}

## The finished presentation

Here’s what the slides for our completed presentation look like. Here’s the complete source:

\documentclass{beamer} \usetheme{Szeged} \usecolortheme{dove} \title[Short Presentation]{The shortest presentation in \LaTeX} \subtitle[title edition]{Now with a title} \author[F. Lastname]{Firstname Lastname} \institute[UIR]{The University of Irreproducible Results} \begin{document} \begin{frame}[plain] \titlepage \end{frame} \begin{frame}\frametitle{My First Slide} \begin{itemize} \item My first point \item My second point \item My third point \end{itemize} \end{frame} \end{document}

## Conclusion

While this is a presentation short on finesse and content, I hope it helps get you started. Be sure to come back for a follow-up tutorial taking your skills with ST2 and beamer to the next level. In the meantime here are some resources I have found useful:

And here are a few of our tutorials on Sublime Text 2 and LaTeX in general:

## LaTeX Snippets Collection

This post presents snippets that help make paper writing a breeze in Sublime Text 2 (see my earlier post on how to create snippets, this should also help you if you are confused by the overall structure of Sublime Text 2 snippets). Skip to the end of this post to download the snippets. You will need to copy them to your Packages/User folder. You can access this folder in the Sublime Text 2 menu by selecting Preferences > Browse Packages ..., and then selecting the User folder.

# Article Snippet

<snippet>
<content><![CDATA[
\documentclass[12pt]{article}
\usepackage{ctable,microtype,natbib,amsmath,amssymb,fullpage,graphicx}
\usepackage{setspace}
\onehalfspacing

\title{${1:Title}} \author{${2:Author}}

\begin{document}
\maketitle{}

\begin{abstract}
\end{abstract}

\section{Introduction}

## Snippet Breakdown

This snippet provides a basic table using the ctable package.

 caption=${1:Table Title} label=tab:${2:tblname} 

This first section is like a preamble to the table and sets up the title and the label which we can use later in a \ref command to create a reference to the table number (TIP: use the table snippet that comes with Sublime Text 2 to start a reference to a table). Note that the text “Table Title” will be selected first, followed by “tblname“, and finally by “ccc” in the TAB order.

 ]{\${3:ccc}}{ 

This line sets the format of the table to three centered columns.

 \tnote[]{This note does not have a corresponding mark} \tnote[a]{This note does have a mark} 

The third section defines any notes you want to appear at the bottom of the table.

 \toprule ~ & Cooperate  & Defect \\ %\midrule % midrules are useful for tables with a clear heading row Cooperate & (8,8) & (0,10) \\ Defect & (10,0) & (3,3) \\ \bottomrule 

The final section is where you place the table content as you would with the booktabs environment.

# LaTeXTools Snippets

The below snippets are subject to change at the whim of its maker. Check the LaTeXTools readme for notes on the current version. Any updates loaded onto your version of Sublime Text 2 should also load a document summarizing the changes.

## bfigure

This trigger (bfigure) produces the following in your LaTeX document:

 \begin{figure}[tb] \begin{center} \includegraphics[]{} \end{center} \caption{Caption here} \label{fig:figure1} \end{figure} 

Changing

 \includegraphics[]{} 

to

 \includegraphics[width=\textwidth]{filename} 

would place the image “filename” in your document and scale it to the width of the text in your document.

## Keybindings

There are keybindings set to make text bold, italicized, and underlined. To make the selected text bold press CTRL+L then CTRL+B in sequence (you can hold down CTRL throughout this process). For italics the second step is CTRL+E (for emphasis). For underlining the second step is CTRL+U. (For Mac OS X you should change CTRL to CMD)

# Final Notes

You can always change the tabTrigger in these snippets. In fact, it’s a good idea to try typing the trigger I have chosen (or your preferred alternative), and compare it to the current snippets list (accessed in the menu by selecting Tools > Snippets.... This should also show you the snippets loaded by LaTeXTools, which you really should have running (see our previous tutorials here and here). To setup the above snippets, download the following files and copy them to your Packages/User folder. You can access this folder in the Sublime Text 2 menu by selecting Preferences > Browse Packages ..., and then selecting the User` folder.

## Useful LaTeX Packages

This reference introduces you to the LaTeX packages I load using a snippet every time I start a new LaTeX document (using the article document class). Continue Reading

## Making your first PDF with LaTeX and Sublime Text 2 for Mac

Why use LaTeX? LaTeX is the standard typesetting for economists. Equations are easier to type, making citations is a breeze, and your finished paper just looks more beautiful. Continue Reading

## Creating Snippets in Sublime Text 2 for LaTeX

Ever realize you seem to type the same block of text every time you create a new document? If you haven’t already, now is the time to introduce yourself to snippets. In this tutorial we will walk through the creation of snippets in Sublime Text 2 for LaTeX. Continue Reading

## Making your first PDF with LaTeX and Sublime Text 2

This tutorial will walk you through the installation and setup of Sublime Text 2 for working with LaTeX. After installation we will create a simple PDF to make sure everything has been setup correctly. Continue Reading