Basics: Errors While Compiling
What do you do if you get an error when compiling?- Read the screen, especially toward the end of the output. You can usually tell where the error occured, and often you can see what the error is.
- Press x (the X key) and press enter. This will close the compiler and let you get back to editing the document source. You may have to do this a couple of times.
- Correct the mistake you made and try again.
Tips for avoiding errors:
- Compile often. If you catch an error after typing a single paragraph, you know the error is in that paragraph. If you wait to compile after typing a page, the error could be anywhere on that page -- much harder to find.
- Glance at what you've typed before you compile. Some errors are easy to spot.
Common errors:
- Misspelling commands. Oh yeah. This is numero uno, my friend.
- Starting an environment and forgetting to end it.
- Forgetting to put \ before a command. For example, typing alpha instead of \alpha inserts the text alpha into your equation instead of the nice greek letter you wanted.
- Leaving a "DOS box" open while changing the source file. You can recognize this error when MiKTeX tells you it cannot save the file with the given name and asks you for another file name. Close all "DOS boxes" and compile again.