Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.