all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How can I write side by side code comparison table
@ 2013-07-10 22:00 Jisang Yoo
  2013-07-11 11:13 ` Jambunathan K
  2013-07-11 18:17 ` Rick Frankel
  0 siblings, 2 replies; 3+ messages in thread
From: Jisang Yoo @ 2013-07-10 22:00 UTC (permalink / raw
  To: emacs-orgmode

I can write a table:

| Python | Emacs Lisp |
|--------+------------|
|        |            |

and I can write two source code blocks:

#+BEGIN_SRC python
  a = [0, 1, 2]
  a[0] += 10
#+END_SRC

#+BEGIN_SRC elisp
  (setq a (vector 0 1 2))
  (cl-incf (elt a 0) 10)
#+END_SRC

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I write side by side code comparison table
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Jambunathan K @ 2013-07-11 11:13 UTC (permalink / raw
  To: Jisang Yoo; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

Jisang Yoo <jisang.yoo.ac@gmail.com> writes:

> I can write a table:
>
> | Python | Emacs Lisp |
> |--------+------------|
> |        |            |
>
> and I can write two source code blocks:
>
> #+BEGIN_SRC python
>   a = [0, 1, 2]
>   a[0] += 10
> #+END_SRC
> #+BEGIN_SRC elisp
>   (setq a (vector 0 1 2))
>   (cl-incf (elt a 0) 10)
> #+END_SRC
>
> 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

The ODT exporter - I believe it is *the only* exporter - that has
something called list tables.  See attachments.  You can make a special
request to turn it on for other exporters.

As far as HTML export is concerned there are some special CSS tricks
that you can use.  Search for posts by Christian Moe and look for the
keywords "side-by-side", "list table" or something like that.  You will
see atleast 3-5 threads where this question has popped up.


[-- Attachment #2: list-table.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10162 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: list-table.org --]
[-- Type: text/x-org, Size: 214 bytes --]

#+attr_odt: :list-table t
- Python
  - Elisp
- 
  #+BEGIN_SRC python
    a = [0, 1, 2]
    a[0] += 10
  #+END_SRC
  - 
    #+BEGIN_SRC elisp
      (setq a (vector 0 1 2))
      (cl-incf (elt a 0) 10)
    #+END_SRC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I write side by side code comparison table
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Rick Frankel @ 2013-07-11 18:17 UTC (permalink / raw
  To: Jisang Yoo; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-11 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.