# Writing with LaTeX (2/5): Installation & Resources.

Now that you have a sense of why $\LaTeX$ could be useful, we will move straight to practice.  It’s easier to make sense of $\LaTeX$ when you’ve seen it in action, so theory will come in the next part.  This post helps you get $\LaTeX$ up-and-running (for MacOSX and Windows), and points out resources when things are not happening the way you think it should.

### Installing LaTeX

Thanks to a generous community of developers, $\LaTeX$-related content is free (as in both beer and speech), and available on Windows, MacOSX, and Linux in simple, ready-to-go installations.  These installations usually include the typesetting engine, a graphical interface, commonly used packages (and uncommon one!), and utility programs (e.g., to support bibliography preparation).  You can find links to the major distributions on the $\LaTeX$-project page (Windows users may also be interested in checking out the MikTeX implementation.)  The screenshots in the rest of series are taken with TeXShop and BibDesk, part of the MacTeX implementation.

### Your First LaTeX Document (MacOSX 10.6)

MacTeX is installed just like any other OSX application.  The full version is rather large (1.3Gb), so if you’re not convinced about $\LaTeX$ yet, you’ll want to install the basic version.  After installation with the default settings, you’ll find a new group under Applications called TeX.  It is within here that the front-end programs live.

Launching TeXShop will give you a new (blank) window (or you can open one from File):

A is where you’ll be typing your manuscript, which are processed by the $\LaTeX$ engine after you click B (assuming C displays “LaTeX” – more on this later).  D and E are useful pull-downs to simplify the writing task; e.g., one-click macro insertion of figure instead of typing the long instructions.

For our first document, let’s drag down on E, and select the “LaTeX template”.  This should populate the window with the default LaTeX document (without the yellow boxes).  Notice the different colors you have here: black is content, red are comments, and blue are LaTeX instructions (preceded by a backslash \).

And when you hit “Typeset” (B), it’ll ask you where to save the file.  My recommendation is to save every manuscript in its own folder, as the typeset process generates clutter (“auxiliary files”).  I also recommend saving with a filename that has no spaces (e.g., “my_first_tex” as opposed to “my first tex”): spaces and \write18 stuffs are incompatible (more on this in Part 5).

Once the file is saved, a new window will pop up…

What happens here is that your “my_first_tex.tex” file is given to the typesetting engine ($\LaTeX$), and the front window explains to you step-by-step what the engine is doing.  If something does not compute (ha-ha), this is where you will find error messages.  The right window is the .pdf output (pdf is the default output in this environment).  Congratulations!  You’ve typeset your first $\LaTeX$ document.  We will build upon this in Part 3, but for now, you can scroll past the Windows instructions and look at some of the resources available for TeX.

### Your First LaTeX Document (Windows)

Here is a step-by-step procedure for getting your first document to write on MikTeX.  Here the screenshots come from Win-XP, using MikTeX 2.8 basic installer (which gives false positive certificate failures).  This should introduce a new program group as in figure below.  TeXworks is what we’re launching here.

TeXworks launches with a blank document (nothing in A), and we will ask it to open up a blank template by clicking on File (B) – New Template:

We’ll choose the basic article.tex template for our first document.  Notice that it opens looking incredibly dull and gibberish-like – what we want to do is to color the content, comments, and LaTeX instructions differently.  We can do that by clicking on Format (C), and selecting syntax coloring -> LaTeX.

Now content is in black, comments are red, and LaTeX instructions are in blue (preceded by backslash \).  Make sure you have the “pdfLaTeX” selected at D, and click typeset (E).  That give your input file to the typesetting engine, and you can see the processing happening in the output window (a little box of the same window with green text).  This little window is where you will find error messages later as well (you can make it show all the time: Window -> Show Output Panel).  A .pdf file then opens up… congratulations!  You have your first $\LaTeX$ typeset document:

### Resources & Help

While this series of post will give you a graphical (and short) introduction to $\LaTeX$, you will likely need to visit elsewhere for a full education on LaTeX.  A very good, more-or-less comprehensive resource to get started with is thenot so short guide to LaTeX, which covers typesetting math, non-English language, etc.. Andy Roberts have a series of excellent tutorials as well.

Among reference books, the LaTeX companion by Mittelbach describes (external) packages available, and is handy to have around.

Many common stumbles have been asked, and can be found on mailing list archives (Google-able).  Try searching with the error messages in your output panel in quotes.  The Comprehensive TeX Archive Network (CTAN) has lots of goodies that you can look through as well, including a list of Frequently Asked Questions.