If you export ACM-sigplan.lyx in the GUI, LyX says it was exported successfully and shows the PDF. But if you look at the terminal output you will see that pdflatex exited with error. The reason LyX doesn't pick this up is because (1) it does not check the exit code (which is a separate bug in my opinion) and (2) it does not detect an error when scanning the log file. This patch addresses (2). I attach the log file in case you are interested but do not want to install the LaTeX files needed to test for yourself.
The problem was that we only register an error if there is 10 or fewer lines in-between the "!" line and the line where the line number where the error occurred (the "l." line). This patch increases that number to 15. Why 15? Because we used 10 for 14 years and there weren't many problems, at least not that anyone noticed. 15 is just enough to detect the error in this particular case. The number 10 was introduced at a2c6689c to address the following + * src/LaTeX.C (scanLogFile): errors where the line number was not + given just after the '!'-line were ignored (from Dekel Tsur). Am I correct that the only drawback is in theory performance? I would really like to fix (1) above, so I'm OK if there are objections to this patch, as long as we agree that (1) should be fixed. Scott
From 11cb5ed5805b80189aa6e98e72a383fd2e34e6f9 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak <skost...@lyx.org> Date: Tue, 21 Oct 2014 00:55:51 -0400 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 file was shown (it is still created despite the error). Increasing the look-ahead to 15 lines corrects this particular case. 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 --- src/LaTeX.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 3436645..1ade9b6 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -809,7 +809,11 @@ 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. The trade-off of looking ahead too far + // is performance. + if (++count > 15) break; } while (!prefixIs(tmp, "l.")); if (prefixIs(tmp, "l.")) { -- 1.9.1
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) (format=pdflatex 2014.4.7) 21 OCT 2014 00:40 entering extended mode restricted \write18 enabled. %&-line parsing enabled. **newfile1.tex (./newfile1.tex LaTeX2e <2011/06/27> Babel <3.9k> and hyphenation patterns for 78 languages loaded. (/usr/local/texlive/2013/../texmf-local/tex/latex/sigplan/sigplanconf.cls Document Class: sigplanconf 2013/07/02 v2.8 ACM SIGPLAN Proceedings \@numheaddepth=\count79 (/usr/local/texlive/2013/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/local/texlive/2013/texmf-dist/tex/latex/base/size10.clo File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) ) \c@part=\count80 \c@section=\count81 \c@subsection=\count82 \c@subsubsection=\count83 \c@paragraph=\count84 \c@subparagraph=\count85 \c@figure=\count86 \c@table=\count87 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42 \bibindent=\dimen102 ) \standardtextwidth=\dimen103 \standardvspace=\skip43 Using natbib package with 'numbers' citation style. (/usr/local/texlive/2013/texmf-dist/tex/latex/natbib/natbib.sty Package: natbib 2010/09/13 8.31b (PWD, AO) \bibhang=\skip44 \bibsep=\skip45 LaTeX Info: Redefining \cite on input line 694. \c@NAT@ctr=\count88 ) \@sectionaboveskip=\skip46 \@sectionbelowskip=\skip47 \@subsectionaboveskip=\skip48 \@subsectionbelowskip=\skip49 \@paragraphaboveskip=\skip50 \@authorcount=\count89 \@titlenotecount=\count90 \@titlenotetext=\toks14 \@fnmark=\toks15 \@authori=\count91 \@measbox=\box26 ) (/usr/local/texlive/2013/texmf-dist/tex/latex/base/fontenc.sty Package: fontenc 2005/09/27 v1.99g Standard LaTeX package (/usr/local/texlive/2013/texmf-dist/tex/latex/base/t1enc.def File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file LaTeX Font Info: Redeclaring font encoding T1 on input line 43. )) (/usr/local/texlive/2013/texmf-dist/tex/generic/babel/babel.sty Package: babel 2014/03/24 3.9k The Babel package (/usr/local/texlive/2013/texmf-dist/tex/generic/babel-english/english.ldf Language: english 2012/08/20 v3.3p English support from the babel system (/usr/local/texlive/2013/texmf-dist/tex/generic/babel/babel.def File: babel.def 2014/03/24 3.9k Babel common definitions \babel@savecnt=\count92 \U@D=\dimen104 ) \l@canadian = a dialect from \language\l@american \l@australian = a dialect from \language\l@british \l@newzealand = a dialect from \language\l@british )) (./newfile1.aux) \openout1 = `newfile1.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Try loading font information for T1+ptm on input line 8. (/usr/local/texlive/2013/texmf-dist/tex/latex/psnfss/t1ptm.fd File: t1ptm.fd 2001/06/04 font definitions for T1/ptm. ) LaTeX Font Info: Font shape `T1/ptm/bx/n' in size <18> not available (Font) Font shape `T1/ptm/b/n' tried instead on input line 34. LaTeX Font Info: Calculating math sizes for size <18> on input line 34. LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <18> not available (Font) size <17.28> substituted on input line 34. LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <12.59995> not available (Font) size <12> substituted on input line 34. LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <18> not available (Font) size <17.28> substituted on input line 34. LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <12.59995> not available (Font) size <12> substituted on input line 34. LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <18> not available (Font) size <17.28> substituted on input line 34. LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <12.59995> not available (Font) size <12> substituted on input line 34. LaTeX Font Info: External font `cmex10' loaded for size (Font) <18> on input line 34. LaTeX Font Info: External font `cmex10' loaded for size (Font) <12.59995> on input line 34. LaTeX Font Info: External font `cmex10' loaded for size (Font) <9> on input line 34. LaTeX Font Info: Try loading font information for T1+cmss on input line 34. (/usr/local/texlive/2013/texmf-dist/tex/latex/base/t1cmss.fd File: t1cmss.fd 1999/05/25 v2.5h Standard LaTeX font definitions ) LaTeX Font Info: External font `cmex10' loaded for size (Font) <8> on input line 34. LaTeX Font Info: External font `cmex10' loaded for size (Font) <6> on input line 34. LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line 34. LaTeX Font Info: Try loading font information for OMS+ptm on input line 34. (/usr/local/texlive/2013/texmf-dist/tex/latex/psnfss/omsptm.fd File: omsptm.fd ) LaTeX Font Info: Font shape `OMS/ptm/m/n' in size <7> not available (Font) Font shape `OMS/cmsy/m/n' tried instead on input line 34. ! 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 The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. LaTeX Font Info: Font shape `T1/ptm/bx/n' in size <11> not available (Font) Font shape `T1/ptm/b/n' tried instead on input line 35. LaTeX Font Info: Font shape `T1/ptm/bx/n' in size <9> not available (Font) Font shape `T1/ptm/b/n' tried instead on input line 41. LaTeX Font Info: Font shape `T1/ptm/bx/it' in size <9> not available (Font) Font shape `T1/ptm/b/it' tried instead on input line 41. (./newfile1.bbl) [1{/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/p dftex.map} ] (./newfile1.aux) LaTeX Font Warning: Size substitutions with differences (Font) up to 0.72pt have occurred. ) Here is how much of TeX's memory you used: 1493 strings out of 493308 17566 string characters out of 6137823 82211 words of memory out of 5000000 4968 multiletter control sequences out of 15000+600000 44648 words of font info for 56 fonts, out of 8000000 for 9000 957 hyphenation exceptions out of 8191 30i,9n,30p,176b,245s stack positions out of 5000i,500n,10000p,200000b,80000s {/usr/local/texlive/2013/texmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/local/t exlive/2013/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/local/tex live/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/local/texl ive/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy6.pfb></usr/local/texliv e/2013/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></usr/local/texlive/ 2013/texmf-dist/fonts/type1/public/cm-super/sfss0900.pfb></usr/local/texlive/20 13/texmf-dist/fonts/type1/urw/times/utmb8a.pfb></usr/local/texlive/2013/texmf-d ist/fonts/type1/urw/times/utmbi8a.pfb></usr/local/texlive/2013/texmf-dist/fonts /type1/urw/times/utmr8a.pfb></usr/local/texlive/2013/texmf-dist/fonts/type1/urw /times/utmr8a.pfb></usr/local/texlive/2013/texmf-dist/fonts/type1/urw/times/utm ri8a.pfb> Output written on newfile1.pdf (1 page, 92462 bytes). PDF statistics: 46 PDF objects out of 1000 (max. 8388607) 33 compressed objects within 1 object stream 0 named destinations out of 1000 (max. 500000) 1 words of extra memory for PDF output out of 10000 (max. 10000000)