From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scot Becker Subject: Re: Re: [PATCH] Compiling multiple times the LaTeX output Date: Mon, 4 Oct 2010 11:36:50 +0100 Message-ID: References: <87zkv0pqyi.fsf@mundaneum.com> <87r5gcshnf.fsf@noorul.maa.corp.collab.net> <874od7uzsa.fsf_-_@mundaneum.com> <30671.1285861145@gamaville.dokosmarshall.org> <87vd5njhm8.fsf@mundaneum.com> <87lj6h1ukw.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=36168 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P2iPx-0007zf-O2 for emacs-orgmode@gnu.org; Mon, 04 Oct 2010 06:37:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P2iPw-0007Ld-A4 for emacs-orgmode@gnu.org; Mon, 04 Oct 2010 06:37:13 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:39154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P2iPw-0007LU-0T for emacs-orgmode@gnu.org; Mon, 04 Oct 2010 06:37:12 -0400 Received: by bwz10 with SMTP id 10so4834685bwz.0 for ; Mon, 04 Oct 2010 03:37:11 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: =?ISO-8859-1?Q?S=E9bastien_Vauban?= , emacs-orgmode@gnu.org As soon as I can, I'll give the patch a test using XeLaTeX as well. It'd be great to have this feature also be able to run xelatex instead of pdflatex to support that toolchain as well (for its better UTF-8 support and OpenType font integration). I expect this to be easy, because as far as I can tell the output/error/warning messages are the same. Scot 2010/10/4 Carsten Dominik : > Hi Sebastian, > > Thanks for the patch! =A0I would certainly have a better way to process > these files. > > My questions: > > 1. Can we run bibtex only if we have an indication that it might be neede= d? > Maybe by looking at the output of the first LaTeX run? =A0Hmm, maybe this > would not work if only the bibtex database file was changed. > > 2. =A0The contrill structures you are using, are they standard shell > or is bash needed for this? > > 3. Maybe we can extract a useful error message if the last PDFLaTeX > run still contains problems? =A0Maybe even load the log file in this case= ? > > Thanks! > > - Carsten > > On Oct 1, 2010, at 11:17 PM, S=E9bastien Vauban wrote: > > > >> >> Here is my (much) better proposition: >> >> --8<---------------cut here---------------start------------->8--- >> diff --git a/lisp/org-latex.el b/lisp/org-latex.el >> index 9a62457..0a2c5fe 100644 >> --- a/lisp/org-latex.el >> +++ b/lisp/org-latex.el >> @@ -455,25 +455,35 @@ allowed. =A0The default we use here encompasses bo= th." >> =A0:group 'org-export-latex >> =A0:group 'org-export) >> >> +(defcustom org-latex-pdf-max-runs 3 >> + =A0"Maximum number of times PDFLaTeX is run after BibTeX." >> + =A0:group 'org-export-pdf >> + =A0:type 'int) >> + >> (defcustom org-latex-to-pdf-process >> - =A0'("pdflatex -interaction nonstopmode -output-directory %o %f" >> - =A0 =A0"pdflatex -interaction nonstopmode -output-directory %o %f") >> + =A0`("pdflatex -interaction nonstopmode -output-directory %o %f" >> + =A0 =A0"bibtex %b" >> + =A0 =A0,(concat "let COUNTER=3D0; while (grep -e \"Rerun .* cross-refe= rences\" >> %b.log > /dev/null); do if [ $COUNTER -eq " >> + =A0 =A0 =A0 =A0 =A0 =A0 (int-to-string org-latex-pdf-max-runs) >> + =A0 =A0 =A0 =A0 =A0 =A0 " ]; then break; fi; pdflatex -interaction non= stopmode >> -output-directory %o %f; let COUNTER=3DCOUNTER+1; done")) >> =A0"Commands to process a LaTeX file to a PDF file. >> This is a list of strings, each of them will be given to the shell >> as a command. =A0%f in the command will be replaced by the full file nam= e, >> %b >> by the file base name (i.e. without extension) and %o by the base >> directory >> of the file. >> The reason why this is a list is that it usually takes several runs of >> -pdflatex, maybe mixed with a call to bibtex. =A0Org does not have a cle= ver >> -mechanism to detect which of these commands have to be run to get to a >> stable >> -result, and it also does not do any error checking. >> +pdflatex, mixed with a call to bibtex. =A0Org does now have a clever >> mechanism >> +to detect how many times the document has to be compiled to get to a >> stable >> +result for the cross-references. =A0Moreover, the number of compilation= s >> after >> +bibtex is limited to 3 by default (see `org-latex-pdf-max-runs' for >> more). >> +Though, it does not do any error checking. >> >> Alternatively, this may be a Lisp function that does the processing, so >> you >> could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. >> This function should accept the file name as its single argument." >> =A0:group 'org-export-pdf >> =A0:type '(choice (repeat :tag "Shell command sequence" >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (string :tag "Shell command")) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(string :tag "Shell com= mand")) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (function))) >> >> (defcustom org-export-pdf-logfiles >> --8<---------------cut here---------------end--------------->8--- >> >> Enhancements: >> >> - variable to limit the number of PDFLaTeX runs (3, by default) >> >> =A0Though, the way it is evaluated, you need to set it before calling >> org-latex >> =A0(before defining org-latex-to-pdf-process). Not a problem, IMHO. Mayb= e >> there >> =A0are better ways, though? >> >> - real standard sequence to compile the doc: >> >> =A0+ one call to PDFLaTeX >> =A0+ one call to BibTeX >> =A0+ as many calls as needed to PDFLaTeX (max 3) >> >> Best regards, >> =A0Seb >> >> -- >> S=E9bastien Vauban >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > - Carsten > > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode >