emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Add tikzDevice support to ob-R
Date: Sat, 26 Nov 2011 21:32:57 -1000	[thread overview]
Message-ID: <m1k46mhvfa.fsf@tsdye.com> (raw)

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add tikzDevice support to ob-R --]
[-- Type: text/x-patch, Size: 994 bytes --]

From 7f144d05f898565be0c3e17c8417ce81d01442b3 Mon Sep 17 00:00:00 2001
From: Thomas Dye <dk@poto.local>
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


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]


-- 
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

             reply	other threads:[~2011-11-27  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27  7:32 Thomas S. Dye [this message]
2011-11-27 12:18 ` [PATCH] Add tikzDevice support to ob-R Rasmus Pank Roulund
2011-11-28  7:08 ` Eric Schulte

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=m1k46mhvfa.fsf@tsdye.com \
    --to=tsd@tsdye.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).