emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Inline code in tables?


From: Charles Berry
Subject: Re: [O] Inline code in tables?
Date: Fri, 12 Apr 2013 02:26:37 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

John Hendy <jw.hendy <at> gmail.com> writes:

> 
> On Thu, Apr 11, 2013 at 8:06 PM, Jay Kerns <gjkernsysu <at> gmail.com> wrote:
> > Dear John,
> >
> > On Thu, Apr 11, 2013 at 6:56 PM, John Hendy <jw.hendy <at> gmail.com> wrote:
> >> I  have a table like so:
> >
> > Please see the responses by Eric S. and Charles B. in the following thread:
> >
> > http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg00832.html
> >
> 
> Fantastic and thanks for the link. I *swore* this had just come up,
> but wasn't able to find it in my email. That's exactly what I needed.
> 
> So =brew= is accessing the results of a previous session even though
> there's no session argument? Or do all R blocks you want to refer to
> later with =brew= need to have happened in a persistent session?
> 

John,

The session is essential.

This was in that thread:


* jay's query
   :PROPERTIES:
   :session:  *R:2*
   :exports:  both
   :END:

so any exports done under that subtree refer to the *R:2* session.

====

I like brew, but another work around goes like this:

prefix every table row by 'vert-' (replace-regexp RET ^| RET vert-| RET)

Then run this block to define a 'before-parsing' hook for the exporter

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp :exports none
  (defun strip-vert (backend)
    (while (search-forward "vert-|" nil t)
      (replace-match "|" nil t)))
    (add-hook 'org-export-before-parsing-hook 'strip-vert)
#+END_SRC
--8<---------------cut here---------------end--------------->8---

Then under the `table' headline here:

--8<---------------cut here---------------start------------->8---
* table
  :PROPERTIES:
  :session:  *R*
  :EXPORT_FILE_NAME: test-table
  :END:


#+NAME: r-init
#+BEGIN_SRC R :results silent
  var1 <- "var one"
  var2 <- "var two"
  var3 <- "var three"  
#+END_SRC



I  have a table like so:
vert-| Title | Title       |
vert-|-------+-------------|
vert-| var1  | src_R{var1} |
vert-| var2  | src_R{var2} |
vert-| var3  | src_R{var3} |
--8<---------------cut here---------------end--------------->8---

Type this:

C-c C-e C-b C-s l L y y y y y 

or something similar if the session has not been previously started

This does: export body-only subtree latex in-a-buffer and 
execute each src block

and you will get:

,----
| \begin{figure}[H]
| \label{r-init}
| \begin{verbatim}
| var1 <- "var one"
| var2 <- "var two"
| var3 <- "var three"
| \end{verbatim}
| \end{figure}
| 
| 
| 
| I  have a table like so:
| \begin{center}
| \begin{tabular}{ll}
| Title & Title\\
| \hline
| var1 & \texttt{var one}\\
| var2 & \texttt{var two}\\
| var3 & \texttt{var three}\\
| \end{tabular}
| \end{center}
`----

in a buffer.

I am not sure why the problem you identify happens.

All this happens before the exporter parses anything.

Maybe something to do with fancy table usage conflicting with inline 
babel in tables?

HTH,

Chuck






reply via email to

[Prev in Thread] Current Thread [Next in Thread]