LaTeX Setup and Tutorial

Introduction

LaTeX works like this:

First, you use a text editor (we'll be using the freeware Texmaker) to create a LaTeX document.

Now you are ready to download the text editor, Texmaker for Windows.

  1. Go to http://www.xm1math.net/texmaker/download.html
  2. Click on the executable file for Windows, TexMaker 4.3 and follow the instructions for installing.

   Downloading and installing TeXShop for Macintosh OS X

  1. Go to http://www.tug.org/mactex/
  2. Click on MacTeX.pkg to download.  If you have trouble, then click on "mirror page" above and select an appropriate mirror site.  The download will start automatically.
  3. The file to be downloaded is 2.4GB. Be sure to download with fast internet!
  4. Click "install" and follow the prompts.

Creating a simple document using LaTeX with TeXMaker for Windows

Now we're finally ready to write a document in LaTeX. The instructions below will take you through the process of creating a very simple document.
  1. Open: Texmaker from the Start menu.  You may want to put a shortcut on your desktop.
  2. Write: In the upper right box, type this:

\documentclass{article} 
\begin{document} 
Hello universe! 
\end{document}

 

    3.  Save: Save this file as "universe.tex" to whatever directory you choose. Be sure the extension is "tex" and NOT "txt". Also be sure to select "All Files" under the "Save as Type" menu before you save.

    4.  Compile:  Now click on the little "PDFLAT" icon on the toolbar.  You should get a message below the window which reads  "Process Started" "Process exited normally".

    5. View: Now click the PDF icon on the tool bar to view the PDF file.  If the PDF file does not open, check in the directory with the .tex file to see if there is a .pdf file with the same name.  If so, you can click on it from the directory.  If not, then your file did not compile correctly.

 

Texmaker has a special command called "Quick Build".  If you click on the "Q" button to the left of the "Latex" button, Texmaker will show you the log file in the lower window with any errors highlighted in red. First you need to configure Quick Build.  On the menu bar at the top of the screen, click on "Options", then "Configure Texmaker".  Now click the button to the left calls "Quick Build".  Click the button that says "PDF LaTeX + View PDF".  Then "ok".

 

Creating a simple document using LaTeX with TeXShop for Macs

Now we're finally ready to write a document in LaTeX. The instructions below will take you through the process of creating a very simple document.
  1. Find: TexShop under Applications/TeX.  Drag the icon someplace convenient.
  2. Open: Double click the TeXShop icon.  This will open a blank document.  
  3. Write: In thewindow, type this:

\documentclass{article} 
\begin{document} 
Hello universe! 
\end{document}

  

    4.  Compile:  Now click on the  "typeset" icon on the upper left.  You will be prompted to save the file.  Be sure to save it with a .tex (not .txt) extention.

    5. View: A PDF file will automatically pop up with the finished product.  If it doesn't, you can look in the directory with the file and see if a PDF is available, then click on it.  If not, then your file did not compile correctly.

Handling compiling errors

LaTeX is a very picky typesetting program, and a lot of tiny things can cause compiling errors. By following the instructions below you will introduce an error into your universe.tex file and then see how to deal with it.
  1. Change your .tex file so that it looks like this:

     

     
    \documentclass{article}
    \begin{document}
    Howdy universe!
    The & is a special character.
    \end{document}

  2. Now click Typeset and you will get the following error:  "Misplaced alignment tab character &".

     

  3. In LaTeX, the "&" character is used for tabbing (alignment) in certain environments, but it is not a legal character on its own; that is what the first line of the error message above is saying - that the character "&" is being used somewhere it shouldn't. Click "Go To Error" to go to the place where the compiler thinks there is an error in the editing window.

    4.   To fix the problem, you could "comment out" the entire line by placing a % at the beginning of the line.  Try this and click typeset again.

    5.  Or you can do as LaTeX suggests, and put a "\" in front of the &.  Remove the % and try this.

Printing a finished LaTeX document

If you want to print right from the computer you are working on, it's easy; just choose "Print" from the "File" menu of the PDF viewer.  Don't print from the Texmaker window, because you will only be printing the LaTeX code, not the finished product.