# LaTeX Resources

## Document Classes

Most popular Document Classes used in LaTeX are:

 article For articles in scientific journals, presentations, short reports, program documentation, invitations, ... report For longer reports containing several chapters, small books, thesis, ... book For real books. letter For writing letters. slides For slides. The class uses big sans serif letters. IEEEtran For articles with the IEEE Transactions format. beamer For writing presentations

Most of the publishers have their own class files which could be downloaded from their websites.

## Sectioning

Sectioning is a very important part to the BODY of any report/article. The mark-up commands to divide your report/article into sections are:

 Command Level \part{.} 1 \chapter{.} 2 \section{.} 3 \subsection{.} 4 \subsubsection{.} 5 \paragraph{.} 6 \subparagraph{.} 7

Level here means the level of precedence. A part contains multiple chapters, a chapter might have multiple sections and so-on.

• None of these sectioning commands could be used in '\documentclass{letter}'

• '\chapter{.}' can only be used in '\documentclass{book/report}'

## Spacing

LaTeX compiler ignores the extra spaces and treats them as a single space. For instance typing:

"This is my    first LaTeX    file"

will generate

"This is my first LaTeX file".

In case you want to force spacing between words, '~' could be used. e.g.:

"This is my ~~~ first LaTeX file"

will generate

"This is my     first LaTeX file".

## Structure of a .tex File

• Text files used in the text editors must be saved with an .tex extension else the output (PDF) will not be generated.
• The .tex file contains texts and mark-up commands (usually contains '\' and '{}'). The compiler understands these commands and generates the output file accordingly.

The basic structure of a .tex file is as follows:

Preamble

• The preamble is the first section of an input file, before the text of the document itself, in which you tell LaTeX the type of document, and other information LaTeX will need to format the document correctly.
• It includes
• Document class - \documentclass{options}[class] - It helps LaTeX in  identifying the type of documet to be created. The class paramater specifies the type of document and the options paramater customizes the behavior of the document. The class parameters can be found under the Document Class section on this page.
• Packages - \usepackage{options}[package] - Packages enhance the capabilites of LaTeX in areas where basic LaTeX cannot solve the problem. The package parameter is the name of the package and the options paramter prompts special features in it.

Front Matter

• This section includes infromation about the document itself such as title, date and author information.
• It comes before the actual content of the document. It includes self explanatory commands such as \title{}, \date{} etc.
• The \maketitle commad has to be used for the title page to be generated in the document.

Body

• After defining the document class and creating the title page, next job is to put in the required content. All the mathematical notations, text styles, figures, tables, abstract, etc. are included in this section.

Back Matter

• This section usually includes the bibliography of the document.

## Environments

• An environment provides extra formatting commands that enables local customization. The syntax for an environment in LaTeX is:

\begin{environment_name}

...

\end{environment_name}

•  There are many environments available in LaTeX each with a different format. e.g.,
• abstract - Creates an abstract
• center - Centrally aligns the text
• figure - Add an image
• and many more...

## Things to Remember

• In any .tex file never forget to include the following commands:

\documentclass{.}

\begin{document}

....

\end{document}

• The compiler cannot generate an output file unless it knows what type of document needs to be generated (\documentclass{.}). Everything after \begin{document} and before \end{document} is compiled by LaTeX compiler. In case you forget either of these, the compiler will not know where to start and where to end.

## Special Characters

There are some special characters which have a particular meaning to the compiler. They cannot be used directly while writing .tex file as it would confuse the compiler. Here are those symbols:

#, $, %, &, ~, _, ^, \, {, } In order to use these special printing characters, a '\' is required before them \#, \$, \%, \&, \~, \_, \^, \backslash, \{, \}

'\' cannot be put before '\' to print '\' in the output file because '\\' again has a special meaning (newline)

University of Cincinnati Libraries

PO Box 210033 Cincinnati, Ohio 45221-0033

Phone: 513-556-1424