Jay Kerns <gjkernsysu <at> 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} `----