emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rick Frankel <rick@rickster.com>
To: Jisang Yoo <jisang.yoo.ac@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: How can I write side by side code comparison table
Date: Thu, 11 Jul 2013 14:17:38 -0400	[thread overview]
Message-ID: <5f495f03a8d53a846a68f4463b72c988@mail.rickster.com> (raw)
In-Reply-To: <CADtzDwb4ikpRWw-WepvFxZizODs28NSZGzoXKdAkJmAXhvFSDw@mail.gmail.com>

On 2013-07-10 18:00, Jisang Yoo wrote:
> I can write a table:
...
> but I don't know how to combine the two-column table with the two
> source code blocks in a way that exports to code tables like in
> Emergency Elisp

how about for scalars as example blocks:

#+name: emacs-scalar
#+BEGIN_SRC emacs-lisp
"emacs-lisp"
#+END_SRC

#+name: perl-scalar
#+BEGIN_SRC perl :results value
return "perl";
#+END_SRC

#+HEADER: :colnames '(emacs perl)
#+BEGIN_SRC emacs-lisp :var a=emacs-scalar b=perl-scalar
`((,a ,b))
#+END_SRC

#+RESULTS:
| emacs      | perl |
|------------+------|
| emacs-lisp | perl |


and generalized for lists:

#+name: list1
#+BEGIN_SRC emacs-lisp
'(a1 a2)
#+END_SRC

#+name: list2
#+BEGIN_SRC emacs-lisp
'(b1 b2)
#+END_SRC

#+HEADER: :colname-names '((nil list1 list2))
#+BEGIN_SRC emacs-lisp :var l1=list1 l2=list2
(require 'cl)
(mapcar* 'list l1 l2)
#+END_SRC

#+RESULTS:
| list1 | list2 |
|-------+-------|
| a1    | b1    |
| a2    | b2    |


rick

      parent reply	other threads:[~2013-07-11 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 22:00 How can I write side by side code comparison table Jisang Yoo
2013-07-11 11:13 ` Jambunathan K
2013-07-11 18:17 ` Rick Frankel [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=5f495f03a8d53a846a68f4463b72c988@mail.rickster.com \
    --to=rick@rickster.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jisang.yoo.ac@gmail.com \
    /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).