From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Gauland Subject: Generating captions--is there a better way? Date: Fri, 2 Nov 2012 03:00:50 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU7VJ-0001mp-5H for emacs-orgmode@gnu.org; Thu, 01 Nov 2012 23:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU7VI-0007Sk-2V for emacs-orgmode@gnu.org; Thu, 01 Nov 2012 23:01:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:49799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU7VH-0007Sb-S7 for emacs-orgmode@gnu.org; Thu, 01 Nov 2012 23:01:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TU7VM-0006qF-Sb for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 04:01:09 +0100 Received: from 218-101-54-25.trimble.co.nz ([218.101.54.25]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Nov 2012 04:01:08 +0100 Received: from mikelygee by 218-101-54-25.trimble.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Nov 2012 04:01:08 +0100 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: emacs-orgmode@gnu.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