emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Generating captions--is there a better way?
@ 2012-11-02  3:00 Michael Gauland
  2012-11-02  5:43 ` cberry
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Gauland @ 2012-11-02  3:00 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-02  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02  3:00 Generating captions--is there a better way? Michael Gauland
2012-11-02  5:43 ` cberry

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