emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Charles Berry <ccberry@ucsd.edu>
To: emacs-orgmode@gnu.org
Subject: Re: Inline code in tables?
Date: Fri, 12 Apr 2013 02:26:37 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130412T040334-220@post.gmane.org> (raw)
In-Reply-To: CA+M2ft8GC8aCWWxK977jOPMSy9-HAXCvN_MR=WOezLQi16YKdg@mail.gmail.com

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	other threads:[~2013-04-12  2:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20130412T040334-220@post.gmane.org \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).