Go to the previous, next section.

Basic LaTeX commands

LaTeX understands three basic document styles: report, article, and letter. Many add commands to LaTeX, but some are whole document-changing styles. The major difference between the report and article styles is that reports can have chapters and sections but articles can only have sections. The letter style, of course, formats letters.

The following is an example of the most basic LaTeX commands:

\documentstyle{report}
\begin{document}

Mares eat oats and does eat oats and little lambs eat ivy.

\end{document}

These commands tell LaTeX what kind of document the file is, where the document starts, and where the document ends. Every text file that is to go through LaTeX must contain these commands.

The only variable parts of this example are the actual document style and the text inside the document.

The text inside the document can be formatted in many ways. To produce a simple document, you might want to know about the commands to produce the following elements:

To produce a chapter title (which starts a new page) in the report style, include the following command after the \begin{document} command:

\chapter{name}

To produce a section heading in either the report or article styles, include the following command:

\section{name}

In both situations, when LaTeX finds the command, it formats name according to what the document style dictates, affecting the type style and size of name and the spacing around it.

Another thing LaTeX does when it finds the command is put the word "Chapter" or "Section" and a number in front of the chapter title or section heading. To prevent LaTeX from numbering the chapters and sections, include an asterisk (*) between the command and the curly brackets ({}) that enclose the name, as in the following example:

\section*{A Lovely Day}

The chapter titles and section names in this manual are examples of what the report style produces without an asterisk. The LaTeX Manual explains how to have additional levels of section headings in the report and article styles.

LaTeX has the ability to handle footnotes in a wide variety of ways. To produce a footnote, you need to place the following command after the text you wish to footnote:

\footnote{ text }

where text is the text that will be the footnote. There are several different ways to format you footnote. You can number the footnotes or just use symbols. See the LaTeX Manual for more information.

LaTeX has several styles and sizes of type available. The LaTeX Manual provides a complete list. To produce italicized text, type the following:

{\it text}

Replace text with the text you want to be italicized. For example, the command {\it \LaTeX\ Manual} produces the italicized manual title that appears throughout this section.

To produce bold-faced text, type the following:

{\bf  text}

Replace text with the text you want to be bold faced. For example, the {\bf This is bold face.} command produces the following text:

This is bold face.

The following list shows the characters latex has special meanings for (in the left column) and the command you must put in your file to get latex to produce each character (in the right column):

Character
What to type
#
\\#
$
\\$
%
\\%
&
\&
{
\{
}
\}
_
\_ or \$\underline{~}\$
|
$|$ or $\mid$
<
$<$
>
$>$
^
\^{}
~{}
\~{}
\
$\backslash$

Go to the previous, next section.