emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Reproducing a table


From: Jarmo Hurri
Subject: [O] Reproducing a table
Date: Mon, 13 Mar 2017 19:13:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

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 via email to

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