Document 418

Isolating LaTeX errors

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

If LaTeX can't properly compile your document, you must try to isolate and resolve the error. Then you may need to repair your document. A thorough knowledge of TeX and LaTeX is invaluable in this process.

After LaTeX processing stops, open the .log file to examine the error messages. Compare the .log file to the .tex file. Pay particular attention to any errors that occur in the preamble. Look for

  • Incorrect definition statements.

  • Statements that hide environment changes.

  • Misspelled commands or environment names.

  • Improperly matched or missing braces or delimiters.

  • Improperly using a character with a special meaning in TeX.

  • Missing \end commands.

  • Missing command arguments.

If the error isn't immediately obvious, you may be able to isolate it with this technique:

  1. Make a copy of the .tex file.

  2. Open the .tex file with an ASCII editor and scroll to the area in which the error occurs.

  3. Place a percent sign at the beginning of each line to comment out a portion of the file.

  4. Use the TrueTeX Formatter to compile the document:

    1. From the SWP or SW submenu on the Windows Programs list, choose the TrueTeX Formatter.

    2. Select the file and choose OK.

  5. Repeat steps 3 and 4, commenting out larger and larger portions of the document, until LaTeX handles the document correctly.

    The area that is commented out contains the error.

  6. Beginning from the top of the commented portion of the file, remove the percent signs from several lines of the file.

  7. Recompile the document.

  8. Repeat steps 6 and 7 until you isolate the cause of the failure.

  9. Correct the mistake.

Added 04/05/02; revised 08/22/05

This document was created with Scientific WorkPlace.