emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Gauland <mikelygee@no8wireless.co.nz>
To: emacs-orgmode@gnu.org
Subject: Generating captions--is there a better way?
Date: Fri, 2 Nov 2012 03:00:50 +0000 (UTC)	[thread overview]
Message-ID: <loom.20121102T034842-341@post.gmane.org> (raw)

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	other threads:[~2012-11-02  3:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02  3:00 Michael Gauland [this message]
2012-11-02  5:43 ` Generating captions--is there a better way? cberry

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=loom.20121102T034842-341@post.gmane.org \
    --to=mikelygee@no8wireless.co.nz \
    --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).