emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Displaying errors in batch mode
@ 2012-10-31  8:55 Sebastien Vauban
  0 siblings, 0 replies; only message in thread
From: Sebastien Vauban @ 2012-10-31  8:55 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Errors generated by Org are correctly reported in batch mode:

#+begin_src sh
 emacs --batch -Q  --eval "(add-to-list 'load-path \"~/src/org-mode/lisp\")"  --eval "(add-to-list 'load-path \"~/src/org-mode/contrib/lisp\")"  -l "~/src/org-batch/bin/org-batch-init.el" ecm.txt -f org-export-as-pdf
#+end_src

LaTeX errors sometimes well, sometimes not at all: you only know that there
were errors, and that the PDF file has not been produced. No more.

And this seems hard to reproduce (whether or not you get the LaTeX errors
displayed). Maybe you have some hints?

* ECM "Org error"

#+begin_src org
,#+TITLE:     ECM No error reported
,#+LANGUAGE:  en

,#+LaTeX_CLASS: myarticle

,* Example

Blah blah...
#+end_src

will results in:

#+begin_example
 Exporting to PDF...
 Exporting to LaTeX...
 Debugger entered--Lisp error: (error "No definition for class `myarticle' in `org-export-latex-classes'")
   signal(error ("No definition for class `myarticle' in `org-export-latex-classes'"))
   error("No definition for class `%s' in `org-export-latex-classes'" "myarticle")
   (or (car (assoc org-export-latex-class org-export-latex-classes)) (error "No definition for class `%s' in `org-export-latex-classes'" org-export-latex-class))
#+end_example

which is *crystal-clear*.

* ECM "LaTeX error" (invalid syntax used for comments)

#+begin_src org
,#+TITLE:     ECM No error reported
,#+LANGUAGE:  en

,##+LaTeX_CLASS: myarticle

,* Example

Blah blah...
#+end_src

sometimes results in:

#+begin_example
 Exporting to PDF...
 Exporting to LaTeX...
 Saving file d:/home/sva/src/org-batch/ecm.tex...
 Wrote d:/home/sva/src/org-batch/ecm.tex
 Saving file d:/home/sva/src/org-batch/ecm.tex...
 Wrote d:/home/sva/src/org-batch/ecm.tex
 LaTeX export done, pushed to kill ring and clipboard
 Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...
 Latexmk: This is Latexmk, John Collins, 30 March 2012, version: 4.31.
 **** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
 Rule 'pdflatex': Rules & subrules not known to be previously run:
    pdflatex
 Rule 'pdflatex': The following rules & subrules became out-of-date:
       'pdflatex'
 ------------
 Run number 1 of rule 'pdflatex'
 ------------
 ------------
 Running 'pdflatex  -recorder  "d:/home/sva/src/org-batch/ecm.tex"'
 ------------
 Latexmk: applying rule 'pdflatex'...
 This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011)
 [...]
 ! Missing $ inserted.
 <inserted text>
                 $
 l.39 \#\#+\LaTeX{}_
                    CLASS: myarticle
 ?
 ! Emergency stop.
 <inserted text>
                 $
 l.39 \#\#+\LaTeX{}_
                    CLASS: myarticle
 !  ==> Fatal error occurred, no output PDF file produced!
 Transcript written on ecm.log.
 Failure to make 'ecm.pdf'
 Collected error summary (may duplicate other messages):
   pdflatex: Command for 'pdflatex' gave return code 256
 Latexmk: Use the -f option to force complete processing.
 Latexmk: Errors, so I did not complete making targets
 D:\texlive\2011\bin\win32\runscript.tlu:587: command failed with exit code 12:
 perl.exe d:/texlive/2011/texmf-dist/scripts/latexmk/latexmk.pl -pdf d:/home/sva/src/org-batch/ecm.tex
 Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...done
 Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")
   signal(error ("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced"))
   error("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")
   (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile)
#+end_example

That is, the LaTeX error is well displayed... Very clear.

* ECM "LaTeX error" (undefined environment)

#+begin_src org
,#+TITLE:     ECM No error reported
,#+LANGUAGE:  en

,* Example

,#+LaTeX: {\begin{mychangemargin}{-2.5cm}{0cm}
Blah blah...
,#+LaTeX: \end{mychangemargin}}
#+end_src

sometimes results in:

#+begin_example
 Exporting to PDF...
 Exporting to LaTeX...
 Saving file d:/home/sva/src/org-batch/ecm.tex...
 Wrote d:/home/sva/src/org-batch/ecm.tex
 Saving file d:/home/sva/src/org-batch/ecm.tex...
 Wrote d:/home/sva/src/org-batch/ecm.tex
 LaTeX export done, pushed to kill ring and clipboard
 Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...
 Latexmk: This is Latexmk, John Collins, 30 March 2012, version: 4.31.
 **** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
 Rule 'pdflatex': File changes, etc:
    Changed files, or newly in use since previous run(s):
       'd:/home/sva/src/org-batch/ecm.tex'
       'ecm.aux'
    Non-existent destination files:
       'ecm.pdf'
 ------------
 Run number 1 of rule 'pdflatex'
 ------------
 ------------
 Running 'pdflatex  -recorder  "d:/home/sva/src/org-batch/ecm.tex"'
 ------------
 Latexmk: applying rule 'pdflatex'...
 This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011)
 [...]
 ! LaTeX Error: Environment mychangemargin undefined.

 See the LaTeX manual or LaTeX Companion for explanation.
 Type  H <return>  for immediate help.
  ...

 l.43 {\begin{mychangemargin}
                             {-2.5cm}{0cm}
 ?
 ! Emergency stop.
  ...

 l.43 {\begin{mychangemargin}
                             {-2.5cm}{0cm}
 !  ==> Fatal error occurred, no output PDF file produced!
 Transcript written on ecm.log.
 Failure to make 'ecm.pdf'
 Collected error summary (may duplicate other messages):
   pdflatex: Command for 'pdflatex' gave return code 256
 Latexmk: Use the -f option to force complete processing.
 Latexmk: Errors, so I did not complete making targets
 D:\texlive\2011\bin\win32\runscript.tlu:587: command failed with exit code 12:
 perl.exe d:/texlive/2011/texmf-dist/scripts/latexmk/latexmk.pl -pdf d:/home/sva/src/org-batch/ecm.tex
 Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...done
 Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")
   signal(error ("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced"))
   error("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")
   (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile)
#+end_example

which is clear as well.

* Some other times

Some other times (I can't reproduce it right now), *with the above examples*,
we only get such a reporting:

#+begin_example
 Exporting to PDF...
 Exporting to LaTeX...
 Saving file d:/home/sva/src/org-batch/ecm-no-error-reported.tex...
 Wrote d:/home/sva/src/org-batch/ecm-no-error-reported.tex
 Saving file d:/home/sva/src/org-batch/ecm-no-error-reported.tex...
 Wrote d:/home/sva/src/org-batch/ecm-no-error-reported.tex
 LaTeX export done, pushed to kill ring and clipboard
 Processing LaTeX file d:/home/sva/src/org-batch/ecm-no-error-reported.tex...
 Processing LaTeX file d:/home/sva/src/org-batch/ecm-no-error-reported.tex...done
 Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced")
   signal(error ("PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced"))
   error("PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced")
   (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile)
#+end_example

That is clearly lacking the sought information.

However, I can't give an accurate recipe of how to get a LaTeX error
correctly reported or not.

Did you already get such troubles?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-31  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31  8:55 Displaying errors in batch mode Sebastien Vauban

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).