From mboxrd@z Thu Jan 1 00:00:00 1970 From: RJ Cunningham Subject: Re: issues with export of LaTeX figure captions Date: Mon, 06 May 2013 17:39:48 +0800 Message-ID: <87fvy0la57.fsf@iinet.net.au> References: <87y5bt9bjz.fsf@iinet.net.au> <86fvy0y3tf.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZHth-0002UO-Ba for emacs-orgmode@gnu.org; Mon, 06 May 2013 05:39:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZHtf-00044c-BC for emacs-orgmode@gnu.org; Mon, 06 May 2013 05:39:53 -0400 Received: from icp-osb-irony-out1.external.iinet.net.au ([203.59.1.210]:16462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZHte-00043p-UQ for emacs-orgmode@gnu.org; Mon, 06 May 2013 05:39:51 -0400 In-Reply-To: <86fvy0y3tf.fsf@somewhere.org> (Sebastien Vauban's message of "Mon, 06 May 2013 09:18:04 +0200") 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: Sebastien Vauban Cc: emacs-orgmode@gnu.org Thanks for the reply Seb, "Sebastien Vauban" writes: > Hi RJ, > > RJ Cunningham wrote: >> I've encountered an issue/difference with the way the recent "babel >> processor" handles captions. >> >> In versions prior to 8 the following WORKED (on export produced a figure >> environment with a caption): >> >> #+CAPTION: Fails to produce table environment and so caption in the new orgmode >> #+LABEL: fig:fails >> #+begin_src R :session :results graphics :file fails.pdf :exports results >> plot(1:10) >> #+end_src > > Side-remark: I find it weird, if not uncorrect, to have the header argument > ":session" empty. IIRC, this is, at best, dangerous, because it could > interpret what follows as its value. I guess it could be dangerous, though it is convenient and I don't believe it has ever caused me any issues. I note that at one time, at least, a name was an optional argument for the :session header (see http://www.jstatsoft.org/v46/i03/paper p 10). I will consider being less weird though as you suggest. > >> Under orgmode version 8.0.2 (8.0.2-2-g93da18-elpa the same code does >> not work, the includegraphics is exported sans the figure environment. >> >> Under this latest orgmode the following does work: >> >> #+begin_src R :session :results graphics :file ok.pdf :exports results >> plot(1:10) >> #+end_src >> #+CAPTION: Succeeds to produce table environment and so caption >> #+LABEL: fig:OK >> #+RESULTS[2d39a23f088d95e808bb867f97a0ecd2df621bbd]: >> [[file:ok.pdf]] >> >> However, this second construction of code has the following issues: >> 1. it is different to prior method which worked > > Yes, a lot of changes have been made in Org 8. This is for good, even if the > switch can be somewhat painful. Indeed. > >> 2. it is ugly to have the caption sandwiched between the code and the >> results > > Not really. Please well think that there are two different beasts here: the > code block and the results block. You can export both, and you could attach > (different) captions to both. So, that does not seems that illogical to me. OK, that is not something I have ever needed but I see that it would make sense in such a situation. Is there any way that I can export figures with captions WITHOUT having to execute the code and capture the results in the org file. With the previous construction the caption was added to the executed code results on export-so reducing the clutter in the org file by not having the results in the org file. >> 3. often, but not always, when the code is re-executed the caption and >> label is lost > > Can you provide an ECM for this? > The problem seems to relate to :cache This gobbles up the caption and label. #+begin_src R :session :results graphics :file ok.pdf :exports results :cache yes plot(1:10, col="blue",cex=1) #+end_src #+CAPTION: Succeeds to produce table environment and so caption XXXX #+LABEL: fig:OK #+RESULTS: [[file:ok.pdf]] :cache no is fine Cheers, Robert