emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jarmo Hurri <jarmo.hurri@iki.fi>
To: emacs-orgmode@gnu.org
Subject: Reproducing a table
Date: Mon, 13 Mar 2017 19:13:45 +0200	[thread overview]
Message-ID: <874lyxje0m.fsf@iki.fi> (raw)


Greetings (again).

What is the smartest way to reproduce a table without defining the table
as an Org source block (constraint explained below).

I can do the following, but it doesn't seem very sane (need to use elisp
or some other language just to funnel the table).

# -----------------------------------------------------------------
* define table
  #+name: my-table
  | row 1 |     1 |     2 |
  | row 2 |     3 |     4 |
  |-------+-------+-------|
  |       | col 1 | col 2 |
* reproduce entire table
  I need to be able to reproduce the entire table in my document
  #+BEGIN_SRC elisp :var data=my-table :hlines yes
  (print data)
  #+END_SRC

  #+RESULTS:
  | row 1 |     1 |     2 |
  | row 2 |     3 |     4 |
  |-------+-------+-------|
  |       | col 1 | col 2 |
* reproduce only data
  I also need to be able to pass only the data to functions
  #+BEGIN_SRC elisp :var data=my-table[0:1,1:2]
  (print data)
  #+END_SRC

  #+RESULTS:
  | 1 | 2 |
  | 3 | 4 |
# -----------------------------------------------------------------

The reason I can _not_ define the table as an Org source block is the
second example. I need to pass parts of the table as data to functions,
and constructs like my-table()[0:1,1:2] don't work. (At least I have not
been able to get them to work.)

Jarmo

             reply	other threads:[~2017-03-13 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 17:13 Jarmo Hurri [this message]
2017-03-14  7:35 ` Reproducing a table Christian Moe
2017-03-14 10:27   ` Jarmo Hurri
2017-03-14 15:38     ` Christian Moe

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=874lyxje0m.fsf@iki.fi \
    --to=jarmo.hurri@iki.fi \
    --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).