# Easy way to find the location of a compilation error?

When I compile my project with pdflatex, I get to see at which line the error has occurred, but the file is it claims the error has occurred in is incorrect since it always just says that it has occurred in the main .tex file, while it really has occurred in some other file. Double clicking on the error, which normally takes you straight to the problematic code line, is therefore useless. Why does pdflatex behave like this? Does anyone have a suggestion for what I can do to find the line that actually has caused the error, so I can know what pdflatex is complaining about?

-
Are you using --file-line-error option? –  Peter Grill Aug 15 '12 at 4:33
@Peter: I don't know, I'm using TeXstudio, and I haven't really specified any compiling options. How can I see that? –  StrawberryFieldsForever Aug 17 '12 at 1:54
I am not familiar with TeXstudio, but there must be a preferences setting somewhere where you get to see what the compile options are set to, and allow you to change them. –  Peter Grill Aug 17 '12 at 3:41
@Peter: Yes I am; I'm compiling using the row pdflatex.exe -synctex=1 -interaction=nonstopmode --file-line-error -shell-escape %.tex, where % is the name of the file to be compiled. But still, TeXstudio is telling me that all the errors are in the main file from which all the other files are included. It gives a line number for each error, but it doesn't give the correct file. I don't know if this is a bug in TeXstudio or if I'm compiling incorrectly. At another computer I use it works, and there I've set up TeXstudio in the same way. –  StrawberryFieldsForever Aug 7 at 23:17
@Peter: I will report this as a bug at the TeXstudio sourceforge page and see what happens. –  StrawberryFieldsForever Aug 7 at 23:18

Double clicking on the error...

It sounds like you're using some front-end application to compile. I can think of two possible ways to do some more error seeking:

1) Try only compiling the problem file. This may require temporary alteration of the preamble to make everything else work, but should still work after that.

2) What I would recommend: take it to the command line if you can. Trying running pdflatex (or just plain ol' latex) on the whole project and go through the output to see where it errors out. (This should also be possible with whatever front-end compiler you're using; scrolling through the compilation log is all-telling.)

-
In other words, it is a bug of your editor and not of tex itself (although we all wouldn't mind if tex's output were easier to parse for automated tools). –  Federico Poloni Aug 15 '12 at 10:41
@iamed18: Okay, thanks for you answer. Yes, I'm using TeXstudion, which I guess is a front-end application since it is an extra program in between you and pdflatex. Anyway, the problem got solved (I think I had forgot to end a table row with "\\"), but I will remember to try these things next time I run into an error I can't find the source line for. –  StrawberryFieldsForever Aug 17 '12 at 1:58
@Federico It might very well be my editor that contains a bug; TeXstudio crashes every then and then; it has even saved empty files for me because I had managed to fill up the partition, so there wasn't enough disk space to save the new versions of the files... Recommendations for any better LaTeX editor for windows users?? –  StrawberryFieldsForever Aug 17 '12 at 2:09