emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Jarmo Hurri <jarmo.hurri@iki.fi>
Cc: emacs-orgmode@gnu.org
Subject: Re: Reproducing a table
Date: Tue, 14 Mar 2017 08:35:28 +0100	[thread overview]
Message-ID: <m2wpbspayn.fsf@christianmoe.com> (raw)
In-Reply-To: <874lyxje0m.fsf@iki.fi>


You can simplify it even further to

#+begin_src elisp :var data=my-table :hlines yes
  data  
#+end_src

which is sane enough for me.

To get simpler than that, I think you need #+INCLUDE and a separate
file.

I can't tell from the example why you need to define it in one place and
reproduce it in another, though, instead of just giving it a name right
where you want it to appear. (One situation where it would be helpful,
obviously, is if you want the same table to appear in multiple documents
that you export from the same .org file.)

Yours,
Christian


Jarmo Hurri writes:

> 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-14  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 17:13 Reproducing a table Jarmo Hurri
2017-03-14  7:35 ` Christian Moe [this message]
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=m2wpbspayn.fsf@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jarmo.hurri@iki.fi \
    /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).