emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mohammad Alaggan <mohammad.nabil.h@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Resolving %bibtex vs %bib inconsistency
Date: Thu, 27 Apr 2017 17:53:57 +0200	[thread overview]
Message-ID: <CEBB5C35-0972-4EBF-94EB-2C59D5EA412A@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3044 bytes --]

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)



[-- Attachment #2: Type: text/html, Size: 7571 bytes --]

                 reply	other threads:[~2017-04-27 15:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CEBB5C35-0972-4EBF-94EB-2C59D5EA412A@gmail.com \
    --to=mohammad.nabil.h@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).