From 0a6120cb7f940bc010efa9f2873afaeee6381a9e Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Sat, 21 Feb 2015 00:00:51 -0500 Subject: [PATCH] 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 ...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 --- src/LaTeX.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 588ca522e4..e4f8b4b490 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -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.")) { -- 2.39.5