Department of Mathematics

Math 300: Mathematical Computing

Basic LaTeX

LaTeX is a markup language. The "tags" of the markup language are identified by starting with a backslash ( \ ), i.e. every LaTeX command or variable starts with a backslash. As with other markup languages, every LaTeX document has a preamble section and a body section. Unlike most other markup languages with which we are familiar, there are many commands in LaTeX that do not require, or even possess, closing tags.

In any computer language, it is common to make one's first application a so-called "Hello, world!" program. Such a document in LaTeX follows.

% Any text following a percentage sign is ignored - a comment
Hello, world!

This is a second paragraph.

The structure of a basic LaTeX document is evident. The file must begin by declaring the class of the document - the "article" class here. Other possibilities include "book", "thesis", and "letter". Following that are preamble commands, which pertain only to formatting and new command structures. The body of the document begins with the "\begin{document} statement. Any text that is not preceded by a backslash actually appears on the formatted page.

Note that the blank line in the body of the document makes a new paragraph. It is very important to watch blank lines - starting a new paragraph can generate errors if it is done e.g. in the middle of an equation.

Note also that there are several special characters that cannot be used in an ordinary way. They include \, _ ^, {, }, &, #, ~, %, and $. If you actually want one of these characters to appear in your document, you must enter them as \backslash, \_, \^, \{, \}, \&, \#, \~, \% and \$, respectively. Some of these characters are only valid in math mode, or require some extra tricks to manage.

Assignment C is posted.

The test solution is available.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2015 Kevin Cooper