emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Inline code in tables?
@ 2013-04-11 22:56 John Hendy
  2013-04-12  1:06 ` Jay Kerns
  0 siblings, 1 reply; 4+ messages in thread
From: John Hendy @ 2013-04-11 22:56 UTC (permalink / raw)
  To: emacs-orgmode

I  have a table like so:

| Title | Title                   |
|-------+-------------------------|
| var1  | src_R[:session r]{var1} |
| var2  | src_R[:session r]{var2} |
| var3  | src_R[:session r]{var3} |

I just had the same in an itemized list, and it worked fine. Then I
wanted to add more attributes and thought a table would be a better
bet. The table is exporting as LaTeX math formatted:

\begin{tabular}{ll}
\toprule
Title & Title\\
\midrule
var1 & src$_\mathrm{R[}$:session r]\{var1\}\\
var2 & src$_\mathrm{R[}$:session r]\{var2\}\\
var3 & src$_\mathrm{R[}$:session r]\{var3\}\\
\bottomrule
\end{tabular}


Thanks for any suggestions,
John

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Inline code in tables?
  2013-04-11 22:56 Inline code in tables? John Hendy
@ 2013-04-12  1:06 ` Jay Kerns
  2013-04-12  1:25   ` John Hendy
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Kerns @ 2013-04-12  1:06 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Dear John,

On Thu, Apr 11, 2013 at 6:56 PM, John Hendy <jw.hendy@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

I hope this helps,

-- 
Jay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Inline code in tables?
  2013-04-12  1:06 ` Jay Kerns
@ 2013-04-12  1:25   ` John Hendy
  2013-04-12  2:26     ` Charles Berry
  0 siblings, 1 reply; 4+ messages in thread
From: John Hendy @ 2013-04-12  1:25 UTC (permalink / raw)
  To: Jay Kerns; +Cc: emacs-orgmode

On Thu, Apr 11, 2013 at 8:06 PM, Jay Kerns <gjkernsysu@gmail.com> wrote:
> Dear John,
>
> On Thu, Apr 11, 2013 at 6:56 PM, John Hendy <jw.hendy@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?


Thanks,
John

> I hope this helps,
>
> --
> Jay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Inline code in tables?
  2013-04-12  1:25   ` John Hendy
@ 2013-04-12  2:26     ` Charles Berry
  0 siblings, 0 replies; 4+ messages in thread
From: Charles Berry @ 2013-04-12  2:26 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-12  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 22:56 Inline code in tables? John Hendy
2013-04-12  1:06 ` Jay Kerns
2013-04-12  1:25   ` John Hendy
2013-04-12  2:26     ` Charles Berry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).