turn LaTeX warning into error, for the sake of isabelle.sty/bbbfont;
authorwenzelm
Tue, 23 Mar 2021 13:27:15 +0100
changeset 73729 4e12a6caefb3
parent 73728 2cc9bd9a7357
child 73730 4840ce456b4f
turn LaTeX warning into error, for the sake of isabelle.sty/bbbfont;
src/Pure/Thy/latex.scala
src/Pure/Thy/presentation.scala
--- a/src/Pure/Thy/latex.scala	Tue Mar 23 13:13:31 2021 +0100
+++ b/src/Pure/Thy/latex.scala	Tue Mar 23 13:27:15 2021 +0100
@@ -138,6 +138,7 @@
         "<everyeof>",
         "<write>").mkString("^(?:", "|", ") (.*)$").r
 
+    val Bad_Font = """^LaTeX Font Warning: (Font .*\btxmia\b.* undefined).*$""".r
     val Bad_File = """^! LaTeX Error: (File `.*' not found\.)$""".r
 
     val error_ignore =
@@ -167,6 +168,8 @@
           val pos = tex_file_position(file, line)
           val msg2 = error_suffix1(rest1) orElse error_suffix2(rest1) getOrElse ""
           filter(rest1, (Exn.cat_message(msg1, msg2), pos) :: result)
+        case Bad_Font(msg) :: rest =>
+          filter(rest, (msg, Position.none) :: result)
         case Bad_File(msg) :: rest =>
           filter(rest, (msg, Position.none) :: result)
         case _ :: rest => filter(rest, result)
--- a/src/Pure/Thy/presentation.scala	Tue Mar 23 13:13:31 2021 +0100
+++ b/src/Pure/Thy/presentation.scala	Tue Mar 23 13:27:15 2021 +0100
@@ -680,12 +680,15 @@
 
             val log_lines = result.out_lines ::: result.err_lines
 
-            if (!result.ok) {
+            val errors =
+              (if (result.ok) Nil else List(result.err)) :::
+              Latex.latex_errors(doc_dir, root) :::
+              Bibtex.bibtex_errors(doc_dir, root)
+
+            if (errors.nonEmpty) {
               val message =
                 Exn.cat_message(
-                  result.err,
-                  cat_lines(Latex.latex_errors(doc_dir, root) ::: Bibtex.bibtex_errors(doc_dir, root)),
-                  "Failed to build document " + quote(doc.name))
+                  (errors ::: List("Failed to build document " + quote(doc.name))):_*)
               throw new Build_Error(log_lines, message)
             }
             else if (!result_path.is_file) {