Crash Course in LaTeX

Getting Started: Your First Document

Want to create a document? Fine.

Take a look at a blank document by clicking here. Actually, the document has one word in it: Howdy! Erase that one word, and you have a nice, blank document.

sample_blank.tex
Okay, it's not that blank, but it is pretty simple. The line with \documentclass is always the first line of a latex source file, and it specifies generally what kind of document you're typing, like an article or a book. Between that and the \begin{document} is the header. This is where you put commands that affect the entire document. After that is the body of the document. This is where you type the text that will show in the document.

Comments: Anything after a % on a line is not read by LaTeX and will not show in the final document. You can use this to provide comments, little notes to yourself.

Download this file by clicking here. Save it somewhere you want to keep LaTeX files.

Basic editing: Open it using your editor. Change the word "Howdy!" to something else. Save the file.

Compiling: If you are using WinEdt, click the LaTeX button on the toolbar. If you are using UNIX, open a command shell (looks like a DOS prompt), go to the directory where you saved the file, and type:

   latex blank.tex

Either way, a bunch of text will roll by. You now should have a file named

   blank.dvi

in the same directory.

Viewing: In WinEdt, click the view DVI button in the toolbar. This will bring up Yap, the DVI viewer that comes with MiKTeX, and load your shiney new .dvi file. In UNIX, bring up another command shell and type

   xdvi

Then you can browse to the file blank.dvi to open it.

Printing: This is a boring document, but you can print it easily. Windows users will use Yap to print -- there is a printer icon on the toolbar. You do not print from WinEdt! Printing from WinEdt will print out your source file, not the pretty compiled .dvi file. UNIX users type

   dvips blank

to print the document.

Compile and View in one step: You can combine these steps easily. In WinEdt, click the bear: TeX bear. In UNIX, I believe the command is texify but I haven't used it myself.

What now? Take a look at the samples. Try writing your own documents. Use the references on the left under "Basics" to see how to format and structure your document, add math symbols and equations, creates lists and footnotes, tables.

Then start workin' it with packages, drawing pictures, inserting graphics, floats, bibliographies, tables of contents and indices, references wiothin the document, making your own commands, storing your commands in your own style files, making PDFs, posters, and Web pages from LaTeX source, and even integrating your R code in Sweave files.

For more complete information, check out the references on the left and/or buy a good book like A Guide to LaTeX.