From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: inline Babel calls in math environments and table cells Date: Wed, 13 Mar 2013 02:31:37 +0000 (UTC) Message-ID: References: <8738w1fx1o.fsf@gmail.com> 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]:57828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFbU1-00057h-JT for emacs-orgmode@gnu.org; Tue, 12 Mar 2013 22:32:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFbU0-0000Xv-4p for emacs-orgmode@gnu.org; Tue, 12 Mar 2013 22:32:01 -0400 Received: from plane.gmane.org ([80.91.229.3]:53948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFbTz-0000Xo-Tc for emacs-orgmode@gnu.org; Tue, 12 Mar 2013 22:32:00 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UFbUJ-0005v3-51 for emacs-orgmode@gnu.org; Wed, 13 Mar 2013 03:32:19 +0100 Received: from 137.110.34.176 ([137.110.34.176]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Mar 2013 03:32:19 +0100 Received: from ccberry by 137.110.34.176 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Mar 2013 03:32:19 +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 Jay Kerns gmail.com> writes: > > Hello, > > I went back and spent some time to rethink how I was approaching my > problem. Instead of inline src blocks like this: > > \( SRC_R{blah} \) > > or this > > | SRC_R{blah} | [deleted noweb stuff] > This method works. I think it would be cool if it were possible to > evaluate inline src blocks all over the place but on the other hand > there are other tools which might be better suited for that kind of > work. At least for the time being. > Jay, It seems unlikely that inline src blocks will be allowed in table cells. In org-element.el, there is this in org-element-object-restrictions - the alist of objects restrictions: ,---- | ;; Ignore inline babel call and inline src block as formulas are | ;; possible. Also ignore line breaks and statistics cookies. | (table-cell export-snippet footnote-reference latex-or-entity link macro | radio-target sub/superscript target text-markup timestamp) `---- Another way to get where you want to go is to use the =brew= R package. The markup is very simple - use <%= code %> in place of src_R{ code }. Example: ,---- | #+DRAWERS: TABLEDRAWER | | * jay's query | :PROPERTIES: | :session: *R:2* | :exports: both | :END: | | #+BEGIN_SRC R :results value | A <- matrix(sample(100, size = 6), nrow = 2) | #+END_SRC | | #+RESULTS: | | 51 | 77 | 63 | | | 65 | 20 | 56 | | | Put a table with brew markup in an example block in a drawer, so it | will not appear in the output. | | :TABLEDRAWER: | #+NAME: src-blk-out | #+BEGIN_EXAMPLE | | a | b | <%= A[1,3] %> | | | c | d | eeeee | | #+END_EXAMPLE | :END: | | Then use a call to ~brew()~ to run it. Note =:results output raw= | #+NAME: test-src-blk-out | #+BEGIN_SRC R :results output raw :var tab=src-blk-out | require(brew) | brew(text=tab) | #+END_SRC `---- With point in or below the headline, C-c C-e C-s C-b l L exports the above as ,---- | \begin{verbatim} | A <- matrix(sample(100, size = 6), nrow = 2) | \end{verbatim} | | \begin{center} | \begin{tabular}{rrr} | 2 & 16 & 30\\ | 11 & 81 & 86\\ | \end{tabular} | \end{center} | | Put a table with brew markup in an example block in a drawer, so it | will not appear in the output. | | Then use a call to \verb~brew()~ to run it. Note \texttt{:results output raw} | \label{test-src-blk-out} | \begin{verbatim} | require(brew) | brew(text=tab) | \end{verbatim} | | \begin{center} | \begin{tabular}{llr} | a & b & 30\\ | c & d & eeeee\\ | \end{tabular} | \end{center} `----