Errors, Lists, and Lines


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.


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).

 


Lists

There are basically three types of lists in LaTeX:

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.


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.


     \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 [ ].
\begin{description}
\item[Toves] are something like badgers
-- 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.


     `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). Alternatively, you could use \noindent


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.


     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.


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

Go to Quotations, Large Documents and Footnotes
Return to LaTeX Tutorial Home Page