# Finding errors and warnings

Finding errors and warnings

### Errors

Errors and warnings can be the most frustrating part of using LATEX. Your LATEX compiler will give you some help. The compiler will first tell you what it thinks the error was, then what it did, if anything to fix the problem, and finally it will tell you the line the error occurred on and where on the line the error occurred. All of the information written to the screen will also be placed in a file called filename.log.

The most common errors are mismatched braces (curly braces, dollar signs, etc.), misspelled command names, and trying to use math only commands outside of math mode. Below are some sample errors.

\documentclass{article}
\begin{document}
If you forget to enter a math environment and type x^{2}, you will get an error. If your dollar signs and curly braces don't match, like this $x^2}, you will get an error. Also if you misspell the \latex\ command, you will get an error. /end{document} And here is the document with the errors corrected. \documentclass{article} \begin{document} If you forget to enter a math environment and type$x^{2}$, you will get an error. If your dollar signs and curly braces don't match, like this$x^{2}\$, you will get an error. Also if you misspell the \latex\ command, you will get an error.
/end{document}

If LATEX encounters an error while running, there are several things you can do. You can type H for some additional help. If you have misspelled a command name, you can type the letter I, then press enter and LATEX will prompt you to insert the correct spelling. Another option is to type E, to edit your file. If you find you have cascading errors you may want to type R to run without stopping, or Q to run quietly. Both R and Q do the same thing, except if you type R LATEX will continue to display errors on the screen. No matter which option you choose, you will be able to see all the errors in the filename.log file. Finally you can type X to cancel the typesetting.

### Warnings

Warnings are less common than errors. One common warning is a warning that the "Label(s) may have changed. Rerun to get cross-references right." This warning occurs because LATEX finds labels and references the first time a document is compiled, then updates the reference the next time it is compiled. This warning can be fixed by typesetting the document without making any additional changes to the file.

The second most common warning is caused when LATEX cannot find a good place to break a line. LATEX likes to make all the lines and pages the same length, if LATEX cannot do so you may see a warning that says Overfull or Underfill \hbox or \vbox. Overfull occurs when lines or pages are too long, and Underfill when they are too short. The error will contain \hbox if it is a line that is too long or short, and \vbox if it a length problem with a page. The simplest way to fix this problem is to reword the text around the offending line or page. If the problem is mathematics and not text, you may need to use the eqnarray environment.