Arnold - Math 475, Fall 2007
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.
- Then, you run a LaTeX compiler (we'll be using MiKTeX).
- Finally, you need to use some kind of viewer/previewer (we'll be using Yap,
which stands for "Yet Another Previewer") to view or print the formatted file.
You will do everything from the program Texmaker, which will
utilize MiKTeX and Yap. This document will take you through the steps of
downloading, installing, configuring, and working with MiKTeX and Texmaker.
Be sure to follow ALL of the directions below, IN ORDER.
Downloading and installing MiKTeX
- Go to www.miktex.org.
- Choose the "miktex 2.5" link from the Download/Install menu
on the left (NOT the "Status" menu).
- Click on "Download Basic MikTeX Installer".
- Now click on "Download" on any of the mirror sites.
- If it doesn't work, click on the link at the top of the page. If
you have spyware protection on your pc, you may need to click on the bar
at the top of the page to allow the download.
- Now click "Run" (or click save, save the installer to the
desktop, and then double click the icon).
- Windows will ask "Unknown publisher, install anyway?".
Click "run".
- The Setup wizard will now open. Click the box "I
agree" and keep clicking "next" until the setup is
complete. Don't change any of the defaults.
- At the end, click close.
Now you are ready to download the text editor, Texmaker.
- Go to http://www.xm1math.net/texmaker/index.html
- Click on "Download" at the top of the page.
- Now click under the appropriate platform. If you are using windows,
click on Executable file for win32 systems : texmakerwin32_install.exe
- Now click "Run" (or click save, save the installer to the
desktop, and then double click the icon).
- Windows will ask "Unknown publisher, install anyway?".
Click "run".
- The Setup wizard will now open. Click the box "I agree"
then click "install" and keep clicking "next" until the
setup is complete. Don't change any of the defaults.
- At the end, click close.
Creating a simple document using LaTeX
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.
- Open: Texmaker from the Start menu. You may want to put a shortcut on
your desktop.
- 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
"Latex" icon on the toolbar. You should get a message below the
window which reads "Process Started" "Process exited
normally".
5. View: Now click the lion icon on the tool bar to
bring up Yap.
Texmaker has a special command called "Quick Build". If you
click on the 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.
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.
- Change your universe.tex file so that it looks like this:
| \documentclass{article} |
| \begin{document} |
| Howdy universe! |
| The & is a special character.
|
| \end{document}
|
- Save universe.tex and try to compile it (steps 3 and 4 above). If you hit
the "Latex" button, it will say "Process started",
"Process exited with errors". But if you hit the "Quick
Build" button, you will get the error message in the window below
"Misplaced alignment tab character &".
- 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. The
"l.4" at the beginning of the next line of the error message tells
you that the error is on line 4 (it says "lowercase ell dot four"
not "one dot four" at the beginning of the line). Notice also that
the line breaks where the compiler thinks your error might be: at the
"&" character.
4. To fix the problem, you could "comment
out" the entire line by placing a % at the beginning of the line. Try
this and compile 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 Yap viewer.
Don't print from the Texmaker window, because you will only be printing the
LaTeX code, not the finished product.
If you want to print from a computer that does NOT have LaTeX installed (or
is you want to send your file to someone who does not have LaTeX installed, but
needs to see your beautiful typeset file), do the following: Instead of clicking
the "Latex" button, click the PDFLaTeX button to the right. This
creates your document as a .PDF file. Then either click the Adobe button
to view the file, or click on the file itself in the directory. Now you
have a file that you can print on almost any computer.
Thanks to Laura Taalman for assistance with this document.