emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Add catch-up all LaTeX errors


From: Francesco Pizzolante
Subject: Re: [O] [PATCH] Add catch-up all LaTeX errors
Date: Wed, 26 Mar 2014 16:39:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt)


Hi Nicolas,

Thanks for your answer.

>>> As an example, if you open the target PDF file with Adobe Reader and, in the
>>> meantime, you export your Org file again to PDF, you'll see that Org will
>>> tell
>>> you it's OK (Process Completed) while, if you look at the *Org PDF LaTeX
>>> Output* buffer, you'll see an error such as:
>>>
>>> ! I can't write on file `toto.pdf'.
>>> [...]
>>>
>>> The problem comes from the fact that Org just checks for a couple of error
>>> messages (defined in org-latex-known-errors) and report it's OK if it
>>> doesn't find those messages:
>
> Errors are not related to your problem. Actually, "ox-latex.el" uses
> a rather weak check to know if process was successful or not:
>
>   (if (not (file-exists-p pdffile))
>       (error (concat (format "PDF file %s wasn't produced" pdffile)
>                      (when errors (concat ": " errors))))
>     ...
>     (message (concat "Process completed"
>                      (if (not errors) "." (concat " with errors: " errors)))))
>
> IOW, it cannot tell the difference between a successful export and an
> export failure with an already existing PDFFILE.

This is not true as this code checks for the `errors' variable in all
cases. With an already existing PDFFILE, you will end up with this
message: 'Process completed with errors: ...'.

>From my point of view, the issue comes from the fact that the `errors'
variable is not correctly filled in with errors from the LaTeX log file.

As you can see in the following code, we do not catch error lines
starting with '!' but *only* those starting with '! LaTeX...' and '!
Package...':

--8<---------------cut here---------------start------------->8---
(defcustom org-latex-known-errors
  '(("Reference.*?undefined" .  "[undefined reference]")
    ("Citation.*?undefined" .  "[undefined citation]")
    ("Undefined control sequence" .  "[undefined control sequence]")
    ("^! LaTeX.*?Error" .  "[LaTeX error]")
    ("^! Package.*?Error" .  "[package error]")
    ("Runaway argument" .  "Runaway argument"))
[...]
--8<---------------cut here---------------end--------------->8---

While the wikibooks reference
(http://en.wikibooks.org/wiki/LaTeX/Errors_and_Warnings) tells that to
be sure to catch *all* errors, we have to check for any line beginning
with '!'.

Then, in the case where the `errors' variable would effectively contain
any error from the log file, the code you mention above would work in
any case.

That's why I started with this patch (*and it works*):

---
 lisp/ox-latex.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9262ded..2cffe38 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -862,7 +862,8 @@ logfiles to remove, set `org-latex-logfiles-extensions'."
     ("Undefined control sequence" .  "[undefined control sequence]")
     ("^! LaTeX.*?Error" .  "[LaTeX error]")
     ("^! Package.*?Error" .  "[package error]")
-    ("Runaway argument" .  "Runaway argument"))
+    ("Runaway argument" .  "Runaway argument")
+    ("^!.*" . "[Unknown error]"))
   "Alist of regular expressions and associated messages for the user.
 The regular expressions are used to find possible errors in the
 log of a latex-run."
--
1.7.9

The only issue is that the error reporting is not really helpfull (as my
current patch only reports 'Unknown error' for any other error).

Any suggestion is welcome.

Best regards,
 Francesco




reply via email to

[Prev in Thread] Current Thread [Next in Thread]