Improve log scanner to correctly report error

When scanning the LaTeX log, previously we only looked ahead 10 lines
after a "!" line and if we did not find a line number we did not count
an error. This lead to the problem that templates/ACM-sigplan.lyx was
showing a successful export and the PDF was shown (it is still
created despite the error). Now that the exit code of the latex
command is checked (as of the previous commit), an error is correctly
given, but by parsing the log better with this commit, a more
informative error is given.

Increasing the look-ahead to 15 lines leads to correct parsing of
the ACM-sigplan log. The excerpt in the log file where there are more
than 10 lines in-between the "!" line and the line number is below:

! Undefined control sequence.
\@toappear ...ent http://dx.doi.org/10.1145/\@doi

<argument> ...n is removed.]\par \else \@toappear
                                                  \fi \if \@reprint
\noinden...

\@begin@tempboxa ...mpboxa #1{\color@begingroup #2
                                                  \color@endgroup }\def
\wid...

\@iiiparbox ...tempdima \@parboxrestore #5\@@par }
                                                  \ifx \relax #2\else
\setle...

\@copyrightspace ...planconf@finalpage}.\par \fi }
                                                  }\end@float
\maketitle ... \@copyrightwanted \@copyrightspace
                                                  \fi
l.34 \maketitle

Another example is posted here:
http://tex.stackexchange.com/questions/231655/lyx-cannot-output-to-pdflatex-for-a-specific-file
This commit is contained in:
Scott Kostyshak 2015-02-21 00:00:51 -05:00
parent 1dbf0e5aab
commit 0a6120cb7f

View File

@ -825,7 +825,10 @@ int LaTeX::scanLogFile(TeXErrors & terr)
if (!getline(ifs, tmp))
break;
tmp = rtrim(tmp, "\r");
if (++count > 10)
// 15 is somewhat arbitrarily chosen, based on practice.
// We used 10 for 14 years and increased it to 15 when we
// saw one case.
if (++count > 15)
break;
} while (!prefixIs(tmp, "l."));
if (prefixIs(tmp, "l.")) {