From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: PATCH: New options for latex src code export Date: Sat, 11 Jun 2011 13:48:06 -0700 Message-ID: References: <87hbc4teqs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:33104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVV6Y-0000HM-C3 for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 16:48:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QVV6U-0008P7-Q4 for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 16:48:24 -0400 Received: from lo.gmane.org ([80.91.229.12]:35753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVV6U-0008Oo-EG for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 16:48:22 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QVV6S-0002wn-Ta for emacs-orgmode@gnu.org; Sat, 11 Jun 2011 22:48:20 +0200 Received: from c-24-7-32-167.hsd1.ca.comcast.net ([24.7.32.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jun 2011 22:48:20 +0200 Received: from dandavison7 by c-24-7-32-167.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jun 2011 22:48:20 +0200 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bastien writes: > Hi Dan, > > Dan Davison writes: > >> My questions are >> >> 1. It would be nice if users didn't have to worry about step 4. Can >> anyone suggest a sensible way to have the "-shell-escape" option >> passed to pdflatex under the appropriate circumstances? These >> conditions include: >> 1. minted is being used for export >> 2. pdflatex is being used, a.o.t. e.g. rubber or some other latex >> make tool. > > A bit hackish, but maybe the attached patch would do? This patch has been applied. So now with the pygments package installed [1] (providing the `pygmentize` executable), minted pdf export of source code requires only #+begin_src emacs-lisp (require 'org-latex) (setq org-export-latex-listings 'minted) (add-to-list 'org-export-latex-packages-alist '("" "minted")) #+end_src Dan Footnotes: [1] - linux :: apt-get install python-pygments - OSX / linux :: 'pip install pygments' or 'easy_install pygments' > > diff --git a/lisp/org-latex.el b/lisp/org-latex.el > index c558043..f9b2c1c 100644 > --- a/lisp/org-latex.el > +++ b/lisp/org-latex.el > @@ -984,7 +984,13 @@ when PUB-DIR is set, use this as the publishing directory." > (file (buffer-file-name lbuf)) > (base (file-name-sans-extension (buffer-file-name lbuf))) > (pdffile (concat base ".pdf")) > - (cmds org-latex-to-pdf-process) > + (cmds (if (eq org-export-latex-listings 'minted) > + ;; automatically add -shell-escape when needed > + (mapcar (lambda (cmd) > + (replace-regexp-in-string > + "pdflatex " "pdflatex -shell-escape" cmd)) > + org-latex-to-pdf-process) > + org-latex-to-pdf-process)) > (outbuf (get-buffer-create "*Org PDF LaTeX Output*")) > (bibtex-p (with-current-buffer lbuf > (save-excursion