emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Austin Frank <austin.frank@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: include value of single table cell in text?
Date: Tue, 27 Jul 2010 08:43:59 -0600	[thread overview]
Message-ID: <87lj8xc7dc.fsf@gmail.com> (raw)
In-Reply-To: <m0iq41pb31.fsf@malibu.rochester.rr.com> (Austin Frank's message of "Tue, 27 Jul 2010 04:45:22 -0400")

The following should work.  It uses an inline code block

--8<---------------cut here---------------start------------->8---
#+TBLNAME:  test-table
| key | value |
|-----+-------|
| a   |     1 |
| b   |     2 |

Is there any way to refer to cell @2$2 within the text of an org-mode
document, and have that reference converted to the value
src_emacs-lisp[:var d=test-table[3,1]]{d} during export?
--8<---------------cut here---------------end--------------->8---

Best -- Eric

Austin Frank <austin.frank@gmail.com> writes:

> Hello!
>
> Is it possible to include the value of a single cell from an org-mode
> table in the body of an org-mode document? That is, given
>
> #+TBLNAME:  test-table
> | key | value |
> |-----+-------|
> | a   |     1 |
> | b   |     2 |
>
> Is there any way to refer to cell @2$2 within the text of an org-mode
> document, and have that reference converted to the value "2" during
> export?
>
> I believe one approach would be to use babel's in-line source evaluation
> capabilities along with the remote() function from the org spreadsheet
> editor.  But I haven't yet been able to identify the right combination
> of those functions to get the desired result.  This, for example,
> doesn't work for me:
>
> #+TBLNAME:  test-table
> | key | value |
> |-----+-------|
> | a   | 1     |
> | b   | 2     |
>
> I'm testing to see whether
> src_emacs-lisp{(org-table-eval-formula "remote(test-table @2$2)")}
> works.
>
> It throws an error during export, because I'm not in a table data field.
>
>
> Additionally, if there's not already a built-in way to do this, I'd
> nominate this functionality for some special syntax.  Following babel's
> inlining and remote reference conventions, maybe
>
>   table{test-table @2$2}
>
> or
>
>   <<test-table:@2$2>>
>
> This would make it very easy to refer to specific elements the tabular
> output of babel blocks, adding to the utility of babel as a
> meta-programming language for org-mode.
>
>
> Thanks for any help!
> /au

  reply	other threads:[~2010-07-27 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27  8:45 include value of single table cell in text? Austin Frank
2010-07-27 14:43 ` Eric Schulte [this message]
2010-07-28 18:38   ` Austin Frank

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=87lj8xc7dc.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=austin.frank@gmail.com \
    --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).