From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: [PATCH] Add tikzDevice support to ob-R Date: Sat, 26 Nov 2011 21:32:57 -1000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUZEa-0007Zl-AJ for emacs-orgmode@gnu.org; Sun, 27 Nov 2011 02:33:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RUZEY-0004Dj-Tr for emacs-orgmode@gnu.org; Sun, 27 Nov 2011 02:33:08 -0500 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:41048) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RUZEY-0004DC-Jw for emacs-orgmode@gnu.org; Sun, 27 Nov 2011 02:33:06 -0500 Received: from cpe-24-94-66-191.hawaii.res.rr.com ([24.94.66.191] helo=poto) by box472.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1RUZEU-0004Ci-Ba for emacs-orgmode@gnu.org; Sun, 27 Nov 2011 00:33:03 -0700 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: Org-mode --=-=-= Aloha all, The attached patch adds tikzDevice support to ob-R. It requires that the tikzDevice package be available to R, so it must be installed and loaded. Something like the following code in .Rprofile will load the package by default: old <- getOption("defaultPackages") options(defaultPackages = c(old, "tikzDevice")) Then, specify a .tex file in the :file header argument of the R source code block, e.g., :file intervals.tex, and the graphic will be produced by tikzDevice. The advantage of this for LaTeX export is that the resulting file will be set with the fonts of its surrounding document. Something like this works for me, where the \sffamily command uses the document's sans serif font and the file is called intervals.tex: \begin{figure}[htb!] \centering \sffamily \input{../figure/intervals} \caption[Elapsed time between Polynesian colonization of Hawai`i and fire-pit use]{Elapsed time between Polynesian colonization of Hawai`i and fire-pit use.} \label{fig:elapsed-time} \end{figure} All the best, Tom --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-R.el-Added-tikzDevice-support.patch Content-Description: Add tikzDevice support to ob-R >From 7f144d05f898565be0c3e17c8417ce81d01442b3 Mon Sep 17 00:00:00 2001 From: Thomas Dye Date: Sat, 26 Nov 2011 21:17:00 -1000 Subject: [PATCH] * lisp/ob-R.el: Added tikzDevice support. --- lisp/ob-R.el | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 79cc0be..d8c3d6b 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -197,6 +197,7 @@ current code buffer." '((:bmp . "bmp") (:jpg . "jpeg") (:jpeg . "jpeg") + (:tex . "tikz") (:tiff . "tiff") (:png . "png") (:svg . "svg") @@ -214,7 +215,7 @@ current code buffer." (setq device (or (and device (cdr (assq (intern (concat ":" device)) devices))) "png")) (setq filearg - (if (member device '("pdf" "postscript" "svg")) "file" "filename")) + (if (member device '("pdf" "postscript" "svg" "tikz")) "file" "filename")) (setq args (mapconcat (lambda (pair) (if (member (car pair) allowed-args) -- 1.7.5.4 --=-=-= -- T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com --=-=-=--