*José Abílio de Oliveira Matos writes:
 |  This is a multi-part message in MIME format.
 | --------------6F8AE71F2C920E29A5707189 Content-Type: text/plain;
 | charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
 | 
 | Hi, I have a lyx file, full of math expressions, and when I try to
 | preview i= t from lyx, it complains saying that it has found an
 | error, in title. The error inset is pure nonsense.

Can you try this patch:

Index: LaTeX.C
===================================================================
RCS file: /usr/local/lyxsrc/cvsroot/lyx-1_0_x/src/LaTeX.C,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 LaTeX.C
--- LaTeX.C     1998/10/26 22:17:12     1.1.1.1
+++ LaTeX.C     1998/12/22 14:07:28
@@ -546,11 +546,38 @@
                        terr.scanError(lex);
                        num_errors++;
                } else if (token.prefixIs("! ")) {
-                       // TeX Error
-                       retval |=  TEX_ERROR;
-                       lyxerr.debug("TeX Error.", Error::LATEX);
-                       terr.scanError(lex);
-                       num_errors++;
+                       // Ok, we have something that looks like a TeX Error
+                       // but what do we really have.
+
+                       // Just get the error description:
+                       LString desc(token);
+                       desc.substring(2, desc.length() - 1);
+                       // get the next line
+                       lex.next();
+                       LString tmp = lex.GetString();
+                       if (tmp.prefixIs("l.")) {
+                               // we have a latex error
+                               retval |=  TEX_ERROR;
+                               lyxerr.debug("TeX Error.", Error::LATEX);
+                               // get the line number:
+                               int line = 0;
+                               sscanf(tmp.c_str(), "l.%d", &line);
+                               // get the rest of the message:
+                               LString errstr;
+                               lex.EatLine();
+                               tmp = lex.GetString();
+                               while ((tmp != "\n" || !errstr.contains("l."))
+                                      && !tmp.prefixIs("! ")
+                                      && !tmp.contains("(job aborted")
+                                      && !tmp.empty()) {
+                                       errstr += tmp;
+                                       errstr += "\n";
+                                       lex.EatLine();
+                                       tmp = lex.GetString();
+                               }
+                               terr.insertError(line, desc, errstr);
+                               num_errors++;
+                       }
                } else {
                        // information messages, TeX warnings and other
                        // warnings we have not caught earlier.

        Lgb

Reply via email to