From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [patch] ox-latex.el: support for pgf files Date: Mon, 20 May 2013 12:11:33 +0200 Message-ID: <87zjvqq7u2.fsf@pank.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeN4J-0000se-Lw for emacs-orgmode@gnu.org; Mon, 20 May 2013 06:11:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeN4I-0002Aw-Mc for emacs-orgmode@gnu.org; Mon, 20 May 2013 06:11:51 -0400 Received: from plane.gmane.org ([80.91.229.3]:47336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeN4I-0002Ab-CD for emacs-orgmode@gnu.org; Mon, 20 May 2013 06:11:50 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UeN4G-0005p1-Vo for emacs-orgmode@gnu.org; Mon, 20 May 2013 12:11:48 +0200 Received: from dynamic-adsl-94-34-144-49.clienti.tiscali.it ([94.34.144.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 May 2013 12:11:48 +0200 Received: from rasmus.pank by dynamic-adsl-94-34-144-49.clienti.tiscali.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 May 2013 12:11:48 +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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit This patch adds support for pgf files. pgf is the machine upon which tikz is build. For instance matplotlib (of Python) and printpgf (of Octave) both produces pgf files. It's just a question of recognizing the extension. With this patch the following document exports correctly: #+TITLE: PGF test #+LATEX_HEADER: \usepackage{pgf} #+BEGIN_SRC emacs-lisp :exports none (set (make-local-variable 'org-latex-pdf-process) '("xelatex -pdf %f")) #+END_SRC #+BEGIN_SRC python :results raw :exports results from matplotlib import pylab as plt x, y = plt.rand(2) plt.scatter(x, y) fig = "test.pgf" plt.savefig(fig) ## utf8 by default return("".join(["[[file:", fig, "]]"])) #+END_SRC –Rasmus -- Hooray! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Support-for-pgf-files-in-ox-latex.el.patch >From ff4f43378779eb557213df1cd474a5232333af7d Mon Sep 17 00:00:00 2001 From: "rasmus.pank" Date: Mon, 20 May 2013 11:58:47 +0200 Subject: [PATCH] Support for pgf files in ox-latex.el * ox-latex.el: pgf is recognized as an inline image and treated the same way tikz files. Python matplotlib and pgfprint for Octave generates pgf plots rather than TiKZ plots. They need just be included via \input{.}. TINYCHANGE --- 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 41cf1d0..fdada8b 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -420,7 +420,7 @@ environment." :type 'string) (defcustom org-latex-inline-image-rules - '(("file" . "\\.\\(pdf\\|jpeg\\|jpg\\|png\\|ps\\|eps\\|tikz\\)\\'")) + '(("file" . "\\.\\(pdf\\|jpeg\\|jpg\\|png\\|ps\\|eps\\|tikz\\|pgf\\)\\'")) "Rules characterizing image files that can be inlined into LaTeX. A rule consists in an association whose key is the type of link @@ -1739,7 +1739,7 @@ used as a communication channel." (if (not (string-match "\\`\\[\\(.*\\)\\]\\'" opt)) opt (match-string 1 opt)))) image-code) - (if (equal filetype "tikz") + (if (member filetype '("tikz" "pgf")) ;; For tikz images: ;; - use \input to read in image file. ;; - if options are present, wrap in a tikzpicture environment. -- 1.8.2.3 --=-=-=--