# Associating error messages with tex input

I'm compiling a paper that someone else started and I have to fix some error messages associated with text that I've never read before. When I compile the paper sometimes it gets to an error and I have to figure out where that is in the paper and how to fix it.

The warning messages give some information about what causes the warning, for example:

LaTeX Warning: Reference label1' on page \thepage  undefined on input line 74.


These have been helpful for me in figuring out where pdflatex is in processing the file because the error messages are typically thigns like:

[5]

! LaTeX Error: Illegal character in array arg.


This is just an example of one the errors that I've gotten to and am trying to fix. I can Google for the error message and try to understand what is causing it. But my question is: is there an easy way to know what causes an error message to occur in latex?

Mostly I'd like to see something like the line number information that is provided for warnings, but for errors instead. I don't know if that feature exists or not but I thought it might be worth asking.

-

The complete error message you get has the necessary information below it:

! LaTeX Error: Illegal character in array arg.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.3 $\begin{array}{lrq}  You can see where LaTeX was and, in this case, the reason for the error should be clear. The error is in line 3 of the file currently input. If you run the typesetting engine with the option --file-line-error (how you do this depends on your TeX distribution and editor/front-end) the error message becomes ./gabrierr.tex:3: LaTeX Error: Illegal character in array arg. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.3$\begin{array}{lrq}


so you can also see what file LaTeX is processing.

Some errors are more difficult to find, because they may be triggered by something that happened several lines above (a missing brace or a missing \$`). But in most cases the error location is quite precise.

-