emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Generating captions--is there a better way?


From: Michael Gauland
Subject: [O] Generating captions--is there a better way?
Date: Fri, 2 Nov 2012 03:00:50 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I use R to plot data, and like to include information about the plot in the
caption. I do this by combining two named SRC blocks--one for the image, and one
for the caption--and then put their #+RESULTS: together. The caption is the
tricky bit; I use R to print a string that starts with #+CAPTION:, shown in the
exmaple below. While this works, I've wondered if there is a more elegant way to
do this. How do others do this?

Kind Regards,
Mike Gauland

----- example -----

#+NAME: image
#+HEADER: :session
#+HEADER: :results graphics
#+HEADER: :exports results
#+HEADER: :file (org-babel-temp-file "./figure-" ".pdf")
#+BEGIN_SRC R
x <- rnorm(100)
hist(x)
#+END_SRC

#+NAME: caption
#+HEADER: :session
#+HEADER: :results raw
#+HEADER: :exports results
#+BEGIN_SRC R 
print(paste("#+CAPTION: The mean value is ",
            format(mean(x), digits=3),
            ".", sep=""));
#+END_SRC

#+RESULTS: caption
#+RESULTS: image





reply via email to

[Prev in Thread] Current Thread [Next in Thread]