emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] Resolving %bibtex vs %bib inconsistency


From: Mohammad Alaggan
Subject: [O] [PATCH] Resolving %bibtex vs %bib inconsistency
Date: Thu, 27 Apr 2017 17:53:57 +0200

Hi,

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

To reproduce
============
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
===============
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’t open file name `test.aux’

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

 /bin/bash: testib: command not found     

Discussion
==========

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’s 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)



reply via email to

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