emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <dandavison7@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: PATCH: New options for latex src code export
Date: Sat, 11 Jun 2011 13:48:06 -0700	[thread overview]
Message-ID: <m1mxhonlh5.fsf@gmail.com> (raw)
In-Reply-To: 87hbc4teqs.fsf@gnu.org

Bastien <bastien.guerry@wikimedia.fr> writes:

> Hi Dan,
>
> Dan Davison <dandavison7@gmail.com> 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

  reply	other threads:[~2011-06-11 20:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 19:42 PATCH: New options for latex src code export Dan Davison
2011-02-16 11:12 ` Bastien
2011-06-11 20:48   ` Dan Davison [this message]
2011-02-17 14:20 ` Mike McLean

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=m1mxhonlh5.fsf@gmail.com \
    --to=dandavison7@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).