# Errors, Lists, and Lines

(URL http://www.cs.cornell.edu/Info/Misc/LaTeX-Tutorial/Errors.html)

# Tracking Down LaTeX Errors

There are many errors and combinations of messages you can get when you latex an input file. These are probably the most common.

## Over/Underfull hbox

When you get an "overfull hbox" error message, it usually means that a word is too long. The solution is to rework the text and shorten the word. With most over/underfull hbox errors, LaTeX continues processing.

Consider the following input file:

     When {\em I} use a word,'' Humpty
Dumptysaidinratherascornfultone,itmeansjust
what I choose it to mean --
neither more nor less.''


When you latex the file, you will get the following error:

     Overfull \hbox (23.24313pt too wide)
in paragraph at lines 3--7
[]\twlrm When \twlit I \twlrm use a word,''
Humpty Dump-ty-said-in-ratheras-c
orn-ful-tone,itmeansjust


Note that the position of the error in the file from the error message.

Correct the text in overfull.tex to get rid of the "Overfull \hbox" error.

and here's the dvi output.

When you get an "Underfull \hbox" message, it means that there is too much empty space in a line. The solution is to rework the to remove the blank space. LaTeX keeps processing.

## Runaway Arguments

A runaway argument occurs when there is a missing brace defining some limit. The solution is to fix the text. Often, LaTeX will just issue a warning ("end occurred inside a group at level 1") and keep processing. Sometimes, LaTeX stops and prints a "?". Note that if you get the "?" prompt, you can do one of two things that are easy. You can just press return and LaTeX will continue processing. Be sure to preview the document to make sure that there are no obvious problems. You can also simply enter an "x" at the prompt to stop LaTeX processing.

Consider the following input file:

     It certainly was a {\em very large
Gnat: about the size of a chicken,''
Alice thought.  Still, she couldn't
feel nervous with it, after they had
been talking together so long.


When you latex the file, you will get the following error.

     (\end occurred inside a group at level 1)
Output written on runaway.dvi (1 page, 500 bytes).


LaTeX processes the file anyway. Here's the dvi output. To correct the text, just add the missing } to limit the italics.

Correct the text in runaway.tex to add the missing brace after "very".

and here's the dvi output.

# Lists

There are basically three types of lists in LaTeX:

• enumerated (1, 2, 3, ...) - \begin{enumerate}
• itemized ("bullets") - \begin{itemize}
• descriptions - \begin{description}

All lists in LaTeX have the same general format:

\begin{list type} 
\item List entry
\item Next List entry
\end{list type}

Any time a \begin{operator} ... \end{operator} construct is used in LaTeX, the text inbetween is said to be in the "operator" environment. For example, text that begins with \begin{enumerate} and ends with \end{enumerate} is in the "enumerate" environment.

## Enumerated Lists

An enumerated list is a numbered list. LaTeX will automatically keep track of the numbering of the list if you decide to add or subtract an item from the list.

Create a numbered list that looks like the following. The text is in the file name.tex which is already in your latex directory.

1. "My name is Alice, but - "
2. "It's a stupid name enough!" Humpty Dumpty interrupted impatiently. "What does it mean?"
3. "Must a name mean something?" Alice asked doubtfully.
Here's the dvi output.

## Itemized Lists

An itemized list is a bulleted list. The input format is exactly like that of enumerate only the list type is itemize, as in the following example. Here are the output results.

     \begin{itemize}
\item That's a great deal to make one
word mean,'' Alice said in a thoughtful tone.

\item When I make a word do a lot of
work like that,'' said Humpty Dumpty,
I always pay it extra.''

\item Oh!'' said Alice.  She was too much
puzzled to make any other remark.
\end{itemize}


## Description Lists

Description lists are contained within a description environment, just as enumerated or itemized lists are. However, a description list has both a term and a description, so some method of distinguishing the two is necessary.

The description term follows the \item command and is bounded by brackets [ ]. Consider the following example which produces these results.

     \begin{description}
-- they're something like lizards --
and they're something like corkscrews

\item[Gyre] to go round and round like
a gyroscope

\item[Wabe] the grass-plot round a
sun-dial, which goes a long way
before it, a long way behind it, and
a long way beyond it on each side
\end{description}


Note that there is no space between the \item command and the brackets.

# Lines

There are several LaTeX commands to manipulate lines. Some have to do with line placement; others have to do with margins and breaking lines.

## Breaking lines

Use a double backslash to break a line in a specific place. Consider the following example, which yields these results.

     Twas brillig, and the slithy toves \\
Did gyre and gimble in the wabe; \\
All mimsy were the borogoves, \\
And the mome raths outgrabe.


Note that the above must be in the flushleft environment to prevent LaTeX from indenting the first line as if it were a paragraph (see \begin{flushleft} below).

Modify the file break.tex to take out the backslashes, and preview it to see the result. Then add back the backslashes, only this time add one to the last line as well. Preview it to see the result.

## Centering Lines

To center lines, LaTeX has a center environment. In the following example, the lines between the \begin{center} and the \end{center} commands will be centered. Here are the formatted results.

     Alice felt that in that case she really {\em ought}
to listen to it, so she sat down, and said
Thank you'' rather sadly.
\begin{center     In winter, when the fields are white,
I sing this song for your delight --
\end{center}
only I don't sing it,'' he added, as an
explanation.


Notice in the formatted document that the poetic lines are centered, but they don't break to create two separate lines more like the input file text.

Use the file poem.tex as a skeleton to create a document which is like the one above, but with the line breaks done correctly.

Here's the dvi output.

## Justification

There are several LaTeX environments to control the way the margins appear in a document.

     \begin{center} ... \end{center}
\begin{flushright} ... \end{flushright}
\begin{flushleft} ... \end{flushleft}


The declarations for the above environments are shown below. These can be used at the start of the body to make them effective for the entire document. Be sure to put the declaration right after the \begin{document} at the top of the body.

     \centering
\raggedleft
\raggedright


Use the file down.tex as a start to create a document without a justified right margin. Do this by both using the \begin{flushleft} environment and without using the \begin{flushleft}`environment.

Here's the flushleft dvi output, and here's the other dvi output. If these are not identical, something is wrong.

Go to Quotations, Large Documents and Footnotes