From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mohammad Alaggan Subject: [PATCH] Resolving %bibtex vs %bib inconsistency Date: Thu, 27 Apr 2017 17:53:57 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_1F19F459-4778-415A-A82B-50ACDC77200A" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3lk4-0003u4-OI for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 11:54:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3lk1-00073K-H7 for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 11:54:04 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:38686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3lk1-00071x-5f for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 11:54:01 -0400 Received: by mail-wm0-x230.google.com with SMTP id r190so22923469wme.1 for ; Thu, 27 Apr 2017 08:53:59 -0700 (PDT) Received: from [10.185.59.172] (eth-east-parth2-46-193-65-235.wb.wifirst.net. [46.193.65.235]) by smtp.gmail.com with ESMTPSA id t30sm2869715wrc.24.2017.04.27.08.53.57 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Apr 2017 08:53:57 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --Apple-Mail=_1F19F459-4778-415A-A82B-50ACDC77200A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, I believe there=E2=80=99s a bug in org-mode 9.0.5 in LaTeX export, when = substituting the template parameters in org-latex-pdf-process.=20 To reproduce =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1. Create conf.el file containing: (add-to-list 'load-path "/path/to/org-plus-contrib-20170210") (require 'ox-latex) (setq org-latex-pdf-process '("%bib %b")) 2. Launch emacs: emacs -Q -l conf.el 2. Create an empty org-mode file "test.org" 3. Export it to a PDF : C-c C-e l p Expected Result =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D bibtex is invoked and producing an error message complaining about = nonexisting .aux file, producing the following message in *Org PDF LaTeX = Output* buffer: I couldn=E2=80=99t open file name `test.aux=E2=80=99 Actual Result =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D An error will show in *Org PDF LaTeX Output* buffer: /bin/bash: testib: command not found =20 Discussion =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D What happened is that the template "%bib" was not replaced by "bibtex" = (the default value of "org-latex-bib-compiler"), but instead, the "%b" = part was replaces by the file basename "test". The problem is an inconsistency between, on one hand the documentation = string of org-latex-bib-compiler and the built-in value list of = org-latex-pdf-process, who believe the bibtex compiler=E2=80=99s = template is "%bib", and the function org-latex-compile, which believes = (both in comments and in code) that the template should be "%bibtex" = instead. All of them are in lisp/ox-latex.el. For users it can be easily fixed by using %bibtex instead of %bib, so it = is not critical. It is also easy to fix in the codebase as well, but I = am not sure which way to go: set it to %bib everywhere, or to %bibtex. I = settled with setting it to %bib and removing %bibtex from = org-latex-compile since this is most likely to not break existing = configurations of users. The corresponding patch is attached at the end = of the message. It is my first patch, so please forgive me if there is = something wrong with the formatting, the commit message, or with this = message; I would appreciate any pieces of advice as well. Thank you,=20 Replace %bib instead of %bibtex, in org-latex-pdf-process. * lisp/ox-latex.el (org-latex-compile): Changed regex accordingly. --- lisp/ox-latex.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 6fe05e0..262bcb2 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -3663,12 +3663,12 @@ produced." (match-string 0))) "pdflatex")) (process (if (functionp org-latex-pdf-process) = org-latex-pdf-process - ;; Replace "%latex" and "%bibtex" with, + ;; Replace "%latex" and "%bib" with, ;; respectively, "%L" and "%B" so as to adhere to ;; `format-spec' specifications. (mapcar (lambda (command) (replace-regexp-in-string - "%\\(?:bib\\|la\\)tex\\>" + "%\\(?:bib\\|latex\\)\\>" (lambda (m) (upcase (substring m 0 2))) command)) org-latex-pdf-process))) --=20 2.6.4 (Apple Git-63) --Apple-Mail=_1F19F459-4778-415A-A82B-50ACDC77200A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hi,

I believe there=E2=80=99s a bug in org-mode = 9.0.5 in LaTeX export, when substituting the template parameters in = org-latex-pdf-process. 

To = reproduce
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
1. Create conf.el file = containing:

 (add-to-list = 'load-path "/path/to/org-plus-contrib-20170210")
 (require 'ox-latex)
 (setq = org-latex-pdf-process '("%bib %b"))

2. Launch emacs:
 emacs -Q -l conf.el

2. Create an empty org-mode file "test.org"
3. Export it to a PDF : C-c = C-e l p

Expected Result
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<= /font>
bibtex is = invoked and producing an error message complaining about nonexisting = .aux file, producing the following message in *Org PDF LaTeX = Output* = buffer:

 I couldn=E2=80=99t open file name = `test.aux=E2=80=99

Actual Result
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
An error will show in *Org = PDF LaTeX Output* buffer:

 /bin/bash: testib: command not found    =  

Discussion
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

What happened is that the template "%bib" was not replaced by = "bibtex" (the default value of "org-latex-bib-compiler"), but instead, = the "%b" part was replaces by the file basename "test".

The problem is an inconsistency between, on one hand the = documentation string of org-latex-bib-compiler and the built-in value = list of org-latex-pdf-process, who believe the bibtex compiler=E2=80=99s = template is "%bib", and the function org-latex-compile, which believes = (both in comments and in code) that the template should = be "%bibtex" instead. All of them are in = lisp/ox-latex.el.

For users it can be easily fixed by using = %bibtex instead of %bib, so it is not critical. It is also easy to fix = in the codebase as well, but I am not sure which way to go: set it to = %bib everywhere, or to %bibtex. I settled with setting it to %bib and = removing %bibtex from org-latex-compile since this is most likely to not = break existing configurations of users. The corresponding patch is = attached at the end of the message. It is my first patch, so please = forgive me if there is something wrong with the formatting, the commit = message, or with this message; I would appreciate any pieces of advice = as well.

Thank = you, 

Replace = %bib instead of %bibtex, in org-latex-pdf-process.
* = lisp/ox-latex.el (org-latex-compile): Changed regex = accordingly.
---
 lisp/ox-latex.el | 4 ++--
 1 = file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el = b/lisp/ox-latex.el
index 6fe05e0..262bcb2 = 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3663,12 = +3663,12 @@ produced."
  =     (match-string 0)))
    =    "pdflatex"))
  (process = (if (functionp org-latex-pdf-process) org-latex-pdf-process
- =    ;; Replace "%latex" and "%bibtex" with,
+ =    ;; Replace "%latex" and "%bib" with,
 =    ;; respectively, "%L" and "%B" so = as to adhere to
     ;; = `format-spec' specifications.
  =    (mapcar (lambda (command)
  =      (replace-regexp-in-string
- =       = "%\\(?:bib\\|la\\)tex\\>"
+ =       "%\\(?:bib\\|latex\\)\\>"
 =       (lambda (m) (upcase = (substring m 0 2)))
  =       command))
  =    org-latex-pdf-process)))
-- 
2.6.4 (Apple = Git-63)


= --Apple-Mail=_1F19F459-4778-415A-A82B-50ACDC77200A--